More coverage, based on unresolved symbols in inkscape and pidgen.
[fedora-mingw.git] / nss / mingw32-nss.spec
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}
6
7 Name:           mingw32-nss
8 Version:        3.12.2.0
9 Release:        3%{?dist}
10 Summary:        MinGW Windows port of NSS (Network Security Services)
11
12 License:        MPLv1.1 or GPLv2+ or LGPLv2+
13 Group:          Development/Libraries
14 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
15 BuildArch:      noarch
16
17 URL:            http://www.mozilla.org/projects/security/pki/nss/
18
19 # Extracted from the Fedora native package.  There is no upstream
20 # location for the tarballs.
21 Source0:        nss-%{version}-stripped.tar.bz2
22 Source1:        nss.pc.in
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
29
30 BuildRequires:  mingw32-filesystem >= 33
31 BuildRequires:  mingw32-gcc
32 BuildRequires:  mingw32-binutils
33 BuildRequires:  mingw32-sqlite
34 BuildRequires:  mingw32-zlib
35 BuildRequires:  pkgconfig
36 BuildRequires:  perl
37
38 Requires:       pkgconfig
39
40
41 %description
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.
47
48
49 %prep
50 %setup -q -n nss-%{version}
51 %setup -q -T -D -n nss-%{version} -a 12
52
53 %patch1 -p0
54 %patch2 -p0
55 %patch5 -p0 -b .429175
56 %patch6 -p0 -b .libpem
57
58
59 %build
60 # Enable compiler optimizations and disable debugging code
61 BUILD_OPT=1
62 export BUILD_OPT
63
64 # Generate symbolic info for debuggers
65 XCFLAGS=$RPM_OPT_FLAGS
66 export XCFLAGS
67
68 export NSPR_INCLUDE_DIR=%{_mingw32_includedir}/nspr
69 export NSPR_LIB_DIR=%{_mingw32_libdir}
70
71 PKG_CONFIG_ALLOW_SYSTEM_LIBS=1
72 PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1
73
74 export PKG_CONFIG_ALLOW_SYSTEM_LIBS
75 export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS
76
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//'`
79
80 export NSPR_INCLUDE_DIR
81 export NSPR_LIB_DIR
82
83 %ifarch x86_64 ppc64 ia64 s390x sparc64
84 USE_64=1
85 export USE_64
86 %endif
87
88 # NSS_ENABLE_ECC=1
89 # export NSS_ENABLE_ECC
90
91 %{__make} -C ./mozilla/security/coreconf
92 %{__make} -C ./mozilla/security/dbm
93 %{__make} -C ./mozilla/security/nss
94
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" 
105 | awk '{print $3}'`
106 NSS_VMINOR=`cat mozilla/security/nss/lib/nss/nss.h | grep "#define.*NSS_VMINOR" 
107 | awk '{print $3}'`
108 NSS_VPATCH=`cat mozilla/security/nss/lib/nss/nss.h | grep "#define.*NSS_VPATCH" 
109 | awk '{print $3}'`
110
111 export NSS_VMAJOR 
112 export NSS_VMINOR 
113 export NSS_VPATCH
114
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
124
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
128
129 # Run test suite.
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.
139
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)"
143   exit 1
144 fi
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 ||:
148 pushd `pwd`
149 cd $DISTBINDIR
150 ln -s selfserv $RANDSERV
151 popd
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" ||:
158
159 killall $RANDSERV || :
160
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
165 cd ../../../../
166
167 killall $RANDSERV || :
168
169 TEST_FAILURES=`grep -c FAILED ./mozilla/tests_results/security/localhost.1/outpu
170 t.log` || :
171 if [ $TEST_FAILURES -ne 0 ]; then
172   echo "error: test suite returned failure(s)"
173   exit 1
174 fi
175 echo "test suite completed"
176
177
178 %install
179 rm -rf $RPM_BUILD_ROOT
180
181 # There is no make install target so we'll do it ourselves.
182
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}
187
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
191 do
192   %{__install} -m 755 mozilla/dist/*.OBJ/lib/$file $RPM_BUILD_ROOT/%{_lib}
193   ln -sf ../../%{_lib}/$file $RPM_BUILD_ROOT/%{_libdir}/$file
194 done
195
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
199 do
200   touch $RPM_BUILD_ROOT/%{_lib}/$file
201   ln -s ../../%{_lib}/$file $RPM_BUILD_ROOT/%{_libdir}/$file
202 done
203
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
209 b
210 %{__mkdir_p} $RPM_BUILD_ROOT/%{_sysconfdir}/prelink.conf.d
211 %{__install} -m 644 %{SOURCE8} $RPM_BUILD_ROOT/%{_sysconfdir}/prelink.conf.d/nss
212 -prelink.conf
213
214 # Copy the development libraries we want
215 for file in libcrmf.a libnssb.a libnssckfw.a
216 do
217   %{__install} -m 644 mozilla/dist/*.OBJ/lib/$file $RPM_BUILD_ROOT/%{_libdir}
218 done
219
220 # Copy the binaries we want
221 for file in certutil cmsutil crlutil modutil pk12util signtool signver ssltap
222 do
223   %{__install} -m 755 mozilla/dist/*.OBJ/bin/$file $RPM_BUILD_ROOT/%{_bindir}
224 done
225
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
229 do
230   %{__install} -m 755 mozilla/dist/*.OBJ/bin/$file $RPM_BUILD_ROOT/%{unsupported
231 _tools_directory}
232 done
233
234 # Copy the include files we want
235 for file in mozilla/dist/public/nss/*.h
236 do
237   %{__install} -m 644 $file $RPM_BUILD_ROOT/%{_includedir}/nss3
238 done
239
240
241 %clean
242 rm -rf $RPM_BUILD_ROOT
243
244
245 %files
246 %defattr(-,root,root)
247 %doc XXX
248 %{_mingw32_bindir}/foo.dll
249 %{_mingw32_libdir}/foo.dll.a
250 # etc.
251
252
253 %changelog
254 * Fri Feb  6 2009 Richard W.M. Jones <rjones@redhat.com> - 3.12.2.0-3
255 - Include license file.
256
257 * Fri Jan 30 2009 Richard W.M. Jones <rjones@redhat.com> - 3.12.2.0-2
258 - Initial RPM release.