Don't build dbus either.
[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:        1%{?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
39 %description
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.
45
46
47 %prep
48 %setup -q -n nss-%{version}
49 %setup -q -T -D -n nss-%{version} -a 12
50
51 %patch1 -p0
52 %patch2 -p0
53 %patch5 -p0 -b .429175
54 %patch6 -p0 -b .libpem
55
56
57 %build
58 # Enable compiler optimizations and disable debugging code
59 BUILD_OPT=1
60 export BUILD_OPT
61
62 # Generate symbolic info for debuggers
63 XCFLAGS=$RPM_OPT_FLAGS
64 export XCFLAGS
65
66 export NSPR_INCLUDE_DIR=%{_mingw32_includedir}/nspr
67 export NSPR_LIB_DIR=%{_mingw32_libdir}
68
69 PKG_CONFIG_ALLOW_SYSTEM_LIBS=1
70 PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1
71
72 export PKG_CONFIG_ALLOW_SYSTEM_LIBS
73 export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS
74
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//'`
77
78 export NSPR_INCLUDE_DIR
79 export NSPR_LIB_DIR
80
81 %ifarch x86_64 ppc64 ia64 s390x sparc64
82 USE_64=1
83 export USE_64
84 %endif
85
86 # NSS_ENABLE_ECC=1
87 # export NSS_ENABLE_ECC
88
89 %{__make} -C ./mozilla/security/coreconf
90 %{__make} -C ./mozilla/security/dbm
91 %{__make} -C ./mozilla/security/nss
92
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" 
103 | awk '{print $3}'`
104 NSS_VMINOR=`cat mozilla/security/nss/lib/nss/nss.h | grep "#define.*NSS_VMINOR" 
105 | awk '{print $3}'`
106 NSS_VPATCH=`cat mozilla/security/nss/lib/nss/nss.h | grep "#define.*NSS_VPATCH" 
107 | awk '{print $3}'`
108
109 export NSS_VMAJOR 
110 export NSS_VMINOR 
111 export NSS_VPATCH
112
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
122
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
126
127 # Run test suite.
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.
137
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)"
141   exit 1
142 fi
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 ||:
146 pushd `pwd`
147 cd $DISTBINDIR
148 ln -s selfserv $RANDSERV
149 popd
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" ||:
156
157 killall $RANDSERV || :
158
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
163 cd ../../../../
164
165 killall $RANDSERV || :
166
167 TEST_FAILURES=`grep -c FAILED ./mozilla/tests_results/security/localhost.1/outpu
168 t.log` || :
169 if [ $TEST_FAILURES -ne 0 ]; then
170   echo "error: test suite returned failure(s)"
171   exit 1
172 fi
173 echo "test suite completed"
174
175
176 %install
177 rm -rf $RPM_BUILD_ROOT
178
179 # There is no make install target so we'll do it ourselves.
180
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}
185
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
189 do
190   %{__install} -m 755 mozilla/dist/*.OBJ/lib/$file $RPM_BUILD_ROOT/%{_lib}
191   ln -sf ../../%{_lib}/$file $RPM_BUILD_ROOT/%{_libdir}/$file
192 done
193
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
197 do
198   touch $RPM_BUILD_ROOT/%{_lib}/$file
199   ln -s ../../%{_lib}/$file $RPM_BUILD_ROOT/%{_libdir}/$file
200 done
201
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
207 b
208 %{__mkdir_p} $RPM_BUILD_ROOT/%{_sysconfdir}/prelink.conf.d
209 %{__install} -m 644 %{SOURCE8} $RPM_BUILD_ROOT/%{_sysconfdir}/prelink.conf.d/nss
210 -prelink.conf
211
212 # Copy the development libraries we want
213 for file in libcrmf.a libnssb.a libnssckfw.a
214 do
215   %{__install} -m 644 mozilla/dist/*.OBJ/lib/$file $RPM_BUILD_ROOT/%{_libdir}
216 done
217
218 # Copy the binaries we want
219 for file in certutil cmsutil crlutil modutil pk12util signtool signver ssltap
220 do
221   %{__install} -m 755 mozilla/dist/*.OBJ/bin/$file $RPM_BUILD_ROOT/%{_bindir}
222 done
223
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
227 do
228   %{__install} -m 755 mozilla/dist/*.OBJ/bin/$file $RPM_BUILD_ROOT/%{unsupported
229 _tools_directory}
230 done
231
232 # Copy the include files we want
233 for file in mozilla/dist/public/nss/*.h
234 do
235   %{__install} -m 644 $file $RPM_BUILD_ROOT/%{_includedir}/nss3
236 done
237
238
239 %clean
240 rm -rf $RPM_BUILD_ROOT
241
242
243 %files
244 %defattr(-,root,root)
245 %{_mingw32_bindir}/foo.dll
246 %{_mingw32_libdir}/foo.dll.a
247 # etc.
248
249
250 %changelog
251 * Wed Sep 24 2008 Your Name <you@example.com> - 1.2.3-1
252 - Initial RPM release.