09527d0fc410f0a082245c72e25de2aa0d051c79
[platform/core/uifw/libtbm.git] / packaging / libtbm.spec
1 %bcond_with x
2 %bcond_with wayland
3 %bcond_with utest
4
5 Name:           libtbm
6 Version:        2.0.4
7 Release:        1
8 License:        MIT
9 Summary:        The library for Tizen Buffer Manager
10 Group:          System/Libraries
11 Source0:        %{name}-%{version}.tar.gz
12 Source1001:             %name.manifest
13
14 BuildRequires:  pkgconfig(libdrm)
15 BuildRequires:  pkgconfig(wayland-server)
16 BuildRequires:  pkgconfig(wayland-client)
17 BuildRequires:  pkgconfig(capi-base-common)
18 BuildRequires:  pkgconfig(libpng)
19 BuildRequires:  pkgconfig(dlog)
20
21 %if %{with utest}
22 BuildRequires:  gtest-devel
23 %endif
24
25 %description
26 Description: %{summary}
27
28 %package devel
29 Summary:        Tizen Buffer Manager Library - Development
30 Group:          Development/Libraries
31 Requires:       libtbm = %{version}
32 Requires:       pkgconfig(capi-base-common)
33
34 %description devel
35 The library for Tizen Buffer Manager.
36
37 Development Files.
38
39 %global TZ_SYS_RO_SHARE  %{?TZ_SYS_RO_SHARE:%TZ_SYS_RO_SHARE}%{!?TZ_SYS_RO_SHARE:/usr/share}
40
41 %prep
42 %setup -q
43 cp %{SOURCE1001} .
44
45 %build
46 UTEST="no"
47
48 %if %{with utest}
49 UTEST="yes"
50 %endif
51
52 %if %{with wayland}
53 %reconfigure --prefix=%{_prefix} --with-tbm-platform=WAYLAND  --with-utest=${UTEST} \
54             CFLAGS="${CFLAGS} -Wall -Werror" LDFLAGS="${LDFLAGS} -Wl,--hash-style=both -Wl,--as-needed"
55 %else
56 %reconfigure --prefix=%{_prefix} --with-tbm-platform=X11  --with-utest=${UTEST} \
57             CFLAGS="${CFLAGS} -Wall -Werror" LDFLAGS="${LDFLAGS} -Wl,--hash-style=both -Wl,--as-needed"
58 %endif
59
60 make %{?_smp_mflags}
61
62 %if %{with utest}
63 make -C ut check
64 %endif
65
66 %install
67 rm -rf %{buildroot}
68 mkdir -p %{buildroot}/%{TZ_SYS_RO_SHARE}/license
69 cp -af COPYING %{buildroot}/%{TZ_SYS_RO_SHARE}/license/%{name}
70 %make_install
71
72
73 %__mkdir_p %{buildroot}%{_unitdir}
74 install -m 644 service/tbm-drm-auth.service %{buildroot}%{_unitdir}
75 install -m 644 service/tbm-drm-auth.path %{buildroot}%{_unitdir}
76 %__mkdir_p %{buildroot}%{_unitdir_user}
77 install -m 644 service/tbm-drm-auth-user.service %{buildroot}%{_unitdir_user}
78 install -m 644 service/tbm-drm-auth-user.path %{buildroot}%{_unitdir_user}
79
80 %clean
81 rm -rf %{buildroot}
82
83 %pre
84 %__mkdir_p %{_unitdir}/graphical.target.wants
85 ln -sf ../tbm-drm-auth.path %{_unitdir}/graphical.target.wants/
86
87 %if "%{?profile}" == "mobile" || "%{?profile}" == "wearable"
88 %__mkdir_p %{_unitdir_user}/basic.target.wants
89 ln -sf ../tbm-drm-auth-user.path %{_unitdir_user}/basic.target.wants/
90 %else
91 %__mkdir_p %{_unitdir_user}/default.target.wants
92 ln -sf ../tbm-drm-auth-user.path %{_unitdir_user}/default.target.wants/
93 %endif
94
95 %post -p /sbin/ldconfig
96 %postun -p /sbin/ldconfig
97 rm -f %{_unitdir}/graphical.target.wants/tbm-drm-auth.path
98
99 %if "%{?profile}" == "mobile" || "%{?profile}" == "wearable"
100 rm -f %{_unitdir_user}/basic.target.wants/tbm-drm-auth-user.path
101 %else
102 rm -f %{_unitdir_user}/default.target.wants/tbm-drm-auth-user.path
103 %endif
104
105 %files
106 %manifest %{name}.manifest
107 %defattr(-,root,root,-)
108 %{TZ_SYS_RO_SHARE}/license/%{name}
109 %{_libdir}/libtbm.so.*
110 %{_unitdir}/tbm-drm-auth.path
111 %{_unitdir}/tbm-drm-auth.service
112 %{_unitdir_user}/tbm-drm-auth-user.path
113 %{_unitdir_user}/tbm-drm-auth-user.service
114 %if %{with utest}
115 %{_bindir}/ut
116 %endif
117
118 %files devel
119 %manifest %{name}.manifest
120 %defattr(-,root,root,-)
121 %dir %{_includedir}
122 %{_includedir}/tbm_bufmgr.h
123 %{_includedir}/tbm_surface.h
124 %{_includedir}/tbm_surface_internal.h
125 %{_includedir}/tbm_surface_queue.h
126 %{_includedir}/tbm_bufmgr_backend.h
127 %{_includedir}/tbm_type.h
128 %{_includedir}/tbm_drm_helper.h
129 %{_includedir}/tbm_sync.h
130 %{_libdir}/libtbm.so
131 %{_libdir}/pkgconfig/libtbm.pc