b3c2cbcf8b71162a9efe25df2fe8cbd5357b08a7
[platform/core/security/libwebappenc.git] / packaging / libwebappenc.spec
1 Name:    libwebappenc
2 Summary: Web application encryption service
3 Version: 0.1.0
4 Release: 1
5 Group:   System/Libraries
6 License: Apache-2.0
7 Source0: %{name}-%{version}.tar.gz
8 Source1001: %{name}.manifest
9
10 Requires(post):   /sbin/ldconfig
11 Requires(postun): /sbin/ldconfig
12
13 BuildRequires: cmake
14 BuildRequires: pkgconfig(dlog)
15 BuildRequires: pkgconfig(openssl)
16 BuildRequires: pkgconfig(key-manager)
17 BuildRequires: pkgconfig(libtzplatform-config)
18 Requires: openssl
19 Requires: pkgconfig(libtzplatform-config)
20
21 %description
22 Web application encryption and decryption service
23
24 %package devel
25 Summary:    Web application encryption service (development files)
26 Group:      Development/Libraries
27 Requires:   %{name} = %{version}-%{release}
28
29 %description devel
30 Web application encryption and decryption service (development files)
31
32 %package test
33 Summary:    Web application encryption service (test)
34 Group:      Development
35 Requires:   %{name} = %{version}-%{release}
36
37 %description test
38 Web application encryption and decryption service (test)
39
40
41
42 %prep
43 %setup -q
44 cp %{SOURCE1001} .
45
46 %build
47 %{!?build_type:%define build_type "Release"}
48 %cmake . -DPREFIX=%{_prefix} \
49          -DEXEC_PREFIX=%{_exec_prefix} \
50          -DINCLUDEDIR=%{_includedir} \
51          -DLIBDIR=%{_libdir} \
52          -DBINDIR=%TZ_SYS_BIN \
53          -DSYSTEMD_UNIT_DIR=%{_unitdir} \
54          -DCMAKE_BUILD_TYPE=%{build_type} \
55          -DTZ_SYS_BIN=%TZ_SYS_BIN \
56          -DTZ_SYS_SHARE=%TZ_SYS_SHARE
57
58 make %{?jobs:-j%jobs}
59
60
61 %install
62 rm -rf %{buildroot}
63 mkdir -p %{buildroot}%{TZ_SYS_SHARE}/license
64 cp LICENSE.Apache-2.0 %{buildroot}%{TZ_SYS_SHARE}/license/%{name}
65 %make_install
66 mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants
67 ln -s ../webappenc-initializer.service %{buildroot}%{_unitdir}/multi-user.target.wants/webappenc-initializer.service
68
69
70 %clean
71 rm -rf %{buildroot}
72
73 %post
74 /sbin/ldconfig
75 systemctl daemon-reload
76 if [ $1 = 1 ]; then
77     # installation
78     systemctl start webappenc-initializer.service
79 fi
80
81 if [ $1 = 2 ]; then
82     # update
83     systemctl restart webappenc-initializer.service
84 fi
85
86 %postun
87 /sbin/ldconfig
88 if [ $1 = 0 ]; then
89     # uninstall
90     systemctl daemon-reload
91 fi
92
93
94 %files
95 %defattr(-,root,root,-)
96 %manifest %{name}.manifest
97 %{TZ_SYS_SHARE}/license/%{name}
98 %{_libdir}/%{name}.so.*
99 %{_unitdir}/webappenc-initializer.service
100 %{_unitdir}/multi-user.target.wants/webappenc-initializer.service
101 %{TZ_SYS_BIN}/wae_initializer
102 %{TZ_SYS_SHARE}/wae/app_dek/WAE_APPDEK_KEK_PrivateKey.pem
103 %{TZ_SYS_SHARE}/wae/app_dek/WAE_APPDEK_KEK_PublicKey.pem
104
105 %files devel
106 %defattr(-,root,root,-)
107 %{_includedir}/*
108 %{_libdir}/pkgconfig/%{name}.pc
109 %{_libdir}/%{name}.so
110
111 %files test
112 %defattr(-,root,root,-)
113 %{TZ_SYS_BIN}/wae_tests
114
115