Package version up to 4.1.9
[platform/core/uifw/libtbm.git] / packaging / libtbm.spec
1 %bcond_with x
2 %bcond_with wayland
3 %define HALTESTS_PACKAGE 1
4 %if 0%{?gcov:1}
5 %define HALTESTS_GCOV    1
6 %else
7 %define HALTESTS_GCOV    0
8 %endif
9
10 %define _tmpfilesdir /usr/lib/tmpfiles.d
11
12 Name:           libtbm
13 Version:        4.1.9
14 Release:        1
15 License:        MIT
16 Summary:        The library for Tizen Buffer Manager
17 Group:          System/Libraries
18 Source0:        %{name}-%{version}.tar.gz
19 Source1001:             %name.manifest
20 Source1002:     sw_sync.conf
21
22 BuildRequires:  pkgconfig(libdrm)
23 BuildRequires:  pkgconfig(wayland-server)
24 BuildRequires:  pkgconfig(wayland-client)
25 BuildRequires:  pkgconfig(capi-base-common)
26 BuildRequires:  pkgconfig(libpng)
27 BuildRequires:  pkgconfig(dlog)
28 BuildRequires:  pkgconfig(pixman-1)
29 BuildRequires:  pkgconfig(gmock)
30 BuildRequires:  pkgconfig(hal-api-tbm)
31
32 %description
33 Description: %{summary}
34
35 %package devel
36 Summary:        Tizen Buffer Manager Library - Development
37 Group:          Development/Libraries
38 Requires:       libtbm = %{version}
39 Requires:       pkgconfig(capi-base-common)
40
41 %description devel
42 The library for Tizen Buffer Manager.
43
44 Development Files.
45
46 %if 0%{?gcov:1}
47 %package gcov
48 Summary: Tizen Buffer Manager gcov data package
49 Group: Development/Libraries
50
51 %description gcov
52 Tizen Buffer Manager gcno data for gcov
53 %endif
54
55 %if "%{HALTESTS_PACKAGE}" == "1"
56 %package haltests
57 Summary: Tizen Buffer Manager unit tests package
58 Group: System/Libraries
59
60 %description haltests
61 Test module for testing libtbm APIs
62 %endif
63
64 %global TZ_SYS_RO_SHARE  %{?TZ_SYS_RO_SHARE:%TZ_SYS_RO_SHARE}%{!?TZ_SYS_RO_SHARE:/usr/share}
65
66 %prep
67 %setup -q
68 cp %{SOURCE1001} .
69
70 %build
71 HALTESTS="no"
72
73 %if "%{HALTESTS_PACKAGE}" == "1"
74 HALTESTS="yes"
75 %endif
76
77 %if "%{HALTESTS_GCOV}" == "1"
78 CFLAGS+=" -fprofile-arcs -ftest-coverage -DTIZEN_TEST_GCOV"
79 CXXFLAGS+=" -fprofile-arcs -ftest-coverage -DTIZEN_TEST_GCOV"
80 LDFLAGS+=" -lgcov"
81 %endif
82
83 %if %{with wayland}
84 %reconfigure --prefix=%{_prefix} --with-tbm-platform=WAYLAND  --with-haltests=${HALTESTS} --bindir=%{_bindir}/hal \
85             --with-default-dlog=yes \
86             CFLAGS="${CFLAGS} -Wall -Werror" LDFLAGS="${LDFLAGS} -Wl,--hash-style=both -Wl,--as-needed"
87 %else
88 %reconfigure --prefix=%{_prefix} --with-tbm-platform=X11  --with-haltests=${HALTESTS} --bindir=%{_bindir}/hal \
89             CFLAGS="${CFLAGS} -Wall -Werror" LDFLAGS="${LDFLAGS} -Wl,--hash-style=both -Wl,--as-needed"
90 %endif
91
92 make %{?_smp_mflags}
93
94 %if 0%{?gcov:1}
95 mkdir -p gcov-obj
96 find . -name '*.gcno' -exec cp '{}' gcov-obj ';'
97 rm gcov-obj/tbm_haltests-tc*
98 %endif
99
100 %install
101 rm -rf %{buildroot}
102 %make_install
103
104 %__mkdir_p %{buildroot}%{_tmpfilesdir}
105 install -m 0644 %SOURCE1002 %{buildroot}%{_tmpfilesdir}/sw_sync.conf
106
107 %__mkdir_p %{buildroot}%{_unitdir_user}
108 install -m 644 service/tbm-drm-auth-user.service %{buildroot}%{_unitdir_user}
109 install -m 644 service/tbm-drm-auth-user.path %{buildroot}%{_unitdir_user}
110
111 %if 0%{?gcov:1}
112 mkdir -p %{buildroot}%{_datadir}/gcov/obj
113 install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj
114 %endif
115
116 %clean
117 rm -rf %{buildroot}
118
119 %pre
120 %__mkdir_p %{_unitdir_user}/basic.target.wants
121 ln -sf ../tbm-drm-auth-user.path %{_unitdir_user}/basic.target.wants/
122
123 %post
124 %if "%{HALTESTS_PACKAGE}" == "1"
125 if [ -f %{_bindir}/tbm-haltests ]; then
126     rm -f %{_bindir}/tbm-haltests
127 fi
128 ln -s %{_bindir}/hal/tbm-haltests %{_bindir}/tbm-haltests
129 %endif
130
131 %postun -p /sbin/ldconfig
132 rm -f %{_unitdir_user}/basic.target.wants/tbm-drm-auth-user.path
133
134 %files
135 %manifest %{name}.manifest
136 %defattr(-,root,root,-)
137 %license COPYING
138 %{_libdir}/libtbm.so.*
139 %{_unitdir_user}/tbm-drm-auth-user.path
140 %{_unitdir_user}/tbm-drm-auth-user.service
141 %{_tmpfilesdir}/sw_sync.conf
142
143 %files devel
144 %manifest %{name}.manifest
145 %defattr(-,root,root,-)
146 %dir %{_includedir}
147 %{_includedir}/tbm_*.h
148 %{_libdir}/libtbm.so
149 %{_libdir}/pkgconfig/libtbm.pc
150
151 %if "%{HALTESTS_PACKAGE}" == "1"
152 %files haltests
153 %defattr(-,root,root,-)
154 %{_bindir}/hal/tbm-haltests
155 %endif
156
157 %if 0%{?gcov:1}
158 %files gcov
159 %{_datadir}/gcov/obj/*
160 %endif