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