--- /dev/null
+# https://bugzilla.mozilla.org/show_bug.cgi?id=104541#c2
+
+#
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is the Netscape security libraries.
+#
+# The Initial Developer of the Original Code is
+# Netscape Communications Corporation.
+# Portions created by the Initial Developer are Copyright (C) 1994-2000
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+CC = i686-pc-mingw32-gcc
+CCC = i686-pc-mingw32-g++
+LINK = i686-pc-mingw32-ld
+AR = i686-pc-mingw32-ar
+AR += cr $@
+RANLIB = i686-pc-mingw32-ranlib
+BSDECHO = echo
+RC = i686-pc-mingw32-windres -O coff --use-temp-file
+LINK_DLL = $(CC) $(OS_DLLFLAGS) $(DLLFLAGS)
+
+XP_DEFINE += -DXP_PC
+LIB_SUFFIX = a
+DLL_SUFFIX = dll
+AR = ar cr $@
+LDOPTS += -L$(SOURCE_LIB_DIR)
+
+OPTIMIZER += -O
+DEFINES += -UDEBUG -DNDEBUG
+
+ifdef BUILD_TREE
+NSINSTALL_DIR = $(BUILD_TREE)/nss
+NSINSTALL = $(BUILD_TREE)/nss/nsinstall
+else
+NSINSTALL_DIR = $(CORE_DEPTH)/coreconf/nsinstall
+NSINSTALL = $(NSINSTALL_DIR)/$(OBJDIR_NAME)/nsinstall
+endif
+
+MKDEPEND_DIR = $(CORE_DEPTH)/coreconf/mkdepend
+MKDEPEND = $(MKDEPEND_DIR)/$(OBJDIR_NAME)/mkdepend
+MKDEPENDENCIES = $(OBJDIR_NAME)/depend.mk
+
+####################################################################
+#
+# One can define the makefile variable NSDISTMODE to control
+# how files are published to the 'dist' directory. If not
+# defined, the default is "install using relative symbolic
+# links". The two possible values are "copy", which copies files
+# but preserves source mtime, and "absolute_symlink", which
+# installs using absolute symbolic links.
+# - THIS IS NOT PART OF THE NEW BINARY RELEASE PLAN for 9/30/97
+# - WE'RE KEEPING IT ONLY FOR BACKWARDS COMPATIBILITY
+####################################################################
+
+ifeq ($(NSDISTMODE),copy)
+ # copy files, but preserve source mtime
+ INSTALL = $(NSINSTALL)
+ INSTALL += -t
+else
+ ifeq ($(NSDISTMODE),absolute_symlink)
+ # install using absolute symbolic links
+ INSTALL = $(NSINSTALL)
+ INSTALL += -L `pwd`
+ else
+ # install using relative symbolic links
+ INSTALL = $(NSINSTALL)
+ INSTALL += -R
+ endif
+endif
+
+define MAKE_OBJDIR
+if test ! -d $(@D); then rm -rf $(@D); $(NSINSTALL) -D $(@D); fi
+endef
+
+
+# Not for Windows yet.
+USE_PTHREADS =
+
+ifeq ($(USE_PTHREADS),1)
+ IMPL_STRATEGY = _PTH
+endif
+
+DEFAULT_COMPILER = i686-pc-mingw32-gcc
+
+CPU_ARCH = x86
+
+MKSHLIB = $(CC) -shared -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
+ifdef MAPFILE
+ MKSHLIB += -Wl,--version-script,$(MAPFILE)
+endif
+PROCESS_MAP_FILE = grep -v ';-' $< | \
+ sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@
+
+ifdef BUILD_OPT
+ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE))
+ OPTIMIZER = -Os
+else
+ OPTIMIZER = -O2
+endif
+endif
+
+ifeq ($(USE_PTHREADS),1)
+OS_PTHREAD = -lpthread
+endif
+
+OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) $(ARCHFLAG) -Wall -Wno-switch -pipe -mms-bitfields -D_WINDOWS
+OS_LIBS = $(OS_PTHREAD)
+
+ifdef USE_PTHREADS
+ DEFINES += -D_REENTRANT
+endif
+
+ARCH = linux
+
+DSO_CFLAGS =
+DSO_LDOPTS = -shared $(ARCHFLAG) -Wl,-z,defs
+DSO_LDFLAGS =
+LDFLAGS += $(ARCHFLAG)
+
+# INCLUDES += -I/usr/include -Y/usr/include/linux
+G++INCLUDES = -I/usr/i686-pc-mingw32/sys-root/mingw/include/g++
+
+#
+# Always set CPU_TAG on Linux, OpenVMS, WINCE.
+#
+CPU_TAG = _$(CPU_ARCH)
+
+USE_SYSTEM_ZLIB = 1
+ZLIB_LIBS = -lz
+
+
%define __find_requires %{_mingw32_findrequires}
%define __find_provides %{_mingw32_findprovides}
+# Version of NSPR that we depend on.
+%define nspr_version 4.7
+
+# Tests cause strange Wine failures ...
+%define run_tests 0
+
Name: mingw32-nss
Version: 3.12.2.0
-Release: 3%{?dist}
+Release: 4%{?dist}
Summary: MinGW Windows port of NSS (Network Security Services)
License: MPLv1.1 or GPLv2+ or LGPLv2+
Source8: nss-prelink.conf
Source12: nss-pem-20080124.tar.bz2
+Source1000: Cross.mk
+
+Patch1: nss-no-rpath.patch
+Patch2: nss-nolocalsql.patch
+Patch5: nss-pem-bug429175.patch
+Patch6: nss-enable-pem.patch
+
+Patch1000: nss-cross-compile.patch
+
BuildRequires: mingw32-filesystem >= 33
BuildRequires: mingw32-gcc
BuildRequires: mingw32-binutils
+
+BuildRequires: mingw32-nspr >= %{nspr_version}
BuildRequires: mingw32-sqlite
BuildRequires: mingw32-zlib
+
BuildRequires: pkgconfig
BuildRequires: perl
%patch5 -p0 -b .429175
%patch6 -p0 -b .libpem
+%patch1000 -p0
+
+# Notes on the naming:
+# (1) "2.6" is the Linux version number which is appended to the name
+# also by NSS Makefiles.
+# (2) OS_TARGET must be set to the basename (w/o 2.6).
+cp %{SOURCE1000} mozilla/security/coreconf/FedoraCross2.6.mk
+
%build
+# For cross-compilation, make sure pkg-config picks up the cross-compiled
+# packages only.
+PKG_CONFIG_LIBDIR="%{_mingw32_libdir}/pkgconfig"
+export PKG_CONFIG_LIBDIR
+
+NATIVE_CC=gcc
+export NATIVE_CC
+NATIVE_FLAGS="-DLINUX -Dlinux -D_POSIX_SOURCE -D_BSD_SOURCE -DHAVE_STRERROR"
+export NATIVE_FLAGS
+
+NS_USE_GCC=1
+export NS_USE_GCC
+
+OS_TARGET=FedoraCross
+export OS_TARGET
+
# Enable compiler optimizations and disable debugging code
BUILD_OPT=1
export BUILD_OPT
# Generate symbolic info for debuggers
-XCFLAGS=$RPM_OPT_FLAGS
+XCFLAGS="%{_mingw32_cflags}"
export XCFLAGS
export NSPR_INCLUDE_DIR=%{_mingw32_includedir}/nspr
-export NSPR_LIB_DIR=%{_mingw32_libdir}
-
-PKG_CONFIG_ALLOW_SYSTEM_LIBS=1
-PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1
-
-export PKG_CONFIG_ALLOW_SYSTEM_LIBS
-export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS
+export NSPR_LIB_DIR=%{_mingw32_bindir}
-NSPR_INCLUDE_DIR=`/usr/bin/pkg-config --cflags-only-I nspr | sed 's/-I//'`
-NSPR_LIB_DIR=`/usr/bin/pkg-config --libs-only-L nspr | sed 's/-L//'`
-
-export NSPR_INCLUDE_DIR
-export NSPR_LIB_DIR
-
-%ifarch x86_64 ppc64 ia64 s390x sparc64
-USE_64=1
-export USE_64
-%endif
+# Target is Win32 (32 bit):
+#%ifarch x86_64 ppc64 ia64 s390x sparc64
+#USE_64=1
+#export USE_64
+#%endif
# NSS_ENABLE_ECC=1
# export NSS_ENABLE_ECC
%{__make} -C ./mozilla/security/dbm
%{__make} -C ./mozilla/security/nss
-# Set up our package file
-%{__mkdir_p} $RPM_BUILD_ROOT/%{_libdir}/pkgconfig
-%{__cat} %{SOURCE1} | sed -e "s,%%libdir%%,%{_libdir},g" \
- -e "s,%%prefix%%,%{_prefix},g" \
- -e "s,%%exec_prefix%%,%{_prefix},g" \
- -e "s,%%includedir%%,%{_includedir}/nss3,g" \
- -e "s,%%NSPR_VERSION%%,%{nspr_version},g" \
- -e "s,%%NSS_VERSION%%,%{version},g" > \
- $RPM_BUILD_ROOT/%{_libdir}/pkgconfig/nss.pc
-NSS_VMAJOR=`cat mozilla/security/nss/lib/nss/nss.h | grep "#define.*NSS_VMAJOR"
-| awk '{print $3}'`
-NSS_VMINOR=`cat mozilla/security/nss/lib/nss/nss.h | grep "#define.*NSS_VMINOR"
-| awk '{print $3}'`
-NSS_VPATCH=`cat mozilla/security/nss/lib/nss/nss.h | grep "#define.*NSS_VPATCH"
-| awk '{print $3}'`
-
-export NSS_VMAJOR
-export NSS_VMINOR
-export NSS_VPATCH
-
-%{__mkdir_p} $RPM_BUILD_ROOT/%{_bindir}
-%{__cat} %{SOURCE2} | sed -e "s,@libdir@,%{_libdir},g" \
- -e "s,@prefix@,%{_prefix},g" \
- -e "s,@exec_prefix@,%{_prefix},g" \
- -e "s,@includedir@,%{_includedir}/nss3,g" \
- -e "s,@MOD_MAJOR_VERSION@,$NSS_VMAJOR,g" \
- -e "s,@MOD_MINOR_VERSION@,$NSS_VMINOR,g" \
- -e "s,@MOD_PATCH_VERSION@,$NSS_VPATCH,g" \
- > $RPM_BUILD_ROOT/%{_bindir}/nss-config
-
-chmod 755 $RPM_BUILD_ROOT/%{_bindir}/nss-config
# enable the following line to force a test failure
# find ./mozilla -name \*.chk | xargs rm -f
+%if %{run_tests}
# Run test suite.
# In order to support multiple concurrent executions of the test suite
# (caused by concurrent RPM builds) on a single host,
killall $RANDSERV || :
-TEST_FAILURES=`grep -c FAILED ./mozilla/tests_results/security/localhost.1/outpu
-t.log` || :
+TEST_FAILURES=`grep -c FAILED ./mozilla/tests_results/security/localhost.1/output.log` || :
if [ $TEST_FAILURES -ne 0 ]; then
echo "error: test suite returned failure(s)"
exit 1
fi
echo "test suite completed"
+%endif
%install
# There is no make install target so we'll do it ourselves.
-%{__mkdir_p} $RPM_BUILD_ROOT/%{_includedir}/nss3
-%{__mkdir_p} $RPM_BUILD_ROOT/%{_bindir}
-%{__mkdir_p} $RPM_BUILD_ROOT/%{_lib}
-%{__mkdir_p} $RPM_BUILD_ROOT/%{unsupported_tools_directory}
+%{__mkdir_p} $RPM_BUILD_ROOT/%{_mingw32_includedir}/nss3
+%{__mkdir_p} $RPM_BUILD_ROOT/%{_mingw32_bindir}
+%{__mkdir_p} $RPM_BUILD_ROOT/%{_mingw32_libdir}
+%{__mkdir_p} $RPM_BUILD_ROOT/%{_mingw32_libdir}/nss/unsupported-tools
+
+# Set up our package file
+%{__mkdir_p} $RPM_BUILD_ROOT/%{_mingw32_libdir}/pkgconfig
+%{__cat} %{SOURCE1} | sed -e "s,%%libdir%%,%{_mingw32_libdir},g" \
+ -e "s,%%prefix%%,%{_mingw32_prefix},g" \
+ -e "s,%%exec_prefix%%,%{_mingw32_prefix},g" \
+ -e "s,%%includedir%%,%{_mingw32_includedir}/nss3,g" \
+ -e "s,%%NSPR_VERSION%%,%{nspr_version},g" \
+ -e "s,%%NSS_VERSION%%,%{version},g" > \
+ $RPM_BUILD_ROOT/%{_mingw32_libdir}/pkgconfig/nss.pc
+NSS_VMAJOR=`cat mozilla/security/nss/lib/nss/nss.h | grep "#define.*NSS_VMAJOR" | awk '{print $3}'`
+NSS_VMINOR=`cat mozilla/security/nss/lib/nss/nss.h | grep "#define.*NSS_VMINOR" | awk '{print $3}'`
+NSS_VPATCH=`cat mozilla/security/nss/lib/nss/nss.h | grep "#define.*NSS_VPATCH" | awk '{print $3}'`
+
+export NSS_VMAJOR
+export NSS_VMINOR
+export NSS_VPATCH
+
+%{__mkdir_p} $RPM_BUILD_ROOT/%{_mingw32_bindir}
+%{__cat} %{SOURCE2} | sed -e "s,@libdir@,%{_mingw32_libdir},g" \
+ -e "s,@prefix@,%{_mingw32_prefix},g" \
+ -e "s,@exec_prefix@,%{_mingw32_prefix},g" \
+ -e "s,@includedir@,%{_mingw32_includedir}/nss3,g" \
+ -e "s,@MOD_MAJOR_VERSION@,$NSS_VMAJOR,g" \
+ -e "s,@MOD_MINOR_VERSION@,$NSS_VMINOR,g" \
+ -e "s,@MOD_PATCH_VERSION@,$NSS_VPATCH,g" \
+ > $RPM_BUILD_ROOT/%{_mingw32_bindir}/nss-config
+
+chmod 755 $RPM_BUILD_ROOT/%{_mingw32_bindir}/nss-config
# Copy the binary libraries we want
-for file in libsoftokn3.so libfreebl3.so libnss3.so libnssutil3.so \
- libssl3.so libsmime3.so libnssckbi.so libnsspem.so libnssdbm3.so
+for file in libsoftokn3.dll libfreebl3.dll libnss3.dll libnssutil3.dll \
+ libssl3.dll libsmime3.dll libnssckbi.dll libnsspem.dll libnssdbm3.dll
do
- %{__install} -m 755 mozilla/dist/*.OBJ/lib/$file $RPM_BUILD_ROOT/%{_lib}
- ln -sf ../../%{_lib}/$file $RPM_BUILD_ROOT/%{_libdir}/$file
+ %{__install} -m 755 mozilla/dist/*.OBJ/lib/$file $RPM_BUILD_ROOT/%{_mingw32_bindir}
done
# These ghost files will be generated in the post step
# Make sure chk files can be found in both places
-for file in libsoftokn3.chk libfreebl3.chk
-do
- touch $RPM_BUILD_ROOT/%{_lib}/$file
- ln -s ../../%{_lib}/$file $RPM_BUILD_ROOT/%{_libdir}/$file
-done
+#for file in libsoftokn3.chk libfreebl3.chk
+#do
+# touch $RPM_BUILD_ROOT/%{_lib}/$file
+# ln -s ../../%{_lib}/$file $RPM_BUILD_ROOT/%{_mingw32_libdir}/$file
+#done
# Install the empty NSS db files
-%{__mkdir_p} $RPM_BUILD_ROOT/%{_sysconfdir}/pki/nssdb
-%{__install} -m 644 %{SOURCE3} $RPM_BUILD_ROOT/%{_sysconfdir}/pki/nssdb/cert8.db
-%{__install} -m 644 %{SOURCE4} $RPM_BUILD_ROOT/%{_sysconfdir}/pki/nssdb/key3.db
-%{__install} -m 644 %{SOURCE5} $RPM_BUILD_ROOT/%{_sysconfdir}/pki/nssdb/secmod.d
-b
-%{__mkdir_p} $RPM_BUILD_ROOT/%{_sysconfdir}/prelink.conf.d
-%{__install} -m 644 %{SOURCE8} $RPM_BUILD_ROOT/%{_sysconfdir}/prelink.conf.d/nss
--prelink.conf
+%{__mkdir_p} $RPM_BUILD_ROOT/%{_mingw32_sysconfdir}/pki/nssdb
+%{__install} -m 644 %{SOURCE3} $RPM_BUILD_ROOT/%{_mingw32_sysconfdir}/pki/nssdb/cert8.db
+%{__install} -m 644 %{SOURCE4} $RPM_BUILD_ROOT/%{_mingw32_sysconfdir}/pki/nssdb/key3.db
+%{__install} -m 644 %{SOURCE5} $RPM_BUILD_ROOT/%{_mingw32_sysconfdir}/pki/nssdb/secmod.db
+%{__mkdir_p} $RPM_BUILD_ROOT/%{_mingw32_sysconfdir}/prelink.conf.d
+%{__install} -m 644 %{SOURCE8} $RPM_BUILD_ROOT/%{_mingw32_sysconfdir}/prelink.conf.d/nss-prelink.conf
# Copy the development libraries we want
for file in libcrmf.a libnssb.a libnssckfw.a
do
- %{__install} -m 644 mozilla/dist/*.OBJ/lib/$file $RPM_BUILD_ROOT/%{_libdir}
+ %{__install} -m 644 mozilla/dist/*.OBJ/lib/$file $RPM_BUILD_ROOT/%{_mingw32_libdir}
done
# Copy the binaries we want
for file in certutil cmsutil crlutil modutil pk12util signtool signver ssltap
do
- %{__install} -m 755 mozilla/dist/*.OBJ/bin/$file $RPM_BUILD_ROOT/%{_bindir}
+ %{__install} -m 755 mozilla/dist/*.OBJ/bin/$file $RPM_BUILD_ROOT/%{_mingw32_bindir}
done
# Copy the binaries we ship as unsupported
-for file in atob btoa derdump ocspclnt pp selfserv shlibsign strsclnt symkeyutil
- tstclnt vfyserv vfychain
+for file in atob btoa derdump ocspclnt pp selfserv shlibsign strsclnt symkeyutil tstclnt vfyserv vfychain
do
- %{__install} -m 755 mozilla/dist/*.OBJ/bin/$file $RPM_BUILD_ROOT/%{unsupported
-_tools_directory}
+ %{__install} -m 755 mozilla/dist/*.OBJ/bin/$file $RPM_BUILD_ROOT/%{_mingw32_libdir}/nss/unsupported-tools
done
# Copy the include files we want
for file in mozilla/dist/public/nss/*.h
do
- %{__install} -m 644 $file $RPM_BUILD_ROOT/%{_includedir}/nss3
+ %{__install} -m 644 $file $RPM_BUILD_ROOT/%{_mingw32_includedir}/nss3
done
%files
%defattr(-,root,root)
-%doc XXX
-%{_mingw32_bindir}/foo.dll
-%{_mingw32_libdir}/foo.dll.a
-# etc.
+%{_mingw32_bindir}/nss-config
+%{_mingw32_bindir}/certutil
+%{_mingw32_bindir}/cmsutil
+%{_mingw32_bindir}/crlutil
+%{_mingw32_bindir}/modutil
+%{_mingw32_bindir}/pk12util
+%{_mingw32_bindir}/signtool
+%{_mingw32_bindir}/signver
+%{_mingw32_bindir}/ssltap
+%{_mingw32_bindir}/libsoftokn3.dll
+%{_mingw32_bindir}/libfreebl3.dll
+%{_mingw32_bindir}/libnss3.dll
+%{_mingw32_bindir}/libnssutil3.dll
+%{_mingw32_bindir}/libssl3.dll
+%{_mingw32_bindir}/libsmime3.dll
+%{_mingw32_bindir}/libnssckbi.dll
+%{_mingw32_bindir}/libnsspem.dll
+%{_mingw32_bindir}/libnssdbm3.dll
+%{_mingw32_sysconfdir}/pki/nssdb/cert8.db
+%{_mingw32_sysconfdir}/pki/nssdb/key3.db
+%{_mingw32_sysconfdir}/pki/nssdb/secmod.db
+%{_mingw32_sysconfdir}/prelink.conf.d/nss-prelink.conf
+%{_mingw32_includedir}/nss3/
+%{_mingw32_libdir}/libcrmf.a
+%{_mingw32_libdir}/libnssb.a
+%{_mingw32_libdir}/libnssckfw.a
+%{_mingw32_libdir}/nss/unsupported-tools/atob
+%{_mingw32_libdir}/nss/unsupported-tools/btoa
+%{_mingw32_libdir}/nss/unsupported-tools/derdump
+%{_mingw32_libdir}/nss/unsupported-tools/ocspclnt
+%{_mingw32_libdir}/nss/unsupported-tools/pp
+%{_mingw32_libdir}/nss/unsupported-tools/selfserv
+%{_mingw32_libdir}/nss/unsupported-tools/shlibsign
+%{_mingw32_libdir}/nss/unsupported-tools/strsclnt
+%{_mingw32_libdir}/nss/unsupported-tools/symkeyutil
+%{_mingw32_libdir}/nss/unsupported-tools/tstclnt
+%{_mingw32_libdir}/nss/unsupported-tools/vfychain
+%{_mingw32_libdir}/nss/unsupported-tools/vfyserv
+%{_mingw32_libdir}/pkgconfig/nss.pc
%changelog
+* Tue Feb 17 2009 Richard W.M. Jones <rjones@redhat.com> - 3.12.2.0-4
+- Now builds.
+
* Fri Feb 6 2009 Richard W.M. Jones <rjones@redhat.com> - 3.12.2.0-3
- Include license file.