11b15e8364c9968ff1cfa57e7efe9e66cde373ad
[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.11
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 %__mkdir_p %{_unitdir_user}/basic.target.wants
88 ln -sf ../tbm-drm-auth-user.path %{_unitdir_user}/basic.target.wants/
89
90 %post -p /sbin/ldconfig
91 %postun -p /sbin/ldconfig
92 rm -f %{_unitdir}/graphical.target.wants/tbm-drm-auth.path
93
94 rm -f %{_unitdir_user}/basic.target.wants/tbm-drm-auth-user.path
95
96 %files
97 %manifest %{name}.manifest
98 %defattr(-,root,root,-)
99 %{TZ_SYS_RO_SHARE}/license/%{name}
100 %{_libdir}/libtbm.so.*
101 %{_unitdir}/tbm-drm-auth.path
102 %{_unitdir}/tbm-drm-auth.service
103 %{_unitdir_user}/tbm-drm-auth-user.path
104 %{_unitdir_user}/tbm-drm-auth-user.service
105 %if %{with utest}
106 %{_bindir}/ut
107 %endif
108
109 %files devel
110 %manifest %{name}.manifest
111 %defattr(-,root,root,-)
112 %dir %{_includedir}
113 %{_includedir}/tbm_bufmgr.h
114 %{_includedir}/tbm_surface.h
115 %{_includedir}/tbm_surface_internal.h
116 %{_includedir}/tbm_surface_queue.h
117 %{_includedir}/tbm_bufmgr_backend.h
118 %{_includedir}/tbm_type.h
119 %{_includedir}/tbm_drm_helper.h
120 %{_includedir}/tbm_sync.h
121 %{_libdir}/libtbm.so
122 %{_libdir}/pkgconfig/libtbm.pc