Package version up to 4.1.22
[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.22
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 %install
95 rm -rf %{buildroot}
96 %make_install
97
98 %__mkdir_p %{buildroot}%{_tmpfilesdir}
99 install -m 0644 %SOURCE1002 %{buildroot}%{_tmpfilesdir}/sw_sync.conf
100
101 %__mkdir_p %{buildroot}%{_unitdir_user}
102 install -m 644 service/tbm-drm-auth-user.service %{buildroot}%{_unitdir_user}
103 install -m 644 service/tbm-drm-auth-user.path %{buildroot}%{_unitdir_user}
104
105 %if 0%{?gcov:1}
106 find haltests/ -name '*.gcno' -exec rm {} \;
107
108 builddir=$(basename $PWD)
109 gcno_obj_dir=%{buildroot}%{_datadir}/gcov/obj/%{name}/"$builddir"
110 mkdir -p "$gcno_obj_dir"
111 find . -name '*.gcno' -exec cp --parents '{}' "$gcno_obj_dir" ';'
112 %endif
113
114 %clean
115 rm -rf %{buildroot}
116
117 %pre
118 %__mkdir_p %{_unitdir_user}/basic.target.wants
119 ln -sf ../tbm-drm-auth-user.path %{_unitdir_user}/basic.target.wants/
120
121 %post
122 %if "%{HALTESTS_PACKAGE}" == "1"
123 if [ -f %{_bindir}/tbm-haltests ]; then
124     rm -f %{_bindir}/tbm-haltests
125 fi
126 ln -s %{_bindir}/hal/tbm-haltests %{_bindir}/tbm-haltests
127 %endif
128
129 %postun -p /sbin/ldconfig
130 rm -f %{_unitdir_user}/basic.target.wants/tbm-drm-auth-user.path
131
132 %files
133 %manifest %{name}.manifest
134 %defattr(-,root,root,-)
135 %license COPYING
136 %{_libdir}/libtbm.so.*
137 %{_unitdir_user}/tbm-drm-auth-user.path
138 %{_unitdir_user}/tbm-drm-auth-user.service
139 %{_tmpfilesdir}/sw_sync.conf
140
141 %files devel
142 %manifest %{name}.manifest
143 %defattr(-,root,root,-)
144 %dir %{_includedir}
145 %{_includedir}/tbm_*.h
146 %{_libdir}/libtbm.so
147 %{_libdir}/pkgconfig/libtbm.pc
148
149 %if "%{HALTESTS_PACKAGE}" == "1"
150 %files haltests
151 %defattr(-,root,root,-)
152 %{_bindir}/hal/tbm-haltests
153 %endif
154
155 %if 0%{?gcov:1}
156 %files gcov
157 %{_datadir}/gcov/obj/*
158 %endif