2 Summary: Cynara service with client libraries
5 Group: Security/Access Control
7 Source0: %{name}-%{version}.tar.gz
8 Source1001: cynara.manifest
9 Source1002: libcynara-client.manifest
10 Source1003: libcynara-admin.manifest
11 Requires: default-ac-domains
14 BuildRequires: pkgconfig(libsystemd-daemon)
15 BuildRequires: pkgconfig(libsystemd-journal)
18 %global user_name %{name}
19 %global group_name %{name}
21 %global state_path %{_localstatedir}/%{name}/
23 %global build_type %{?build_type:%build_type}%{!?build_type:RELEASE}
25 %if %{?build_type} == "DEBUG"
27 BuildRequires: pkgconfig(libunwind)
32 service and client libraries (libcynara-client, libcynara-admin)
34 #######################################################
35 %package -n libcynara-client
36 Summary: Cynara - client library
37 Requires: cynara = %{version}-%{release}
38 Requires(post): /sbin/ldconfig
39 Requires(postun): /sbin/ldconfig
41 %description -n libcynara-client
42 client library for checking policies
44 %package -n libcynara-client-devel
45 Summary: Cynara - client library (devel)
46 Requires: libcynara-client = %{version}-%{release}
48 %description -n libcynara-client-devel
49 client library (devel) for checking policies
51 #######################################################
52 %package -n libcynara-admin
53 Summary: Cynara - admin client library
54 Requires: cynara = %{version}-%{release}
55 Requires(post): /sbin/ldconfig
56 Requires(postun): /sbin/ldconfig
58 %description -n libcynara-admin
59 admin client library for setting, listing and removing policies
61 %package -n libcynara-admin-devel
62 Summary: Cynara - admin client library (devel)
63 Requires: libcynara-admin = %{version}-%{release}
65 %description -n libcynara-admin-devel
66 admin client library (devel) for setting, listing and removing policies
68 #######################################################
69 %package -n cynara-devel
70 Summary: Cynara service (devel)
71 Requires: cynara = %{version}-%{release}
73 %description -n cynara-devel
74 service (devel version)
83 %if 0%{?sec_build_binary_debug_enable}
84 export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
85 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
86 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
89 export CXXFLAGS="$CXXFLAGS -DCYNARA_STATE_PATH=\\\"%{state_path}\\\""
90 export LDFLAGS+="-Wl,--rpath=%{_libdir}"
92 %cmake . -DVERSION=%{version} \
93 -DCMAKE_BUILD_TYPE=%{?build_type} \
94 -DCMAKE_VERBOSE_MAKEFILE=ON
102 mkdir -p %{buildroot}/usr/lib/systemd/system/sockets.target.wants
103 mkdir -p %{buildroot}/%{state_path}
104 ln -s ../cynara.socket %{buildroot}/usr/lib/systemd/system/sockets.target.wants/cynara.socket
105 ln -s ../cynara-admin.socket %{buildroot}/usr/lib/systemd/system/sockets.target.wants/cynara-admin.socket
108 ### Add file capabilities if needed
109 ### setcap/getcap binary are useful. To use them you must install libcap and libcap-tools packages
110 ### In such case uncomment Requires with those packages
112 systemctl daemon-reload
114 id -g %{group_name} > /dev/null 2>&1
115 if [ $? -eq 1 ]; then
116 groupadd %{group_name} -r > /dev/null 2>&1
119 id -u %{user_name} > /dev/null 2>&1
120 if [ $? -eq 1 ]; then
121 useradd -m %{user_name} -r > /dev/null 2>&1
125 systemctl enable %{name}.service
128 chsmack -a System %{state_path}
130 systemctl restart %{name}.service
137 systemctl stop cynara.service
142 userdel -r %{user_name} > /dev/null 2>&1
143 groupdel %{user_name} > /dev/null 2>&1
144 systemctl daemon-reload
149 %post -n libcynara-client -p /sbin/ldconfig
151 %postun -n libcynara-client -p /sbin/ldconfig
153 %post -n libcynara-admin -p /sbin/ldconfig
155 %postun -n libcynara-admin -p /sbin/ldconfig
157 %post -n libcynara-client-devel -p /sbin/ldconfig
159 %postun -n libcynara-client-devel -p /sbin/ldconfig
161 %post -n libcynara-admin-devel -p /sbin/ldconfig
163 %postun -n libcynara-admin-devel -p /sbin/ldconfig
166 %manifest cynara.manifest
168 %attr(755,root,root) /usr/bin/cynara
169 %{_libdir}/libcynara-commons.so*
170 %attr(-,root,root) /usr/lib/systemd/system/cynara.service
171 %attr(-,root,root) /usr/lib/systemd/system/cynara.target
172 %attr(-,root,root) /usr/lib/systemd/system/sockets.target.wants/cynara.socket
173 %attr(-,root,root) /usr/lib/systemd/system/cynara.socket
174 %attr(-,root,root) /usr/lib/systemd/system/sockets.target.wants/cynara-admin.socket
175 %attr(-,root,root) /usr/lib/systemd/system/cynara-admin.socket
176 %dir %attr(700,cynara,cynara) %{state_path}
178 %files -n libcynara-client
179 %manifest libcynara-client.manifest
181 %defattr(-,root,root,-)
182 %{_libdir}/libcynara-client.so.*
184 %files -n libcynara-client-devel
185 %defattr(-,root,root,-)
186 %{_includedir}/cynara/cynara-client.h
187 %{_libdir}/pkgconfig/cynara-client.pc
188 %{_libdir}/libcynara-client.so
190 %files -n libcynara-admin
191 %manifest libcynara-admin.manifest
193 %defattr(-,root,root,-)
194 %{_libdir}/libcynara-admin.so.*
196 %files -n libcynara-admin-devel
197 %defattr(-,root,root,-)
198 %{_includedir}/cynara/cynara-admin.h
199 %{_libdir}/libcynara-admin.so
200 %{_libdir}/pkgconfig/cynara-admin.pc