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