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 the Netscape Portable Runtime (NSPR)
12 License: MPLv1.1 or GPLv2+ or LGPLv2+
13 Group: Development/Libraries
14 URL: http://www.mozilla.org/projects/nspr/
15 Source0: ftp://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v%{version}/src/nspr-%{version}.tar.gz
16 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
21 Source2: nspr-config-vars.in
23 Patch1: nspr-config-pc.patch
25 # MinGW-specific build patches.
26 #Patch1000: mingw32-nspr-4.7.2-build.patch
27 #Patch1001: nspr-configure-remove-crack.patch
29 BuildRequires: mingw32-filesystem >= 33
30 BuildRequires: mingw32-gcc
31 BuildRequires: mingw32-binutils
33 ## Ugh ugh ugh, multi-layered bug workaround:
34 ## (1) configure script tries to test if this is a cross-compiler
35 ## (2) it does this by running a test program
36 ## (3) if the test program doesn't run, it must be a cross-compiler
38 ## (4) WRONG! - wine is installed and runs the test program fine
39 ## (5) NSPR has an additional bug where it REQUIRES the test to fail
40 ## (ie. cross-compiler = no) otherwise it builds libnspr4.a instead
41 ## of libnspr4.dll.a (we don't know why this is)
42 ## (6) we cannot override this by setting $ac_* variables (why?)
43 #BuildRequires: /usr/bin/wine
45 BuildRequires: autoconf, automake
51 NSPR provides platform independence for non-GUI operating system
52 facilities. These facilities include threads, thread synchronization,
53 normal file and network I/O, interval timing and calendar time, basic
54 memory management (malloc and free) and shared library linking.
58 %setup -q -n nspr-%{version}
60 cp ./mozilla/nsprpub/config/nspr-config.in \
61 ./mozilla/nsprpub/config/nspr-config-pc.in
64 cp %{SOURCE2} ./mozilla/nsprpub/config/
66 #pushd mozilla/nsprpub
71 # Rebuild with a non-archaic autoconf.
72 #pushd mozilla/nsprpub
80 # Configure for Windows cross-compiling.
81 %{_mingw32_configure} \
82 --prefix=%{_mingw32_prefix} \
83 --libdir=%{_mingw32_libdir} \
84 --includedir=%{_mingw32_includedir}/nspr4 \
85 --enable-optimize="%{_mingw32_cflags}" \
87 --enable-win32-target=WINNT \
90 # NSPR comes with its own "special" install program called nsinstall.
91 # This must be built as a native program.
92 make -C config CC=gcc CFLAGS="-DXP_UNIX=1"
94 # Now build the rest using the "special" nsinstall.
96 NSINSTALL=$(pwd)/config/nsinstall \
97 RANLIB=i686-pc-mingw32-ranlib \
98 RC=i686-pc-mingw32-windres \
105 rm -rf $RPM_BUILD_ROOT
107 pushd mozilla/nsprpub
109 # 'make install' doesn't appear to work, so do it by hand.
110 mkdir -p $RPM_BUILD_ROOT%{_mingw32_bindir}
111 mkdir -p $RPM_BUILD_ROOT%{_mingw32_libdir}
112 mkdir -p $RPM_BUILD_ROOT%{_mingw32_includedir}
113 install dist/bin/*.dll $RPM_BUILD_ROOT%{_mingw32_bindir}
114 install dist/lib/*.a $RPM_BUILD_ROOT%{_mingw32_libdir}
115 cp -rL dist/include/nspr $RPM_BUILD_ROOT%{_mingw32_includedir}/
117 # Write an nspr pkgconfig file.
119 NSPR_LIBS=`./config/nspr-config --libs`
120 NSPR_CFLAGS=`./config/nspr-config --cflags`
121 NSPR_VERSION=`./config/nspr-config --version`
122 %{__mkdir_p} $RPM_BUILD_ROOT/%{_mingw32_libdir}/pkgconfig
124 cat ./config/nspr-config-vars > \
125 $RPM_BUILD_ROOT/%{_mingw32_libdir}/pkgconfig/nspr.pc
127 cat %{SOURCE1} | sed -e "s,%%libdir%%,%{_mingw32_libdir},g" \
128 -e "s,%%prefix%%,%{_mingw32_prefix},g" \
129 -e "s,%%exec_prefix%%,%{_mingw32_prefix},g" \
130 -e "s,%%includedir%%,%{_mingw32_includedir}/nspr4,g" \
131 -e "s,%%NSPR_VERSION%%,$NSPR_VERSION,g" \
132 -e "s,%%FULL_NSPR_LIBS%%,$NSPR_LIBS,g" \
133 -e "s,%%FULL_NSPR_CFLAGS%%,$NSPR_CFLAGS,g" >> \
134 $RPM_BUILD_ROOT/%{_mingw32_libdir}/pkgconfig/nspr.pc
140 rm -rf $RPM_BUILD_ROOT
144 %defattr(-,root,root)
145 %{_mingw32_bindir}/libnspr4.dll
146 %{_mingw32_bindir}/libplc4.dll
147 %{_mingw32_bindir}/libplds4.dll
148 %{_mingw32_libdir}/libnspr4.a
149 %{_mingw32_libdir}/libplc4.a
150 %{_mingw32_libdir}/libnspr4_s.a
151 %{_mingw32_libdir}/libplc4_s.a
152 %{_mingw32_libdir}/libplds4.a
153 %{_mingw32_libdir}/libplds4_s.a
154 %{_mingw32_libdir}/pkgconfig/nspr.pc
155 %{_mingw32_includedir}/nspr
159 * Wed Feb 18 2009 Richard W.M. Jones <rjones@redhat.com> - 4.7.2-5
160 - Fix build inside mock.
162 * Tue Feb 17 2009 Richard W.M. Jones <rjones@redhat.com> - 4.7.2-4
163 - 'cp -L' to install header files, not symlinks to header files.
165 * Tue Jan 13 2009 Richard W.M. Jones <rjones@redhat.com> - 4.7.2-3
166 - Requires pkgconfig.
168 * Mon Nov 10 2008 Richard W.M. Jones <rjones@redhat.com> - 4.7.2-2
169 - Initial RPM release.