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