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}
10 Summary: MinGW Windows port of NSS (Network Security Services)
12 License: MPLv1.1 or GPLv2+ or LGPLv2+
13 Group: Development/Libraries
14 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
17 URL: http://www.mozilla.org/projects/security/pki/nss/
19 # Extracted from the Fedora native package. There is no upstream
20 # location for the tarballs.
21 Source0: nss-%{version}-stripped.tar.bz2
23 Source2: nss-config.in
24 Source3: blank-cert8.db
25 Source4: blank-key3.db
26 Source5: blank-secmod.db
27 Source8: nss-prelink.conf
28 Source12: nss-pem-20080124.tar.bz2
30 BuildRequires: mingw32-filesystem >= 33
31 BuildRequires: mingw32-gcc
32 BuildRequires: mingw32-binutils
33 BuildRequires: mingw32-sqlite
34 BuildRequires: mingw32-zlib
35 BuildRequires: pkgconfig
40 Network Security Services (NSS) is a set of libraries designed to
41 support cross-platform development of security-enabled client and
42 server applications. Applications built with NSS can support SSL v2
43 and v3, TLS, PKCS #5, PKCS #7, PKCS #11, PKCS #12, S/MIME, X.509
44 v3 certificates, and other security standards.
48 %setup -q -n nss-%{version}
49 %setup -q -T -D -n nss-%{version} -a 12
53 %patch5 -p0 -b .429175
54 %patch6 -p0 -b .libpem
58 # Enable compiler optimizations and disable debugging code
62 # Generate symbolic info for debuggers
63 XCFLAGS=$RPM_OPT_FLAGS
66 export NSPR_INCLUDE_DIR=%{_mingw32_includedir}/nspr
67 export NSPR_LIB_DIR=%{_mingw32_libdir}
69 PKG_CONFIG_ALLOW_SYSTEM_LIBS=1
70 PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1
72 export PKG_CONFIG_ALLOW_SYSTEM_LIBS
73 export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS
75 NSPR_INCLUDE_DIR=`/usr/bin/pkg-config --cflags-only-I nspr | sed 's/-I//'`
76 NSPR_LIB_DIR=`/usr/bin/pkg-config --libs-only-L nspr | sed 's/-L//'`
78 export NSPR_INCLUDE_DIR
81 %ifarch x86_64 ppc64 ia64 s390x sparc64
87 # export NSS_ENABLE_ECC
89 %{__make} -C ./mozilla/security/coreconf
90 %{__make} -C ./mozilla/security/dbm
91 %{__make} -C ./mozilla/security/nss
93 # Set up our package file
94 %{__mkdir_p} $RPM_BUILD_ROOT/%{_libdir}/pkgconfig
95 %{__cat} %{SOURCE1} | sed -e "s,%%libdir%%,%{_libdir},g" \
96 -e "s,%%prefix%%,%{_prefix},g" \
97 -e "s,%%exec_prefix%%,%{_prefix},g" \
98 -e "s,%%includedir%%,%{_includedir}/nss3,g" \
99 -e "s,%%NSPR_VERSION%%,%{nspr_version},g" \
100 -e "s,%%NSS_VERSION%%,%{version},g" > \
101 $RPM_BUILD_ROOT/%{_libdir}/pkgconfig/nss.pc
102 NSS_VMAJOR=`cat mozilla/security/nss/lib/nss/nss.h | grep "#define.*NSS_VMAJOR"
104 NSS_VMINOR=`cat mozilla/security/nss/lib/nss/nss.h | grep "#define.*NSS_VMINOR"
106 NSS_VPATCH=`cat mozilla/security/nss/lib/nss/nss.h | grep "#define.*NSS_VPATCH"
113 %{__mkdir_p} $RPM_BUILD_ROOT/%{_bindir}
114 %{__cat} %{SOURCE2} | sed -e "s,@libdir@,%{_libdir},g" \
115 -e "s,@prefix@,%{_prefix},g" \
116 -e "s,@exec_prefix@,%{_prefix},g" \
117 -e "s,@includedir@,%{_includedir}/nss3,g" \
118 -e "s,@MOD_MAJOR_VERSION@,$NSS_VMAJOR,g" \
119 -e "s,@MOD_MINOR_VERSION@,$NSS_VMINOR,g" \
120 -e "s,@MOD_PATCH_VERSION@,$NSS_VPATCH,g" \
121 > $RPM_BUILD_ROOT/%{_bindir}/nss-config
123 chmod 755 $RPM_BUILD_ROOT/%{_bindir}/nss-config
124 # enable the following line to force a test failure
125 # find ./mozilla -name \*.chk | xargs rm -f
128 # In order to support multiple concurrent executions of the test suite
129 # (caused by concurrent RPM builds) on a single host,
130 # we'll use a random port. Also, we want to clean up any stuck
131 # selfserv processes. If process name "selfserv" is used everywhere,
132 # we can't simply do a "killall selfserv", because it could disturb
133 # concurrent builds. Therefore we'll do a search and replace and use
134 # a different process name.
135 # Using xargs doesn't mix well with spaces in filenames, in order to
136 # avoid weird quoting we'll require that no spaces are being used.
138 SPACEISBAD=`find ./mozilla/security/nss/tests | grep -c ' '` ||:
139 if [ SPACEISBAD -ne 0 ]; then
140 echo "error: filenames containing space are not supported (xargs)"
143 MYRAND=`perl -e 'print 9000 + int rand 1000'`; echo $MYRAND ||:
144 RANDSERV=selfserv_${MYRAND}; echo $RANDSERV ||:
145 DISTBINDIR=`ls -d ./mozilla/dist/*.OBJ/bin`; echo $DISTBINDIR ||:
148 ln -s selfserv $RANDSERV
150 # man perlrun, man perlrequick
151 # replace word-occurrences of selfserv with selfserv_$MYRAND
152 find ./mozilla/security/nss/tests -type f |\
153 grep -v "\.db$" |grep -v "\.crl$" | grep -v "\.crt$" |\
154 grep -vw CVS |xargs grep -lw selfserv |\
155 xargs -l perl -pi -e "s/\bselfserv\b/$RANDSERV/g" ||:
157 killall $RANDSERV || :
159 rm -rf ./mozilla/tests_results
160 cd ./mozilla/security/nss/tests/
161 # all.sh is the test suite script
162 HOST=localhost DOMSUF=localdomain PORT=$MYRAND ./all.sh
165 killall $RANDSERV || :
167 TEST_FAILURES=`grep -c FAILED ./mozilla/tests_results/security/localhost.1/outpu
169 if [ $TEST_FAILURES -ne 0 ]; then
170 echo "error: test suite returned failure(s)"
173 echo "test suite completed"
177 rm -rf $RPM_BUILD_ROOT
179 # There is no make install target so we'll do it ourselves.
181 %{__mkdir_p} $RPM_BUILD_ROOT/%{_includedir}/nss3
182 %{__mkdir_p} $RPM_BUILD_ROOT/%{_bindir}
183 %{__mkdir_p} $RPM_BUILD_ROOT/%{_lib}
184 %{__mkdir_p} $RPM_BUILD_ROOT/%{unsupported_tools_directory}
186 # Copy the binary libraries we want
187 for file in libsoftokn3.so libfreebl3.so libnss3.so libnssutil3.so \
188 libssl3.so libsmime3.so libnssckbi.so libnsspem.so libnssdbm3.so
190 %{__install} -m 755 mozilla/dist/*.OBJ/lib/$file $RPM_BUILD_ROOT/%{_lib}
191 ln -sf ../../%{_lib}/$file $RPM_BUILD_ROOT/%{_libdir}/$file
194 # These ghost files will be generated in the post step
195 # Make sure chk files can be found in both places
196 for file in libsoftokn3.chk libfreebl3.chk
198 touch $RPM_BUILD_ROOT/%{_lib}/$file
199 ln -s ../../%{_lib}/$file $RPM_BUILD_ROOT/%{_libdir}/$file
202 # Install the empty NSS db files
203 %{__mkdir_p} $RPM_BUILD_ROOT/%{_sysconfdir}/pki/nssdb
204 %{__install} -m 644 %{SOURCE3} $RPM_BUILD_ROOT/%{_sysconfdir}/pki/nssdb/cert8.db
205 %{__install} -m 644 %{SOURCE4} $RPM_BUILD_ROOT/%{_sysconfdir}/pki/nssdb/key3.db
206 %{__install} -m 644 %{SOURCE5} $RPM_BUILD_ROOT/%{_sysconfdir}/pki/nssdb/secmod.d
208 %{__mkdir_p} $RPM_BUILD_ROOT/%{_sysconfdir}/prelink.conf.d
209 %{__install} -m 644 %{SOURCE8} $RPM_BUILD_ROOT/%{_sysconfdir}/prelink.conf.d/nss
212 # Copy the development libraries we want
213 for file in libcrmf.a libnssb.a libnssckfw.a
215 %{__install} -m 644 mozilla/dist/*.OBJ/lib/$file $RPM_BUILD_ROOT/%{_libdir}
218 # Copy the binaries we want
219 for file in certutil cmsutil crlutil modutil pk12util signtool signver ssltap
221 %{__install} -m 755 mozilla/dist/*.OBJ/bin/$file $RPM_BUILD_ROOT/%{_bindir}
224 # Copy the binaries we ship as unsupported
225 for file in atob btoa derdump ocspclnt pp selfserv shlibsign strsclnt symkeyutil
226 tstclnt vfyserv vfychain
228 %{__install} -m 755 mozilla/dist/*.OBJ/bin/$file $RPM_BUILD_ROOT/%{unsupported
232 # Copy the include files we want
233 for file in mozilla/dist/public/nss/*.h
235 %{__install} -m 644 $file $RPM_BUILD_ROOT/%{_includedir}/nss3
240 rm -rf $RPM_BUILD_ROOT
244 %defattr(-,root,root)
245 %{_mingw32_bindir}/foo.dll
246 %{_mingw32_libdir}/foo.dll.a
251 * Wed Sep 24 2008 Your Name <you@example.com> - 1.2.3-1
252 - Initial RPM release.