Add configuration for systemd.
[framework/security/security-server.git] / packaging / security-server.spec
1 #sbs-git:slp/pkgs/s/security-server security-server 0.0.37
2 Name:       security-server
3 Summary:    Security server and utilities
4 Version:    0.0.78
5 Release:    1
6 Group:      TO_BE/FILLED_IN
7 License:    Apache License, Version 2.0
8 URL:        N/A
9 Source0:    %{name}-%{version}.tar.gz
10 BuildRequires: cmake
11 BuildRequires: zip
12 BuildRequires: pkgconfig(dlog)
13 BuildRequires: pkgconfig(openssl)
14 BuildRequires: libattr-devel
15 BuildRequires: pkgconfig(libsmack)
16 Requires(preun):  systemd
17 Requires(post):   systemd
18 Requires(postun): systemd
19 BuildRequires: pkgconfig(libprivilege-control)
20 BuildRequires: pkgconfig(libsystemd-daemon)
21 %{?systemd_requires}
22
23 %description
24 Security server and utilities
25
26 %package -n libsecurity-server-client
27 Summary:    Security server (client)
28 Group:      Development/Libraries
29 Requires:   security-server = %{version}-%{release}
30 Requires(post): /sbin/ldconfig
31 Requires(postun): /sbin/ldconfig
32
33 %description -n libsecurity-server-client
34 Security server package (client)
35
36 %package -n libsecurity-server-client-devel
37 Summary:    Security server (client-devel)
38 Group:      Development/Libraries
39 Requires:   libsecurity-server-client = %{version}-%{release}
40
41 %description -n libsecurity-server-client-devel
42 Security server package (client-devel)
43
44 %package -n security-server-devel
45 Summary:    for web applications (Development)
46 Group:      Development/Libraries
47 Requires:   security-server = %{version}-%{release}
48
49 %description -n security-server-devel
50 Security daemon for web applications (Development)
51
52 %package -n security-server-certs
53 Summary:    Certificates for web applications.
54 Group:      Development/Libraries
55 Requires:   security-server
56
57 %description -n security-server-certs
58 Certificates for wrt.
59
60 %prep
61 %setup -q
62
63 %build
64 export LDFLAGS+="-Wl,--rpath=%{_libdir}"
65
66 %cmake . -DVERSION=%{version} \
67         -DCMAKE_BUILD_TYPE=%{?build_type:%build_type}%{!?build_type:RELEASE} \
68         -DCMAKE_VERBOSE_MAKEFILE=OFF
69 make %{?jobs:-j%jobs}
70
71 %install
72 rm -rf %{buildroot}
73 mkdir -p %{buildroot}/usr/share/license
74 cp LICENSE %{buildroot}/usr/share/license/%{name}
75 cp LICENSE %{buildroot}/usr/share/license/libsecurity-server-client
76 %make_install
77
78 mkdir -p %{buildroot}/usr/lib/systemd/system/multi-user.target.wants
79 mkdir -p %{buildroot}/usr/lib/systemd/system/sockets.target.wants
80 ln -s ../security-server.service %{buildroot}/usr/lib/systemd/system/multi-user.target.wants/security-server.service
81 ln -s ../security-server.socket %{buildroot}/usr/lib/systemd/system/sockets.target.wants/security-server.socket
82 ln -s ../security-server-data-share.socket %{buildroot}/usr/lib/systemd/system/sockets.target.wants/security-server-data-share.socket
83 ln -s ../security-server-get-gid.socket %{buildroot}/usr/lib/systemd/system/sockets.target.wants/security-server-get-gid.socket
84 ln -s ../security-server-privilege-by-pid.socket %{buildroot}/usr/lib/systemd/system/sockets.target.wants/security-server-privilege-by-pid.socket
85 ln -s ../security-server-exec-path.socket %{buildroot}/usr/lib/systemd/system/sockets.target.wants/security-server-exec-path.socket
86 ln -s ../security-server-get-object-name.socket %{buildroot}/usr/lib/systemd/system/sockets.target.wants/security-server-get-object-name.socket
87
88 %clean
89 rm -rf %{buildroot}
90
91 %post
92 systemctl daemon-reload
93 if [ "$1" = 1 ]; then
94     systemctl restart security-server.service
95 fi
96
97 %preun
98 if [ "$1" = 0 ]; then
99     systemctl stop security-server.service
100 fi
101
102 %postun
103 systemctl daemon-reload
104
105 %post -n libsecurity-server-client -p /sbin/ldconfig
106
107 %postun -n libsecurity-server-client -p /sbin/ldconfig
108
109 %files -n security-server
110 %manifest %{_datadir}/security-server.manifest
111 %attr(755,root,root) /usr/bin/security-server
112 %{_libdir}/libsecurity-server-commons.so.*
113 %attr(-,root,root) /usr/lib/systemd/system/multi-user.target.wants/security-server.service
114 %attr(-,root,root) /usr/lib/systemd/system/security-server.service
115 %attr(-,root,root) /usr/lib/systemd/system/sockets.target.wants/security-server.socket
116 %attr(-,root,root) /usr/lib/systemd/system/security-server.socket
117 %attr(-,root,root) /usr/lib/systemd/system/sockets.target.wants/security-server-data-share.socket
118 %attr(-,root,root) /usr/lib/systemd/system/security-server-data-share.socket
119 %attr(-,root,root) /usr/lib/systemd/system/sockets.target.wants/security-server-get-gid.socket
120 %attr(-,root,root) /usr/lib/systemd/system/security-server-get-gid.socket
121 %attr(-,root,root) /usr/lib/systemd/system/sockets.target.wants/security-server-privilege-by-pid.socket
122 %attr(-,root,root) /usr/lib/systemd/system/security-server-privilege-by-pid.socket
123 %attr(-,root,root) /usr/lib/systemd/system/sockets.target.wants/security-server-exec-path.socket
124 %attr(-,root,root) /usr/lib/systemd/system/security-server-exec-path.socket
125 %attr(-,root,root) /usr/lib/systemd/system/sockets.target.wants/security-server-get-object-name.socket
126 %attr(-,root,root) /usr/lib/systemd/system/security-server-get-object-name.socket
127
128 %{_datadir}/license/%{name}
129
130 %files -n libsecurity-server-client
131 %manifest %{_datadir}/libsecurity-server-client.manifest
132 %defattr(-,root,root,-)
133 %{_libdir}/libsecurity-server-client.so.*
134 %{_datadir}/license/libsecurity-server-client
135
136 %files -n libsecurity-server-client-devel
137 %defattr(-,root,root,-)
138 %{_libdir}/libsecurity-server-client.so
139 %{_libdir}/libsecurity-server-commons.so
140 /usr/include/security-server/security-server.h
141 %{_libdir}/pkgconfig/*.pc