Add Echo service
[platform/core/security/key-manager.git] / packaging / key-manager.spec
1 Name:       key-manager
2 Summary:    Central Key Manager and utilities
3 Version:    0.0.1
4 Release:    1
5 Group:      System/Security
6 License:    Apache License, Version 2.0
7 Source0:    %{name}-%{version}.tar.gz
8 BuildRequires: cmake
9 BuildRequires: zip
10 BuildRequires: pkgconfig(dlog)
11 BuildRequires: pkgconfig(openssl)
12 BuildRequires: libattr-devel
13 BuildRequires: pkgconfig(libsmack)
14 BuildRequires: pkgconfig(libsystemd-daemon)
15 %{?systemd_requires}
16
17 %description
18 Central Key Manager and utilities
19
20 %package -n libkey-manager-client
21 Summary:    Central Key Manager (client)
22 Group:      Development/Libraries
23 Requires:   key-manager = %{version}-%{release}
24 Requires(post): /sbin/ldconfig
25 Requires(postun): /sbin/ldconfig
26
27 %description -n libkey-manager-client
28 Central Key Manager package (client)
29
30 %package -n libkey-manager-client-devel
31 Summary:    Central Key Manager (client-devel)
32 Group:      Development/Libraries
33 Requires:   libkey-manager-client = %{version}-%{release}
34
35 %description -n libkey-manager-client-devel
36 Central Key Manager package (client-devel)
37
38 %package -n key-manager-devel
39 Summary:    Central Key Manager (Development)
40 Group:      Development/Libraries
41 Requires:   key-manager = %{version}-%{release}
42
43 %description -n key-manager-devel
44 Central Key Manager (Development)
45
46
47 %prep
48 %setup -q
49
50 %build
51 %if 0%{?sec_build_binary_debug_enable}
52     export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
53     export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
54     export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
55 %endif
56
57 export LDFLAGS+="-Wl,--rpath=%{_libdir}"
58
59 %cmake . -DVERSION=%{version} \
60         -DCMAKE_BUILD_TYPE=%{?build_type:%build_type}%{!?build_type:RELEASE} \
61         -DCMAKE_VERBOSE_MAKEFILE=ON
62 make %{?jobs:-j%jobs}
63
64 %install
65 rm -rf %{buildroot}
66 mkdir -p %{buildroot}/usr/share/license
67 cp LICENSE %{buildroot}/usr/share/license/%{name}
68 cp LICENSE %{buildroot}/usr/share/license/libkey-manager-client
69 mkdir -p %{buildroot}/etc/security/
70 %make_install
71
72 mkdir -p %{buildroot}/usr/lib/systemd/system/multi-user.target.wants
73 mkdir -p %{buildroot}/usr/lib/systemd/system/sockets.target.wants
74 ln -s ../key-manager.service %{buildroot}/usr/lib/systemd/system/multi-user.target.wants/key-manager.service
75 ln -s ../key-manager-echo.socket %{buildroot}/usr/lib/systemd/system/sockets.target.wants/key-manager-echo.socket
76
77 %clean
78 rm -rf %{buildroot}
79
80 %post
81 systemctl daemon-reload
82 if [ $1 = 1 ]; then
83     # installation
84     systemctl start key-manager.service
85 fi
86
87 if [ $1 = 2 ]; then
88     # update
89     systemctl restart key-manager.service
90 fi
91
92
93 %preun
94 if [ $1 = 0 ]; then
95     # unistall
96     systemctl stop key-manager.service
97 fi
98
99 %postun
100 if [ $1 = 0 ]; then
101     # unistall
102     systemctl daemon-reload
103 fi
104
105 %post -n libkey-manager-client -p /sbin/ldconfig
106
107 %postun -n libkey-manager-client -p /sbin/ldconfig
108
109 %files -n key-manager
110 %manifest %{_datadir}/key-manager.manifest
111 %attr(755,root,root) /usr/bin/key-manager
112 %{_libdir}/libkey-manager-commons.so.*
113 %attr(-,root,root) /usr/lib/systemd/system/multi-user.target.wants/key-manager.service
114 %attr(-,root,root) /usr/lib/systemd/system/key-manager.service
115 %attr(-,root,root) /usr/lib/systemd/system/key-manager.target
116 %attr(-,root,root) /usr/lib/systemd/system/sockets.target.wants/key-manager-echo.socket 
117 %attr(-,root,root) /usr/lib/systemd/system/key-manager-echo.socket 
118 %{_datadir}/license/%{name}
119
120 %files -n libkey-manager-client
121 %manifest %{_datadir}/libkey-manager-client.manifest
122 %defattr(-,root,root,-)
123 %{_libdir}/libkey-manager-client.so.*
124 %{_datadir}/license/libkey-manager-client
125
126 %files -n libkey-manager-client-devel
127 %defattr(-,root,root,-)
128 %{_libdir}/libkey-manager-client.so
129 %{_libdir}/libkey-manager-commons.so
130 /usr/include/key-manager/key-manager.h
131 %{_libdir}/pkgconfig/*.pc