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
42 Network Security Services (NSS) is a set of libraries designed to
43 support cross-platform development of security-enabled client and
44 server applications. Applications built with NSS can support SSL v2
45 and v3, TLS, PKCS #5, PKCS #7, PKCS #11, PKCS #12, S/MIME, X.509
46 v3 certificates, and other security standards.
50 %setup -q -n nss-%{version}
51 %setup -q -T -D -n nss-%{version} -a 12
55 %patch5 -p0 -b .429175
56 %patch6 -p0 -b .libpem
60 # Enable compiler optimizations and disable debugging code
64 # Generate symbolic info for debuggers
65 XCFLAGS=$RPM_OPT_FLAGS
68 export NSPR_INCLUDE_DIR=%{_mingw32_includedir}/nspr
69 export NSPR_LIB_DIR=%{_mingw32_libdir}
71 PKG_CONFIG_ALLOW_SYSTEM_LIBS=1
72 PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1
74 export PKG_CONFIG_ALLOW_SYSTEM_LIBS
75 export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS
77 NSPR_INCLUDE_DIR=`/usr/bin/pkg-config --cflags-only-I nspr | sed 's/-I//'`
78 NSPR_LIB_DIR=`/usr/bin/pkg-config --libs-only-L nspr | sed 's/-L//'`
80 export NSPR_INCLUDE_DIR
83 %ifarch x86_64 ppc64 ia64 s390x sparc64
89 # export NSS_ENABLE_ECC
91 %{__make} -C ./mozilla/security/coreconf
92 %{__make} -C ./mozilla/security/dbm
93 %{__make} -C ./mozilla/security/nss
95 # Set up our package file
96 %{__mkdir_p} $RPM_BUILD_ROOT/%{_libdir}/pkgconfig
97 %{__cat} %{SOURCE1} | sed -e "s,%%libdir%%,%{_libdir},g" \
98 -e "s,%%prefix%%,%{_prefix},g" \
99 -e "s,%%exec_prefix%%,%{_prefix},g" \
100 -e "s,%%includedir%%,%{_includedir}/nss3,g" \
101 -e "s,%%NSPR_VERSION%%,%{nspr_version},g" \
102 -e "s,%%NSS_VERSION%%,%{version},g" > \
103 $RPM_BUILD_ROOT/%{_libdir}/pkgconfig/nss.pc
104 NSS_VMAJOR=`cat mozilla/security/nss/lib/nss/nss.h | grep "#define.*NSS_VMAJOR"
106 NSS_VMINOR=`cat mozilla/security/nss/lib/nss/nss.h | grep "#define.*NSS_VMINOR"
108 NSS_VPATCH=`cat mozilla/security/nss/lib/nss/nss.h | grep "#define.*NSS_VPATCH"
115 %{__mkdir_p} $RPM_BUILD_ROOT/%{_bindir}
116 %{__cat} %{SOURCE2} | sed -e "s,@libdir@,%{_libdir},g" \
117 -e "s,@prefix@,%{_prefix},g" \
118 -e "s,@exec_prefix@,%{_prefix},g" \
119 -e "s,@includedir@,%{_includedir}/nss3,g" \
120 -e "s,@MOD_MAJOR_VERSION@,$NSS_VMAJOR,g" \
121 -e "s,@MOD_MINOR_VERSION@,$NSS_VMINOR,g" \
122 -e "s,@MOD_PATCH_VERSION@,$NSS_VPATCH,g" \
123 > $RPM_BUILD_ROOT/%{_bindir}/nss-config
125 chmod 755 $RPM_BUILD_ROOT/%{_bindir}/nss-config
126 # enable the following line to force a test failure
127 # find ./mozilla -name \*.chk | xargs rm -f
130 # In order to support multiple concurrent executions of the test suite
131 # (caused by concurrent RPM builds) on a single host,
132 # we'll use a random port. Also, we want to clean up any stuck
133 # selfserv processes. If process name "selfserv" is used everywhere,
134 # we can't simply do a "killall selfserv", because it could disturb
135 # concurrent builds. Therefore we'll do a search and replace and use
136 # a different process name.
137 # Using xargs doesn't mix well with spaces in filenames, in order to
138 # avoid weird quoting we'll require that no spaces are being used.
140 SPACEISBAD=`find ./mozilla/security/nss/tests | grep -c ' '` ||:
141 if [ SPACEISBAD -ne 0 ]; then
142 echo "error: filenames containing space are not supported (xargs)"
145 MYRAND=`perl -e 'print 9000 + int rand 1000'`; echo $MYRAND ||:
146 RANDSERV=selfserv_${MYRAND}; echo $RANDSERV ||:
147 DISTBINDIR=`ls -d ./mozilla/dist/*.OBJ/bin`; echo $DISTBINDIR ||:
150 ln -s selfserv $RANDSERV
152 # man perlrun, man perlrequick
153 # replace word-occurrences of selfserv with selfserv_$MYRAND
154 find ./mozilla/security/nss/tests -type f |\
155 grep -v "\.db$" |grep -v "\.crl$" | grep -v "\.crt$" |\
156 grep -vw CVS |xargs grep -lw selfserv |\
157 xargs -l perl -pi -e "s/\bselfserv\b/$RANDSERV/g" ||:
159 killall $RANDSERV || :
161 rm -rf ./mozilla/tests_results
162 cd ./mozilla/security/nss/tests/
163 # all.sh is the test suite script
164 HOST=localhost DOMSUF=localdomain PORT=$MYRAND ./all.sh
167 killall $RANDSERV || :
169 TEST_FAILURES=`grep -c FAILED ./mozilla/tests_results/security/localhost.1/outpu
171 if [ $TEST_FAILURES -ne 0 ]; then
172 echo "error: test suite returned failure(s)"
175 echo "test suite completed"
179 rm -rf $RPM_BUILD_ROOT
181 # There is no make install target so we'll do it ourselves.
183 %{__mkdir_p} $RPM_BUILD_ROOT/%{_includedir}/nss3
184 %{__mkdir_p} $RPM_BUILD_ROOT/%{_bindir}
185 %{__mkdir_p} $RPM_BUILD_ROOT/%{_lib}
186 %{__mkdir_p} $RPM_BUILD_ROOT/%{unsupported_tools_directory}
188 # Copy the binary libraries we want
189 for file in libsoftokn3.so libfreebl3.so libnss3.so libnssutil3.so \
190 libssl3.so libsmime3.so libnssckbi.so libnsspem.so libnssdbm3.so
192 %{__install} -m 755 mozilla/dist/*.OBJ/lib/$file $RPM_BUILD_ROOT/%{_lib}
193 ln -sf ../../%{_lib}/$file $RPM_BUILD_ROOT/%{_libdir}/$file
196 # These ghost files will be generated in the post step
197 # Make sure chk files can be found in both places
198 for file in libsoftokn3.chk libfreebl3.chk
200 touch $RPM_BUILD_ROOT/%{_lib}/$file
201 ln -s ../../%{_lib}/$file $RPM_BUILD_ROOT/%{_libdir}/$file
204 # Install the empty NSS db files
205 %{__mkdir_p} $RPM_BUILD_ROOT/%{_sysconfdir}/pki/nssdb
206 %{__install} -m 644 %{SOURCE3} $RPM_BUILD_ROOT/%{_sysconfdir}/pki/nssdb/cert8.db
207 %{__install} -m 644 %{SOURCE4} $RPM_BUILD_ROOT/%{_sysconfdir}/pki/nssdb/key3.db
208 %{__install} -m 644 %{SOURCE5} $RPM_BUILD_ROOT/%{_sysconfdir}/pki/nssdb/secmod.d
210 %{__mkdir_p} $RPM_BUILD_ROOT/%{_sysconfdir}/prelink.conf.d
211 %{__install} -m 644 %{SOURCE8} $RPM_BUILD_ROOT/%{_sysconfdir}/prelink.conf.d/nss
214 # Copy the development libraries we want
215 for file in libcrmf.a libnssb.a libnssckfw.a
217 %{__install} -m 644 mozilla/dist/*.OBJ/lib/$file $RPM_BUILD_ROOT/%{_libdir}
220 # Copy the binaries we want
221 for file in certutil cmsutil crlutil modutil pk12util signtool signver ssltap
223 %{__install} -m 755 mozilla/dist/*.OBJ/bin/$file $RPM_BUILD_ROOT/%{_bindir}
226 # Copy the binaries we ship as unsupported
227 for file in atob btoa derdump ocspclnt pp selfserv shlibsign strsclnt symkeyutil
228 tstclnt vfyserv vfychain
230 %{__install} -m 755 mozilla/dist/*.OBJ/bin/$file $RPM_BUILD_ROOT/%{unsupported
234 # Copy the include files we want
235 for file in mozilla/dist/public/nss/*.h
237 %{__install} -m 644 $file $RPM_BUILD_ROOT/%{_includedir}/nss3
242 rm -rf $RPM_BUILD_ROOT
246 %defattr(-,root,root)
248 %{_mingw32_bindir}/foo.dll
249 %{_mingw32_libdir}/foo.dll.a
254 * Fri Feb 6 2009 Richard W.M. Jones <rjones@redhat.com> - 3.12.2.0-3
255 - Include license file.
257 * Fri Jan 30 2009 Richard W.M. Jones <rjones@redhat.com> - 3.12.2.0-2
258 - Initial RPM release.