add packaging
[platform/upstream/nss.git] / packaging / nss.spec
1 %global nss_softokn_fips_version 3.12.4
2
3 Name:           nss
4 Version:        3.13.6
5 Release:        0
6 License:        MPL-1.1 or GPL-2.0+ or LGPL-2.1+
7 Summary:        Network Security Services
8 Url:            http://www.mozilla.org/projects/security/pki/nss/
9 Group:          System/Libraries
10 # cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co -r <RTM_TAG> NSS
11 Source:         nss-%{version}.tar.bz2
12 Source1:        nss.pc.in
13 Source3:        nss-config.in
14 Source4:        %{name}-rpmlintrc
15 Source5:        baselibs.conf
16 Source6:        setup-nsssysinit.sh
17 Source7:        cert9.db
18 Source8:        key4.db
19 Source9:        pkcs11.txt
20 Patch1:         nss-opt.patch
21 Patch2:         system-nspr.patch
22 Patch3:         char.patch
23 Patch4:         nss-no-rpath.patch
24 Patch5:         renegotiate-transitional.patch
25 Patch6:         malloc.patch
26 BuildRequires:  gcc-c++
27 BuildRequires:  nspr-devel
28 BuildRequires:  pkg-config
29 BuildRequires:  sqlite3-devel
30 BuildRequires:  zlib-devel
31 Requires:       nss-certs
32 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
33 %define nspr_ver %(rpm -q --queryformat '%{VERSION}' nspr)
34 Requires(pre):  nspr >= %nspr_ver
35 Requires(pre):  libfreebl3 >= %{nss_softokn_fips_version}
36 Requires(pre):  libsoftokn3 >= %{nss_softokn_fips_version}
37 %define nssdbdir %{_sysconfdir}/pki/nssdb
38 %define run_testsuite 0
39
40 %description
41 Network Security Services (NSS) is a set of libraries designed to
42 support cross-platform development of security-enabled server
43 applications. Applications built with NSS can support SSL v2 and v3,
44 TLS, PKCS #5, PKCS #7, PKCS #11, PKCS #12, S/MIME, X.509 v3
45 certificates, and other security standards.
46
47 %package devel
48 Summary:        Network (Netscape) Security Services development files
49 Group:          Development/Libraries/Other
50 Requires:       libfreebl3
51 Requires:       libsoftokn3
52 Requires:       nspr-devel
53 Requires:       nss = %{version}
54
55 %description devel
56 Network Security Services (NSS) is a set of libraries designed to
57 support cross-platform development of security-enabled server
58 applications. Applications built with NSS can support SSL v2 and v3,
59 TLS, PKCS #5, PKCS #7, PKCS #11, PKCS #12, S/MIME, X.509 v3
60 certificates, and other security standards.
61
62 %package tools
63 Summary:        Tools for developing, debugging, and managing applications that use NSS
64 Group:          System/Management
65 Requires(pre):  nss >= %{version}
66
67 %description tools
68 The NSS Security Tools allow developers to test, debug, and manage
69 applications that use NSS.
70
71 %package sysinit
72 Summary:        System NSS Initialization
73 Group:          System/Management
74 Requires:       nss >= %{version}
75 Requires(post): coreutils
76
77 %description sysinit
78 Default Operation System module that manages applications loading
79 NSS globally on the system. This module loads the system defined
80 PKCS #11 modules for NSS and chains with other NSS modules to load
81 any system or user configured modules.
82
83 %package -n libfreebl3
84 Summary:        Freebl library for the Network Security Services
85 Group:          System/Libraries
86
87 %description -n libfreebl3
88 Network Security Services (NSS) is a set of libraries designed to
89 support cross-platform development of security-enabled server
90 applications. Applications built with NSS can support SSL v2 and v3,
91 TLS, PKCS #5, PKCS #7, PKCS #11, PKCS #12, S/MIME, X.509 v3
92 certificates, and other security standards.
93
94 This package installs the freebl library from NSS.
95
96 %package -n libsoftokn3
97 Summary:        Network Security Services Softoken Module
98 Group:          System/Libraries
99 Requires:       libfreebl3 = %{version}
100
101 %description -n libsoftokn3
102 Network Security Services (NSS) is a set of libraries designed to
103 support cross-platform development of security-enabled server
104 applications. Applications built with NSS can support SSL v2 and v3,
105 TLS, PKCS #5, PKCS #7, PKCS #11, PKCS #12, S/MIME, X.509 v3
106 certificates, and other security standards.
107
108 Network Security Services Softoken Cryptographic Module
109
110 %package certs
111 Summary:        CA certificates for NSS
112 Group:          Productivity/Networking/Security
113
114 %description certs
115 This package contains the integrated CA root certificates from the
116 Mozilla project.
117
118 %prep
119 %setup -n nss-%{version} -q
120 cd mozilla
121 %patch1
122 %patch2
123 %patch3
124 %patch4
125 %patch5
126 %patch6
127
128 %build
129 modified="$(sed -n '/^----/n;s/ - .*$//;p;q' "%{_sourcedir}/%{name}.changes")"
130 DATE="\"$(date -d "${modified}" "+%%b %%e %%Y")\""
131 TIME="\"$(date -d "${modified}" "+%%R")\""
132 find . -name '*.[ch]' -print -exec sed -i "s/__DATE__/${DATE}/g;s/__TIME__/${TIME}/g" {} +
133
134 cd mozilla/security/nss
135 export FREEBL_NO_DEPEND=1
136 export NSPR_INCLUDE_DIR=`nspr-config --includedir`
137 export NSPR_LIB_DIR=`nspr-config --libdir`
138 export OPT_FLAGS="%{optflags} -fno-strict-aliasing"
139 export LIBDIR=%{_libdir}
140 %ifarch x86_64 s390x ppc64 ia64
141 export USE_64=1
142 %endif
143 export NSS_USE_SYSTEM_SQLITE=1
144 MAKE_FLAGS="BUILD_OPT=1 NSS_ENABLE_ECC=1"
145 make nss_build_all $MAKE_FLAGS
146 # run testsuite
147 %if 0%{?run_testsuite}
148 export BUILD_OPT=1
149 export HOST="localhost"
150 export DOMSUF=" "
151 export USE_IP=TRUE
152 export IP_ADDRESS="127.0.0.1"
153 cd tests
154 ./all.sh
155 if grep "FAILED" ../../../tests_results/security/localhost.1/output.log ; then
156   echo "Testsuite FAILED"
157   exit 1
158 fi
159 %endif
160
161 %install
162 mkdir -p %{buildroot}%{_libdir}
163 mkdir -p %{buildroot}%{_libexecdir}/nss
164 mkdir -p %{buildroot}%{_includedir}/nss3
165 mkdir -p %{buildroot}%{_bindir}
166 mkdir -p %{buildroot}%{_sbindir}
167 mkdir -p %{buildroot}/%{_lib}
168 mkdir -p %{buildroot}%{nssdbdir}
169 pushd mozilla/dist/Linux*
170 # copy headers
171 cp -rL ../public/nss/*.h %{buildroot}%{_includedir}/nss3
172 # copy dynamic libs
173 cp -L  lib/libnss3.so \
174        lib/libnssdbm3.so \
175        lib/libnssdbm3.chk \
176        lib/libnssutil3.so \
177        lib/libnssckbi.so \
178        lib/libnsssysinit.so \
179        lib/libsmime3.so \
180        lib/libsoftokn3.so \
181        lib/libsoftokn3.chk \
182        lib/libssl3.so \
183        %{buildroot}%{_libdir}
184 cp -L  lib/libfreebl3.so \
185        lib/libfreebl3.chk \
186        %{buildroot}/%{_lib}
187 # copy static libs
188 cp -L  lib/libcrmf.a \
189        lib/libnssb.a \
190        lib/libnssckfw.a \
191        %{buildroot}%{_libdir}
192 # copy tools
193 cp -L  bin/certutil \
194        bin/cmsutil \
195        bin/crlutil \
196        bin/modutil \
197        bin/pk12util \
198        bin/signtool \
199        bin/signver \
200        bin/ssltap \
201        %{buildroot}%{_bindir}
202 # copy unsupported tools
203 cp -L  bin/atob \
204        bin/btoa \
205        bin/derdump \
206        bin/ocspclnt \
207        bin/pp \
208        bin/selfserv \
209        bin/shlibsign \
210        bin/strsclnt \
211        bin/symkeyutil \
212        bin/tstclnt \
213        bin/vfyserv \
214        bin/vfychain \
215        %{buildroot}%{_libexecdir}/nss
216 # prepare pkgconfig file
217 mkdir -p %{buildroot}%{_libdir}/pkgconfig/
218 sed "s:%%LIBDIR%%:%{_libdir}:g
219 s:%%VERSION%%:%{version}:g
220 s:%%NSPR_VERSION%%:%{nspr_ver}:g" \
221   %{SOURCE1} > %{buildroot}%{_libdir}/pkgconfig/nss.pc
222 # prepare nss-config file
223 popd
224 NSS_VMAJOR=`cat mozilla/security/nss/lib/nss/nss.h | grep "#define.*NSS_VMAJOR" | awk '{print $3}'`
225 NSS_VMINOR=`cat mozilla/security/nss/lib/nss/nss.h | grep "#define.*NSS_VMINOR" | awk '{print $3}'`
226 NSS_VPATCH=`cat mozilla/security/nss/lib/nss/nss.h | grep "#define.*NSS_VPATCH" | awk '{print $3}'`
227 cat %{SOURCE3} | sed -e "s,@libdir@,%{_libdir},g" \
228                      -e "s,@prefix@,%{_prefix},g" \
229                      -e "s,@exec_prefix@,%{_prefix},g" \
230                      -e "s,@includedir@,%{_includedir}/nss3,g" \
231                      -e "s,@MOD_MAJOR_VERSION@,$NSS_VMAJOR,g" \
232                      -e "s,@MOD_MINOR_VERSION@,$NSS_VMINOR,g" \
233                      -e "s,@MOD_PATCH_VERSION@,$NSS_VPATCH,g" \
234                      > %{buildroot}/%{_bindir}/nss-config
235 chmod 755 %{buildroot}/%{_bindir}/nss-config
236 # setup-nsssysinfo.sh
237 install -m 744 %{SOURCE6} %{buildroot}%{_sbindir}/
238 # create empty NSS database
239 #LD_LIBRARY_PATH=%{buildroot}/%{_lib}:%{buildroot}%{_libdir} %{buildroot}%{_bindir}/modutil -force -dbdir "sql:%{buildroot}%{nssdbdir}" -create
240 #LD_LIBRARY_PATH=%{buildroot}/%{_lib}:%{buildroot}%{_libdir} %{buildroot}%{_bindir}/certutil -N -d "sql:%{buildroot}%{nssdbdir}" -f /dev/null 2>&1 > /dev/null
241 #chmod 644 "%{buildroot}%{nssdbdir}"/*
242 #sed "s:%{buildroot}::g
243 #s/^library=$/library=libnsssysinit.so/
244 #/^NSS/s/\(Flags=internal\)\(,[^m]\)/\1,moduleDBOnly\2/" \
245 #  %{buildroot}%{nssdbdir}/pkcs11.txt > %{buildroot}%{nssdbdir}/pkcs11.txt.sed
246 #  mv %{buildroot}%{nssdbdir}/pkcs11.txt{.sed,}
247 # copy empty NSS database
248 install -m 644 %{SOURCE7} %{buildroot}%{nssdbdir}
249 install -m 644 %{SOURCE8} %{buildroot}%{nssdbdir}
250 install -m 644 %{SOURCE9} %{buildroot}%{nssdbdir}
251 # create shlib sigs after extracting debuginfo
252 %define __spec_install_post \
253   %{?__debug_package:%{__debug_install_post}} \
254   %{__arch_install_post} \
255   %{__os_install_post} \
256   LD_LIBRARY_PATH=%{buildroot}/%{_lib}:%{buildroot}%{_libdir} %{buildroot}%{_libexecdir}/nss/shlibsign -i %{buildroot}%{_libdir}/libsoftokn3.so \
257   LD_LIBRARY_PATH=%{buildroot}/%{_lib}:%{buildroot}%{_libdir} %{buildroot}%{_libexecdir}/nss/shlibsign -i %{buildroot}%{_libdir}/libnssdbm3.so \
258   LD_LIBRARY_PATH=%{buildroot}/%{_lib}:%{buildroot}%{_libdir} %{buildroot}%{_libexecdir}/nss/shlibsign -i %{buildroot}/%{_lib}/libfreebl3.so \
259 %{nil}
260
261 %post -p /sbin/ldconfig
262
263 %postun -p /sbin/ldconfig
264
265 %post -n libfreebl3 -p /sbin/ldconfig
266
267 %postun -n libfreebl3 -p /sbin/ldconfig
268
269 %post -n libsoftokn3 -p /sbin/ldconfig
270
271 %postun -n libsoftokn3 -p /sbin/ldconfig
272
273 %post sysinit
274 /sbin/ldconfig
275 # make sure the current config is enabled
276 %{_sbindir}/setup-nsssysinit.sh on
277
278 %preun sysinit
279 if [ $1 = 0 ]; then
280   %{_sbindir}/setup-nsssysinit.sh off
281 fi
282
283 %postun sysinit -p /sbin/ldconfig
284
285 %files
286 %defattr(-, root, root)
287 %{_libdir}/libnss3.so
288 %{_libdir}/libnssutil3.so
289 %{_libdir}/libsmime3.so
290 %{_libdir}/libssl3.so
291
292 %files devel
293 %defattr(644, root, root, 755)
294 %{_includedir}/nss3/
295 %{_libdir}/*.a
296 %{_libdir}/pkgconfig/*
297 %attr(755,root,root) %{_bindir}/nss-config
298
299 %files tools
300 %defattr(-, root, root)
301 %{_bindir}/*
302 %exclude %{_sbindir}/setup-nsssysinit.sh
303 %{_libexecdir}/nss/
304 %exclude %{_bindir}/nss-config
305
306 %files sysinit
307 %defattr(-, root, root)
308 %dir %{_sysconfdir}/pki
309 %dir %{_sysconfdir}/pki/nssdb
310 %config(noreplace) %{_sysconfdir}/pki/nssdb/*
311 %{_libdir}/libnsssysinit.so
312 %{_sbindir}/setup-nsssysinit.sh
313
314 %files -n libfreebl3
315 %defattr(-, root, root)
316 /%{_lib}/libfreebl3.so
317 /%{_lib}/libfreebl3.chk
318
319 %files -n libsoftokn3
320 %defattr(-, root, root)
321 %{_libdir}/libsoftokn3.so
322 %{_libdir}/libsoftokn3.chk
323 %{_libdir}/libnssdbm3.so
324 %{_libdir}/libnssdbm3.chk
325
326 %files certs
327 %defattr(-, root, root)
328 %{_libdir}/libnssckbi.so
329
330 %changelog