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