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 Source1004: cynara-tests.manifest
12 Requires: default-ac-domains
15 BuildRequires: pkgconfig(libsystemd-daemon)
16 BuildRequires: pkgconfig(libsystemd-journal)
19 %global user_name %{name}
20 %global group_name %{name}
22 %global state_path %{_localstatedir}/%{name}/
24 %global build_type %{?build_type:%build_type}%{!?build_type:RELEASE}
26 %if %{?build_type} == "DEBUG"
28 BuildRequires: pkgconfig(libunwind)
33 service, client libraries (libcynara-client, libcynara-admin)
34 and tests (cynara-tests)
36 #######################################################
37 %package -n libcynara-client
38 Summary: Cynara - client library
39 Requires: cynara = %{version}-%{release}
40 Requires(post): /sbin/ldconfig
41 Requires(postun): /sbin/ldconfig
43 %description -n libcynara-client
44 client library for checking policies
46 %package -n libcynara-client-devel
47 Summary: Cynara - client library (devel)
48 Requires: libcynara-client = %{version}-%{release}
50 %description -n libcynara-client-devel
51 client library (devel) for checking policies
53 #######################################################
54 %package -n libcynara-admin
55 Summary: Cynara - admin client library
56 Requires: cynara = %{version}-%{release}
57 Requires(post): /sbin/ldconfig
58 Requires(postun): /sbin/ldconfig
60 %description -n libcynara-admin
61 admin client library for setting, listing and removing policies
63 %package -n libcynara-admin-devel
64 Summary: Cynara - admin client library (devel)
65 Requires: libcynara-admin = %{version}-%{release}
67 %description -n libcynara-admin-devel
68 admin client library (devel) for setting, listing and removing policies
70 #######################################################
71 %package -n cynara-tests
72 Summary: Cynara - cynara test binaries
73 BuildRequires: pkgconfig(gmock)
75 %description -n cynara-tests
78 #######################################################
80 %package -n cynara-devel
81 Summary: Cynara service (devel)
82 Requires: cynara = %{version}-%{release}
84 %description -n cynara-devel
85 service (devel version)
95 %if 0%{?sec_build_binary_debug_enable}
96 export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
97 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
98 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
101 export CXXFLAGS="$CXXFLAGS -DCYNARA_STATE_PATH=\\\"%{state_path}\\\""
102 export LDFLAGS+="-Wl,--rpath=%{_libdir}"
104 %cmake . -DVERSION=%{version} \
105 -DCMAKE_BUILD_TYPE=%{?build_type} \
106 -DCMAKE_VERBOSE_MAKEFILE=ON
107 make %{?jobs:-j%jobs}
114 mkdir -p %{buildroot}/usr/lib/systemd/system/sockets.target.wants
115 mkdir -p %{buildroot}/%{state_path}
116 ln -s ../cynara.socket %{buildroot}/usr/lib/systemd/system/sockets.target.wants/cynara.socket
117 ln -s ../cynara-admin.socket %{buildroot}/usr/lib/systemd/system/sockets.target.wants/cynara-admin.socket
120 id -g %{group_name} > /dev/null 2>&1
121 if [ $? -eq 1 ]; then
122 groupadd %{group_name} -r > /dev/null 2>&1
125 id -u %{user_name} > /dev/null 2>&1
126 if [ $? -eq 1 ]; then
127 useradd -m %{user_name} -r > /dev/null 2>&1
131 ### Add file capabilities if needed
132 ### setcap/getcap binary are useful. To use them you must install libcap and libcap-tools packages
133 ### In such case uncomment Requires with those packages
135 systemctl daemon-reload
138 systemctl enable %{name}.service
141 chsmack -a System %{state_path}
143 systemctl restart %{name}.service
150 systemctl stop cynara.service
155 userdel -r %{user_name} > /dev/null 2>&1
156 groupdel %{user_name} > /dev/null 2>&1
157 systemctl daemon-reload
162 %post -n libcynara-client -p /sbin/ldconfig
164 %postun -n libcynara-client -p /sbin/ldconfig
166 %post -n libcynara-admin -p /sbin/ldconfig
168 %postun -n libcynara-admin -p /sbin/ldconfig
170 %post -n libcynara-client-devel -p /sbin/ldconfig
172 %postun -n libcynara-client-devel -p /sbin/ldconfig
174 %post -n libcynara-admin-devel -p /sbin/ldconfig
176 %postun -n libcynara-admin-devel -p /sbin/ldconfig
179 %manifest cynara.manifest
181 %attr(755,root,root) /usr/bin/cynara
182 %{_libdir}/libcynara-commons.so*
183 %attr(-,root,root) /usr/lib/systemd/system/cynara.service
184 %attr(-,root,root) /usr/lib/systemd/system/cynara.target
185 %attr(-,root,root) /usr/lib/systemd/system/sockets.target.wants/cynara.socket
186 %attr(-,root,root) /usr/lib/systemd/system/cynara.socket
187 %attr(-,root,root) /usr/lib/systemd/system/sockets.target.wants/cynara-admin.socket
188 %attr(-,root,root) /usr/lib/systemd/system/cynara-admin.socket
189 %dir %attr(700,cynara,cynara) %{state_path}
191 %files -n libcynara-client
192 %manifest libcynara-client.manifest
194 %defattr(-,root,root,-)
195 %{_libdir}/libcynara-client.so.*
196 %{_libdir}/libcynara-client-commons.so.*
198 %files -n libcynara-client-devel
199 %defattr(-,root,root,-)
200 %{_includedir}/cynara/cynara-client.h
201 %{_includedir}/cynara/cynara-client-error.h
202 %{_libdir}/pkgconfig/cynara-client.pc
203 %{_libdir}/libcynara-client.so
204 %{_libdir}/libcynara-client-commons.so
206 %files -n libcynara-admin
207 %manifest libcynara-admin.manifest
209 %defattr(-,root,root,-)
210 %{_libdir}/libcynara-admin.so.*
212 %files -n libcynara-admin-devel
213 %defattr(-,root,root,-)
214 %{_includedir}/cynara/cynara-admin.h
215 %{_includedir}/cynara/cynara-admin-error.h
216 %{_libdir}/libcynara-admin.so
217 %{_libdir}/pkgconfig/cynara-admin.pc
219 %files -n cynara-tests
220 %manifest cynara-tests.manifest
221 %attr(755,root,root) /usr/bin/cynara-tests