1 %define __strip %{_mingw32_strip}
2 %define __objdump %{_mingw32_objdump}
3 %define _use_internal_dependency_generator 0
4 %define __find_requires %{_mingw32_findrequires}
5 %define __find_provides %{_mingw32_findprovides}
7 # Version of NSPR that we depend on.
8 %define nspr_version 4.7
10 # Tests cause strange Wine failures ...
16 Summary: MinGW Windows port of NSS (Network Security Services)
18 License: MPLv1.1 or GPLv2+ or LGPLv2+
19 Group: Development/Libraries
20 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
23 URL: http://www.mozilla.org/projects/security/pki/nss/
25 # Extracted from the Fedora native package. There is no upstream
26 # location for the tarballs.
27 Source0: nss-%{version}-stripped.tar.bz2
29 Source2: nss-config.in
30 Source3: blank-cert8.db
31 Source4: blank-key3.db
32 Source5: blank-secmod.db
33 Source8: nss-prelink.conf
34 Source12: nss-pem-20080124.tar.bz2
38 Patch1: nss-no-rpath.patch
39 Patch2: nss-nolocalsql.patch
40 Patch5: nss-pem-bug429175.patch
41 Patch6: nss-enable-pem.patch
43 Patch1000: nss-cross-compile.patch
45 BuildRequires: mingw32-filesystem >= 33
46 BuildRequires: mingw32-gcc
47 BuildRequires: mingw32-binutils
49 BuildRequires: mingw32-nspr >= %{nspr_version}
50 BuildRequires: mingw32-sqlite
51 BuildRequires: mingw32-zlib
53 BuildRequires: pkgconfig
60 Network Security Services (NSS) is a set of libraries designed to
61 support cross-platform development of security-enabled client and
62 server applications. Applications built with NSS can support SSL v2
63 and v3, TLS, PKCS #5, PKCS #7, PKCS #11, PKCS #12, S/MIME, X.509
64 v3 certificates, and other security standards.
68 %setup -q -n nss-%{version}
69 %setup -q -T -D -n nss-%{version} -a 12
73 %patch5 -p0 -b .429175
74 %patch6 -p0 -b .libpem
78 # Notes on the naming:
79 # (1) "2.6" is the Linux version number which is appended to the name
80 # also by NSS Makefiles.
81 # (2) OS_TARGET must be set to the basename (w/o 2.6).
82 cp %{SOURCE1000} mozilla/security/coreconf/FedoraCross2.6.mk
84 # This fixes a build failure in mock (not rpmbuild).
85 # This fix is not well-understood.
86 touch mozilla/security/nss/cmd/signtool/-lz
87 touch mozilla/security/nss/cmd/modutil/-lz
91 # For cross-compilation, make sure pkg-config picks up the cross-compiled
93 PKG_CONFIG_LIBDIR="%{_mingw32_libdir}/pkgconfig"
94 export PKG_CONFIG_LIBDIR
98 NATIVE_FLAGS="-DLINUX -Dlinux -D_POSIX_SOURCE -D_BSD_SOURCE -DHAVE_STRERROR"
104 OS_TARGET=FedoraCross
107 # Enable compiler optimizations and disable debugging code
111 # Generate symbolic info for debuggers
112 XCFLAGS="%{_mingw32_cflags}"
115 export NSPR_INCLUDE_DIR=%{_mingw32_includedir}/nspr
116 export NSPR_LIB_DIR=%{_mingw32_bindir}
118 # Target is Win32 (32 bit):
119 #%ifarch x86_64 ppc64 ia64 s390x sparc64
125 # export NSS_ENABLE_ECC
127 %{__make} -C ./mozilla/security/coreconf
128 %{__make} -C ./mozilla/security/dbm
129 %{__make} -C ./mozilla/security/nss
131 # enable the following line to force a test failure
132 # find ./mozilla -name \*.chk | xargs rm -f
136 # In order to support multiple concurrent executions of the test suite
137 # (caused by concurrent RPM builds) on a single host,
138 # we'll use a random port. Also, we want to clean up any stuck
139 # selfserv processes. If process name "selfserv" is used everywhere,
140 # we can't simply do a "killall selfserv", because it could disturb
141 # concurrent builds. Therefore we'll do a search and replace and use
142 # a different process name.
143 # Using xargs doesn't mix well with spaces in filenames, in order to
144 # avoid weird quoting we'll require that no spaces are being used.
146 SPACEISBAD=`find ./mozilla/security/nss/tests | grep -c ' '` ||:
147 if [ SPACEISBAD -ne 0 ]; then
148 echo "error: filenames containing space are not supported (xargs)"
151 MYRAND=`perl -e 'print 9000 + int rand 1000'`; echo $MYRAND ||:
152 RANDSERV=selfserv_${MYRAND}; echo $RANDSERV ||:
153 DISTBINDIR=`ls -d ./mozilla/dist/*.OBJ/bin`; echo $DISTBINDIR ||:
156 ln -s selfserv $RANDSERV
158 # man perlrun, man perlrequick
159 # replace word-occurrences of selfserv with selfserv_$MYRAND
160 find ./mozilla/security/nss/tests -type f |\
161 grep -v "\.db$" |grep -v "\.crl$" | grep -v "\.crt$" |\
162 grep -vw CVS |xargs grep -lw selfserv |\
163 xargs -l perl -pi -e "s/\bselfserv\b/$RANDSERV/g" ||:
165 killall $RANDSERV || :
167 rm -rf ./mozilla/tests_results
168 cd ./mozilla/security/nss/tests/
169 # all.sh is the test suite script
170 HOST=localhost DOMSUF=localdomain PORT=$MYRAND ./all.sh
173 killall $RANDSERV || :
175 TEST_FAILURES=`grep -c FAILED ./mozilla/tests_results/security/localhost.1/output.log` || :
176 if [ $TEST_FAILURES -ne 0 ]; then
177 echo "error: test suite returned failure(s)"
180 echo "test suite completed"
185 rm -rf $RPM_BUILD_ROOT
187 # There is no make install target so we'll do it ourselves.
189 %{__mkdir_p} $RPM_BUILD_ROOT/%{_mingw32_includedir}/nss3
190 %{__mkdir_p} $RPM_BUILD_ROOT/%{_mingw32_bindir}
191 %{__mkdir_p} $RPM_BUILD_ROOT/%{_mingw32_libdir}
192 %{__mkdir_p} $RPM_BUILD_ROOT/%{_mingw32_libdir}/nss/unsupported-tools
194 # Set up our package file
195 %{__mkdir_p} $RPM_BUILD_ROOT/%{_mingw32_libdir}/pkgconfig
196 %{__cat} %{SOURCE1} | sed -e "s,%%libdir%%,%{_mingw32_libdir},g" \
197 -e "s,%%prefix%%,%{_mingw32_prefix},g" \
198 -e "s,%%exec_prefix%%,%{_mingw32_prefix},g" \
199 -e "s,%%includedir%%,%{_mingw32_includedir}/nss3,g" \
200 -e "s,%%NSPR_VERSION%%,%{nspr_version},g" \
201 -e "s,%%NSS_VERSION%%,%{version},g" > \
202 $RPM_BUILD_ROOT/%{_mingw32_libdir}/pkgconfig/nss.pc
203 NSS_VMAJOR=`cat mozilla/security/nss/lib/nss/nss.h | grep "#define.*NSS_VMAJOR" | awk '{print $3}'`
204 NSS_VMINOR=`cat mozilla/security/nss/lib/nss/nss.h | grep "#define.*NSS_VMINOR" | awk '{print $3}'`
205 NSS_VPATCH=`cat mozilla/security/nss/lib/nss/nss.h | grep "#define.*NSS_VPATCH" | awk '{print $3}'`
211 %{__mkdir_p} $RPM_BUILD_ROOT/%{_mingw32_bindir}
212 %{__cat} %{SOURCE2} | sed -e "s,@libdir@,%{_mingw32_libdir},g" \
213 -e "s,@prefix@,%{_mingw32_prefix},g" \
214 -e "s,@exec_prefix@,%{_mingw32_prefix},g" \
215 -e "s,@includedir@,%{_mingw32_includedir}/nss3,g" \
216 -e "s,@MOD_MAJOR_VERSION@,$NSS_VMAJOR,g" \
217 -e "s,@MOD_MINOR_VERSION@,$NSS_VMINOR,g" \
218 -e "s,@MOD_PATCH_VERSION@,$NSS_VPATCH,g" \
219 > $RPM_BUILD_ROOT/%{_mingw32_bindir}/nss-config
221 chmod 755 $RPM_BUILD_ROOT/%{_mingw32_bindir}/nss-config
223 # Copy the binary libraries we want
224 for file in libsoftokn3.dll libfreebl3.dll libnss3.dll libnssutil3.dll \
225 libssl3.dll libsmime3.dll libnssckbi.dll libnsspem.dll libnssdbm3.dll
227 %{__install} -m 755 mozilla/dist/*.OBJ/lib/$file $RPM_BUILD_ROOT/%{_mingw32_bindir}
230 # These ghost files will be generated in the post step
231 # Make sure chk files can be found in both places
232 #for file in libsoftokn3.chk libfreebl3.chk
234 # touch $RPM_BUILD_ROOT/%{_lib}/$file
235 # ln -s ../../%{_lib}/$file $RPM_BUILD_ROOT/%{_mingw32_libdir}/$file
238 # Install the empty NSS db files
239 %{__mkdir_p} $RPM_BUILD_ROOT/%{_mingw32_sysconfdir}/pki/nssdb
240 %{__install} -m 644 %{SOURCE3} $RPM_BUILD_ROOT/%{_mingw32_sysconfdir}/pki/nssdb/cert8.db
241 %{__install} -m 644 %{SOURCE4} $RPM_BUILD_ROOT/%{_mingw32_sysconfdir}/pki/nssdb/key3.db
242 %{__install} -m 644 %{SOURCE5} $RPM_BUILD_ROOT/%{_mingw32_sysconfdir}/pki/nssdb/secmod.db
243 %{__mkdir_p} $RPM_BUILD_ROOT/%{_mingw32_sysconfdir}/prelink.conf.d
244 %{__install} -m 644 %{SOURCE8} $RPM_BUILD_ROOT/%{_mingw32_sysconfdir}/prelink.conf.d/nss-prelink.conf
246 # Copy the development libraries we want
247 for file in libcrmf.a libnssb.a libnssckfw.a
249 %{__install} -m 644 mozilla/dist/*.OBJ/lib/$file $RPM_BUILD_ROOT/%{_mingw32_libdir}
252 # Copy the binaries we want
253 for file in certutil cmsutil crlutil modutil pk12util signtool signver ssltap
255 %{__install} -m 755 mozilla/dist/*.OBJ/bin/$file $RPM_BUILD_ROOT/%{_mingw32_bindir}
258 # Copy the binaries we ship as unsupported
259 for file in atob btoa derdump ocspclnt pp selfserv shlibsign strsclnt symkeyutil tstclnt vfyserv vfychain
261 %{__install} -m 755 mozilla/dist/*.OBJ/bin/$file $RPM_BUILD_ROOT/%{_mingw32_libdir}/nss/unsupported-tools
264 # Copy the include files we want
265 for file in mozilla/dist/public/nss/*.h
267 %{__install} -m 644 $file $RPM_BUILD_ROOT/%{_mingw32_includedir}/nss3
272 rm -rf $RPM_BUILD_ROOT
276 %defattr(-,root,root)
277 %{_mingw32_bindir}/nss-config
278 %{_mingw32_bindir}/certutil
279 %{_mingw32_bindir}/cmsutil
280 %{_mingw32_bindir}/crlutil
281 %{_mingw32_bindir}/modutil
282 %{_mingw32_bindir}/pk12util
283 %{_mingw32_bindir}/signtool
284 %{_mingw32_bindir}/signver
285 %{_mingw32_bindir}/ssltap
286 %{_mingw32_bindir}/libsoftokn3.dll
287 %{_mingw32_bindir}/libfreebl3.dll
288 %{_mingw32_bindir}/libnss3.dll
289 %{_mingw32_bindir}/libnssutil3.dll
290 %{_mingw32_bindir}/libssl3.dll
291 %{_mingw32_bindir}/libsmime3.dll
292 %{_mingw32_bindir}/libnssckbi.dll
293 %{_mingw32_bindir}/libnsspem.dll
294 %{_mingw32_bindir}/libnssdbm3.dll
295 %{_mingw32_sysconfdir}/pki/nssdb/cert8.db
296 %{_mingw32_sysconfdir}/pki/nssdb/key3.db
297 %{_mingw32_sysconfdir}/pki/nssdb/secmod.db
298 %{_mingw32_sysconfdir}/prelink.conf.d/nss-prelink.conf
299 %{_mingw32_includedir}/nss3/
300 %{_mingw32_libdir}/libcrmf.a
301 %{_mingw32_libdir}/libnssb.a
302 %{_mingw32_libdir}/libnssckfw.a
303 %{_mingw32_libdir}/nss/unsupported-tools/atob
304 %{_mingw32_libdir}/nss/unsupported-tools/btoa
305 %{_mingw32_libdir}/nss/unsupported-tools/derdump
306 %{_mingw32_libdir}/nss/unsupported-tools/ocspclnt
307 %{_mingw32_libdir}/nss/unsupported-tools/pp
308 %{_mingw32_libdir}/nss/unsupported-tools/selfserv
309 %{_mingw32_libdir}/nss/unsupported-tools/shlibsign
310 %{_mingw32_libdir}/nss/unsupported-tools/strsclnt
311 %{_mingw32_libdir}/nss/unsupported-tools/symkeyutil
312 %{_mingw32_libdir}/nss/unsupported-tools/tstclnt
313 %{_mingw32_libdir}/nss/unsupported-tools/vfychain
314 %{_mingw32_libdir}/nss/unsupported-tools/vfyserv
315 %{_mingw32_libdir}/pkgconfig/nss.pc
319 * Wed Feb 18 2009 Richard W.M. Jones <rjones@redhat.com> - 3.12.2.0-5
320 - Fix to build in mock.
322 * Tue Feb 17 2009 Richard W.M. Jones <rjones@redhat.com> - 3.12.2.0-4
325 * Fri Feb 6 2009 Richard W.M. Jones <rjones@redhat.com> - 3.12.2.0-3
326 - Include license file.
328 * Fri Jan 30 2009 Richard W.M. Jones <rjones@redhat.com> - 3.12.2.0-2
329 - Initial RPM release.