Merge "remove smack_setlabel function usage for security reason" into tizen_3.0
[sdk/target/sdbd.git] / packaging / sdbd.spec
1 %bcond_with emulator
2
3 Name:       sdbd
4 Summary:    SDB daemon
5 Version:    3.0.13
6 Release:    0
7 License:    Apache-2.0
8 Summary:    SDB daemon
9 Group:      System/Utilities
10 Source0:    %{name}-%{version}.tar.gz
11 Source1001:    sdbd_device.service
12 Source1002:    sdbd_emulator.service
13 Source1003:    %{name}.manifest
14 Source1004:    sdbd_tcp.service
15 Source1005:    sdbd_device_tv.service
16 Source1006:    sdbd_emulator_tv.service
17
18 BuildRequires: capi-system-info-devel >= 0.2.0
19 BuildRequires: cmake >= 2.8.3
20 BuildRequires:  pkgconfig(libtzplatform-config)
21 #BuildRequires: sec-product-features
22 BuildRequires: pkgconfig(libsmack)
23 BuildRequires: pkgconfig(capi-system-info)
24 BuildRequires: pkgconfig(vconf)
25 BuildRequires: pkgconfig(glib-2.0)
26 BuildRequires: pkgconfig(dbus-1)
27 BuildRequires: pkgconfig(dbus-glib-1)
28 BuildRequires: pkgconfig(dlog)
29 Requires: dbus
30
31 %description
32 Description: SDB daemon.
33
34 %package -n sdbd-devel
35 Summary:        SDBD plugin API
36 Group:          Development/Libraries
37
38 %description -n sdbd-devel
39 SDBD plugin API library
40
41 %prep
42 %setup -q
43 cp %{SOURCE1003} .
44
45 %build
46 %if "%{?tizen_profile_name}" == "wearable"
47 %define wearable_profile on
48 %else
49 %define wearable_profile off
50 %endif
51 %if %{with emulator}
52 %define target_arch x86
53 %else
54 %define target_arch arm
55 %endif
56 cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \
57         -DWEARABLE_PROFILE=%{wearable_profile} \
58         -DTARGET_ARCH=%{target_arch}
59
60 make %{?jobs:-j%jobs}
61
62 %install
63 mkdir -p %{buildroot}/usr/share/license
64 cp LICENSE %{buildroot}/usr/share/license/%{name}
65
66 %make_install
67 mkdir -p %{buildroot}%{_unitdir}
68
69 %if %{with emulator}
70 %if "%{profile}" == "tv"
71 install -m 0644 %SOURCE1006 %{buildroot}%{_unitdir}/sdbd.service
72 %else
73 install -m 0644 %SOURCE1002 %{buildroot}%{_unitdir}/sdbd.service
74 %endif
75 mkdir -p %{buildroot}/%{_unitdir}/emulator_preinit.target.wants
76 ln -s %{_unitdir}/sdbd.service %{buildroot}/%{_unitdir}/emulator_preinit.target.wants/
77
78 %else
79 %if "%{profile}" == "tv"
80 install -m 0644 %SOURCE1005 %{buildroot}%{_unitdir}/sdbd.service
81 %else
82 install -m 0644 %SOURCE1001 %{buildroot}%{_unitdir}/sdbd.service
83 %endif
84 install -m 0644 %SOURCE1004 %{buildroot}%{_unitdir}/sdbd_tcp.service
85 mkdir -p %{buildroot}/%{_unitdir}/multi-user.target.wants
86 ln -s %{_unitdir}/sdbd.service %{buildroot}/%{_unitdir}/multi-user.target.wants/
87 %endif
88
89 mkdir -p %{buildroot}%{_prefix}/sbin
90 install -m 755 script/sdk_launch %{buildroot}%{_prefix}/sbin/
91
92 mkdir -p %{buildroot}%{TZ_SYS_BIN}
93 install -m 755 script/profile_command %{buildroot}%{TZ_SYS_BIN}/
94
95 mkdir -p %{buildroot}%{_includedir}/sdb/
96 install -m 0644 src/sdbd_plugin.h %{buildroot}%{_includedir}/sdb/
97
98 mkdir -p %{buildroot}%{_libdir}/pkgconfig/
99 install -m 0644 packaging/sdbd.pc %{buildroot}%{_libdir}/pkgconfig/
100
101 %post
102 . %{_sysconfdir}/tizen-platform.conf
103 if ! getent passwd "${TZ_SDK_USER_NAME}" > /dev/null; then
104   rm -rf "${TZ_SDK_HOME}"
105   useradd -u 5100 -s /bin/false -m -d "${TZ_SDK_HOME}" "${TZ_SDK_USER_NAME}"
106   getent group developer > /dev/null || groupadd -g 5100 developer
107   for x in app_logging crash developer; do
108     usermod -A app_logging "${TZ_SDK_USER_NAME}"
109   done
110 fi
111
112 cp -f /bin/sh /bin/sh-user
113 chsmack -a "_" /bin/sh-user
114 chsmack -e "User::Shell" /bin/sh-user
115 mkdir -p %{TZ_SDK_HOME}/share/sdbdlog
116 chown owner:users %{TZ_SDK_HOME}/share/sdbdlog
117
118 %files
119 %manifest sdbd.manifest
120 %license LICENSE
121 %defattr(-,root,root,-)
122 %{_prefix}/sbin/sdbd
123 %{_prefix}/sbin/sdk_launch
124 %attr(0755, root, root) %{_sysconfdir}/init.d/sdbd
125 %{_unitdir}/sdbd.service
126 %if %{with emulator}
127 %{_unitdir}/emulator_preinit.target.wants/sdbd.service
128 %else
129 %{_unitdir}/sdbd_tcp.service
130 %{_unitdir}/multi-user.target.wants/sdbd.service
131 %endif
132 /usr/share/license/%{name}
133 %{TZ_SYS_BIN}/profile_command
134
135 %files -n sdbd-devel
136 %{_includedir}/sdb/sdbd_plugin.h
137 %{_libdir}/pkgconfig/sdbd.pc
138
139 %changelog