1. Enable privlilege check routine
[platform/core/connectivity/zigbee-manager.git] / packaging / zigbee-manager.spec
index 307bdc8..b6e9346 100644 (file)
@@ -1,15 +1,18 @@
 %define major 0
 %define minor 1
-%define patchlevel 0
+%define patchlevel 2
+%define CHECK_ZIGBEE_PRIVILEGE True
 
 Name:           zigbee-manager
 Version:        %{major}.%{minor}.%{patchlevel}
 Release:        1
 License:        Apache-2.0
-Summary:        ZigBee Daemon
+Summary:        ZigBee Manager
 Group:          System/Network
 Source0:        %{name}-%{version}.tar.gz
-Source1:        org.tizen.zigbee.service
+Source1:        zigbee-manager.service
+Source2:        org.tizen.zigbee.service
+Source3:        zigbee.conf
 BuildRequires:  cmake
 BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(gio-2.0)
@@ -17,8 +20,16 @@ BuildRequires:  pkgconfig(gio-unix-2.0)
 BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  pkgconfig(vconf)
 
+%if 0%{?gtests:1}
+BuildRequires:  pkgconfig(gmock)
+%endif
+
+# if image creater does not know 'network_fw'
+Requires: security-config
+Requires: awk
+
 %description
-Description: ZigBee Daemon
+Description: ZigBee Manager
 
 %package -n zigbee-lib
 Summary:         ZigBee library
@@ -42,40 +53,72 @@ ZigBee library (devel)
 
 chmod 644 %{SOURCE1}
 cp -a %{SOURCE1} .
+%if %{CHECK_ZIGBEE_PRIVILEGE} == "True"
+chmod 644 %{SOURCE2}
+cp -a %{SOURCE2} .
+%endif
 
 %build
-cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DVERSION=%{version} \
+%if 0%{?gcov:1}
+export LDFLAGS+=" -lgcov"
+%endif
+
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \
+       -DVERSION=%{version} \
+       -DLIB_INSTALL_DIR=%{_libdir} \
+       -DUNIT_INSTALL_DIR=%{_unitdir} \
+       -DBUILD_GTESTS=%{?gtests:1}%{!?gtests:0} \
+       -DBUILD_GCOV=%{?gcov:1}%{!?gcov:0}
 
 make %{?_smp_mflags}
 
 %install
-
 %make_install
 
 # Do not execute daemon on boot time
-#mkdir -p %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants
-#ln -s %{_libdir}/systemd/system/zigbee-daemon.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/zigbee-daemon.service
-
+#mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants
+#ln -s %{_unitdir}/zigbee-manager.service %{buildroot}%{_unitdir}/multi-user.target.wants/zigbee-manager.service
+
+mkdir -p %{buildroot}%{_libdir}/systemd/system
+cp %{SOURCE1} %{buildroot}%{_libdir}/systemd/system/zigbee-manager.service
+%if "%{?_lib}" == "lib64"
+mkdir -p %{buildroot}%{_unitdir}
+cp %{SOURCE1} %{buildroot}%{_unitdir}/zigbee-manager.service
+%endif
 mkdir -p %{buildroot}%{_datadir}/dbus-1/system-services/
-cp org.tizen.zigbee.service %{buildroot}%{_datadir}/dbus-1/system-services/org.tizen.zigbee.service
+cp %{SOURCE2} %{buildroot}%{_datadir}/dbus-1/system-services/org.tizen.zigbee.service
+
+%if %{CHECK_ZIGBEE_PRIVILEGE} == "True"
+mkdir -p %{buildroot}%{_sysconfdir}/dbus-1/system.d
+cp %{SOURCE3} %{buildroot}%{_sysconfdir}/dbus-1/system.d/zigbee.conf
+%endif
 
 %post -p /sbin/ldconfig
 
 %postun -p /sbin/ldconfig
 
 %files
-%manifest zigbee-daemon.manifest
-%defattr(644,system,system,-)
-%attr(755,system,system) %{_bindir}/zigbee-daemon
-%{_libdir}/systemd/system/zigbee-daemon.service
-#%{_libdir}/systemd/system/multi-user.target.wants/zigbee-daemon.service
-%{_datadir}/license/zigbee-daemon
-%attr(644,root,root) %{_datadir}/dbus-1/system-services/*
+%manifest zigbee-manager.manifest
+%defattr(-,root,root,-)
+%attr(755,network_fw,network_fw) %{_bindir}/zigbeed
+%{_libdir}/systemd/system/zigbee-manager.service
+%if "%{?_lib}" == "lib64"
+%{_unitdir}/zigbee-manager.service
+%endif
+#%{_unitdir}/multi-user.target.wants/zigbee-manager.service
+%{_datadir}/dbus-1/system-services/org.tizen.zigbee.service
+%if %{CHECK_ZIGBEE_PRIVILEGE} == "True"
+%attr(644,root,root) %{_sysconfdir}/dbus-1/system.d/zigbee.conf
+%endif
+%license LICENSE
+%if 0%{?gtests:1}
+%{_bindir}/gtest*
+%endif
 
 %files -n zigbee-lib
 %defattr(644,system,system,-)
 %{_libdir}/libzigbee-lib.so*
-%{_datadir}/license/zigbee-lib
+%license LICENSE
 
 %files -n zigbee-lib-devel
 %defattr(644,system,system,-)