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