Upgrade version to 2.1.1
[platform/core/security/trust-anchor.git] / packaging / trust-anchor.spec
1 Name: trust-anchor
2 Version: 2.1.1
3 Release: 0
4 License: Apache-2.0
5 Source0: file://%{name}-%{version}.tar.gz
6 Summary: Trust Anchor API
7 Group: Security/Certificate Management
8 BuildRequires: gcc
9 BuildRequires: cmake
10 BuildRequires: coreutils
11 BuildRequires: pkgconfig(klay)
12 BuildRequires: pkgconfig(openssl)
13 BuildRequires: pkgconfig(libtzplatform-config)
14 BuildRequires: ca-certificates
15 BuildRequires: ca-certificates-devel
16 Requires(post): /sbin/ldconfig
17 Requires(postun): /sbin/ldconfig
18
19 %global lib_name         tanchor
20 %global user_name        security_fw
21 %global group_name       security_fw
22 %global smack_label      System
23 %global pkg_smack_label  System::Shared
24
25 %global tanchor_base     %{TZ_SYS_DATA}/%{lib_name}
26 %global tanchor_pkg      %{tanchor_base}/pkg
27 %global tanchor_bundle   %{tanchor_base}/ca-bundle.pem
28 %global tanchor_sysca    %{tanchor_base}/.sysca
29 %global tanchor_pkgcerts %{tanchor_base}/.pkgcerts
30 %global tanchor_test     %{tanchor_base}/test
31 %global tanchor_example  %{tanchor_base}/example
32
33 %description
34 The package provides trust-anchor which the application can assign
35 SSL root certificates for its HTTPS communication.
36
37 %files
38 %manifest %{name}.manifest
39 %license LICENSE
40 %{_libdir}/lib%{lib_name}.so.2
41 %{_libdir}/lib%{lib_name}.so.%{version}
42 %dir %attr(-, %{user_name}, %{group_name}) %{tanchor_base}
43 %dir %attr(-, %{user_name}, %{group_name}) %{tanchor_pkg}
44 %attr(-, %{user_name}, %{group_name}) %{tanchor_bundle}
45 %attr(-, %{user_name}, %{group_name}) %{tanchor_pkgcerts}
46 %attr(444 %{user_name}, %{group_name}) %{tanchor_sysca}
47
48 %prep
49 %setup -q
50
51 %build
52 %{!?build_type:%define build_type "RELEASE"}
53
54 %if %{build_type} == "DEBUG" || %{build_type} == "PROFILING" || %{build_type} == "CCOV"
55         CFLAGS="$CFLAGS -Wp,-U_FORTIFY_SOURCE"
56         CXXFLAGS="$CXXFLAGS -Wp,-U_FORTIFY_SOURCE"
57 %endif
58
59 %cmake . -DCMAKE_BUILD_TYPE=%{build_type} \
60                  -DLIB_NAME=%{lib_name} \
61                  -DLIB_VERSION=%{version} \
62                  -DUSER_NAME=%{user_name} \
63                  -DGROUP_NAME=%{group_name} \
64                  -DSMACK_LABEL=%{smack_label} \
65                  -DPKG_SMACK_LABEL=%{pkg_smack_label} \
66                  -DTANCHOR_BASE=%{tanchor_base} \
67                  -DTANCHOR_PKG=%{tanchor_pkg} \
68                  -DTANCHOR_BUNDLE=%{tanchor_bundle} \
69                  -DTANCHOR_SYSCA=%{tanchor_sysca} \
70                  -DTANCHOR_PKG_CERTS=%{tanchor_pkgcerts} \
71                  -DTANCHOR_TEST=%{tanchor_test} \
72                  -DTANCHOR_EXAMPLE=%{tanchor_example} \
73                  -DTZ_SYS_CA_CERTS=%{TZ_SYS_CA_CERTS} \
74                  -DTZ_SYS_CA_BUNDLE=%{TZ_SYS_CA_BUNDLE} \
75                  -DTZ_SYS_RO_CA_CERTS=%{TZ_SYS_RO_CA_CERTS} \
76                  -DTZ_SYS_RO_CA_BUNDLE=%{TZ_SYS_RO_CA_BUNDLE}
77
78 make %{?_smp_mflags}
79
80 %install
81 %make_install
82
83 mkdir -p %{buildroot}%{tanchor_pkg}
84
85 touch %{buildroot}%{tanchor_bundle}
86 touch %{buildroot}%{tanchor_sysca}
87 touch %{buildroot}%{tanchor_pkgcerts}
88
89 %post -p /sbin/ldconfig
90
91 %postun -p /sbin/ldconfig
92
93 ## Devel Package ###############################################################
94 %package devel
95 Summary: Trust Anchor API (development files)
96 Group:   Security/Development
97 Requires: %{name} = %{version}-%{release}
98
99 %description devel
100 The package provides Trust Anchor API development files.
101
102 %files devel
103 %{_includedir}/%{lib_name}/error.h
104 %{_includedir}/%{lib_name}/trust-anchor.h
105 %{_includedir}/%{lib_name}/trust-anchor.hxx
106 %{_libdir}/lib%{lib_name}.so
107 %{_libdir}/pkgconfig/%{lib_name}.pc
108
109 ## Test Package ##############################################################
110 %package -n trust-anchor-test
111 Summary: Trust Anchor API test
112 Group: Security/Development
113 BuildRequires: pkgconfig(libcurl)
114
115 %description -n trust-anchor-test
116 Testcases for trust anchor library
117
118 %files -n trust-anchor-test
119 %{_bindir}/%{lib_name}-test-installer
120 %{_bindir}/%{lib_name}-test-launcher
121 %{_bindir}/%{lib_name}-test-clauncher
122 %{_bindir}/%{lib_name}-test-internal
123 %{_bindir}/%{lib_name}-test-ssl
124 %{_bindir}/%{lib_name}-test-init.sh
125 %attr(-, %{user_name}, %{group_name}) %{tanchor_test}
126 %attr(-, %{user_name}, %{group_name}) %{tanchor_test}/certs
127
128 ## Example Package ############################################################
129 %package -n trust-anchor-example
130 Summary: Trust Anchor API example
131 Group: Security/Other
132
133 %description -n trust-anchor-example
134 Examples for trust anchor library
135
136 %files -n trust-anchor-example
137 %{tanchor_example}/installer.c
138 %{tanchor_example}/launcher.c