Name: mingw32-nspr
Version: 4.7.2
-Release: 4%{?dist}
+Release: 5%{?dist}
Summary: MinGW Windows port of the Netscape Portable Runtime (NSPR)
License: MPLv1.1 or GPLv2+ or LGPLv2+
Patch1: nspr-config-pc.patch
-# MinGW-specific build patch.
-Patch1000: mingw32-nspr-4.7.2-build.patch
+# MinGW-specific build patches.
+#Patch1000: mingw32-nspr-4.7.2-build.patch
+#Patch1001: nspr-configure-remove-crack.patch
BuildRequires: mingw32-filesystem >= 33
BuildRequires: mingw32-gcc
BuildRequires: mingw32-binutils
+## Ugh ugh ugh, multi-layered bug workaround:
+## (1) configure script tries to test if this is a cross-compiler
+## (2) it does this by running a test program
+## (3) if the test program doesn't run, it must be a cross-compiler
+## ... right?
+## (4) WRONG! - wine is installed and runs the test program fine
+## (5) NSPR has an additional bug where it REQUIRES the test to fail
+## (ie. cross-compiler = no) otherwise it builds libnspr4.a instead
+## of libnspr4.dll.a (we don't know why this is)
+## (6) we cannot override this by setting $ac_* variables (why?)
+#BuildRequires: /usr/bin/wine
+
+BuildRequires: autoconf, automake
+
Requires: pkgconfig
cp %{SOURCE2} ./mozilla/nsprpub/config/
-pushd mozilla/nsprpub
-%patch1000 -p0
-popd
+#pushd mozilla/nsprpub
+#%patch1000 -p0
+#popd
+#%patch1001 -p0
+
+# Rebuild with a non-archaic autoconf.
+#pushd mozilla/nsprpub
+#autoreconf
+#popd
%build
mkdir -p $RPM_BUILD_ROOT%{_mingw32_libdir}
mkdir -p $RPM_BUILD_ROOT%{_mingw32_includedir}
install dist/bin/*.dll $RPM_BUILD_ROOT%{_mingw32_bindir}
-install dist/lib/*.dll.a $RPM_BUILD_ROOT%{_mingw32_libdir}
+install dist/lib/*.a $RPM_BUILD_ROOT%{_mingw32_libdir}
cp -rL dist/include/nspr $RPM_BUILD_ROOT%{_mingw32_includedir}/
# Write an nspr pkgconfig file.
%{_mingw32_bindir}/libnspr4.dll
%{_mingw32_bindir}/libplc4.dll
%{_mingw32_bindir}/libplds4.dll
-%{_mingw32_libdir}/libnspr4.dll.a
-%{_mingw32_libdir}/libplc4.dll.a
+%{_mingw32_libdir}/libnspr4.a
+%{_mingw32_libdir}/libplc4.a
+%{_mingw32_libdir}/libnspr4_s.a
+%{_mingw32_libdir}/libplc4_s.a
+%{_mingw32_libdir}/libplds4.a
+%{_mingw32_libdir}/libplds4_s.a
%{_mingw32_libdir}/pkgconfig/nspr.pc
%{_mingw32_includedir}/nspr
%changelog
+* Wed Feb 18 2009 Richard W.M. Jones <rjones@redhat.com> - 4.7.2-5
+- Fix build inside mock.
+
* Tue Feb 17 2009 Richard W.M. Jones <rjones@redhat.com> - 4.7.2-4
- 'cp -L' to install header files, not symlinks to header files.
--- /dev/null
+Remove some of the more egregious crack in the configure.in script.
+
+--- mozilla/nsprpub/configure.in.orig 2009-02-18 13:12:46.000000000 +0000
++++ mozilla/nsprpub/configure.in 2009-02-18 13:39:28.000000000 +0000
+@@ -42,7 +42,7 @@
+ AC_PREREQ(2.12)
+ AC_INIT(config/libc_r.h)
+
+-AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
++AC_CONFIG_AUX_DIR(build/autoconf)
+ AC_CANONICAL_SYSTEM
+
+ dnl ========================================================
+@@ -427,7 +427,7 @@
+
+ AC_MSG_CHECKING([whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
+ AC_TRY_COMPILE([], [return(0);],
+- [ac_cv_prog_host_cc_works=1 AC_MSG_RESULT([yes])],
++ [ac_cv_prog_host_cc_works=1; AC_MSG_RESULT([yes])],
+ AC_MSG_ERROR([installation or configuration problem: $host compiler $HOST_CC cannot create executables.]) )
+
+ CC=$_SAVE_CC
+@@ -509,6 +509,11 @@
+ fi
+ rm -f a.out
+
++# RWMJ: Just force the above:
++GNU_CC=1
++GNU_CXX=1
++GNU_AS=1
++
+ case "$build:$target" in
+ i?86-apple-darwin*:powerpc-apple-darwin*)
+ dnl cross_compiling will have erroneously been set to "no" in this
+@@ -2212,9 +2217,11 @@
+ *-darwin*|*-beos*)
+ ;;
+ *)
+- AC_CHECK_LIB(dl, dlopen,
+- AC_CHECK_HEADER(dlfcn.h,
+- OS_LIBS="-ldl $OS_LIBS"))
++ AC_CHECK_LIB([dl], [dlopen], [have_dl=yes])
++ AC_CHECK_HEADER([dlfcn.h], [have_dlfcn=yes])
++ if test -n "$have_dl" -a -n "$have_dlfcn"; then
++ OS_LIBS="-ldl $OS_LIBS"
++ fi
+ ;;
+ esac
+