Add broken version before removing patches.
[fedora-mingw.git] / nspr / mingw32-nspr.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-nspr
8 Version:        4.7.2
9 Release:        5%{?dist}
10 Summary:        MinGW Windows port of the Netscape Portable Runtime (NSPR)
11
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)
17
18 BuildArch:      noarch
19
20 Source1:        nspr.pc.in
21 Source2:        nspr-config-vars.in
22
23 Patch1:         nspr-config-pc.patch
24
25 # MinGW-specific build patches.
26 #Patch1000:      mingw32-nspr-4.7.2-build.patch
27 #Patch1001:      nspr-configure-remove-crack.patch
28
29 BuildRequires:  mingw32-filesystem >= 33
30 BuildRequires:  mingw32-gcc
31 BuildRequires:  mingw32-binutils
32
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
37 ##     ... right?
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
44
45 BuildRequires:  autoconf, automake
46
47 Requires:       pkgconfig
48
49
50 %description
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.
55
56
57 %prep
58 %setup -q -n nspr-%{version}
59
60 cp ./mozilla/nsprpub/config/nspr-config.in \
61    ./mozilla/nsprpub/config/nspr-config-pc.in
62 %patch1 -p0
63
64 cp %{SOURCE2} ./mozilla/nsprpub/config/
65
66 #pushd mozilla/nsprpub
67 #%patch1000 -p0
68 #popd
69 #%patch1001 -p0
70
71 # Rebuild with a non-archaic autoconf.
72 #pushd mozilla/nsprpub
73 #autoreconf
74 #popd
75
76
77 %build
78 pushd mozilla/nsprpub
79
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}" \
86   --disable-debug \
87   --enable-win32-target=WINNT \
88   --enable-64bit=no
89
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"
93
94 # Now build the rest using the "special" nsinstall.
95 make \
96   NSINSTALL=$(pwd)/config/nsinstall \
97   RANLIB=i686-pc-mingw32-ranlib \
98   RC=i686-pc-mingw32-windres \
99   %{?_smp_mflags}
100
101 popd
102
103
104 %install
105 rm -rf $RPM_BUILD_ROOT
106
107 pushd mozilla/nsprpub
108
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}/
116
117 # Write an nspr pkgconfig file.
118
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
123
124 cat ./config/nspr-config-vars > \
125                      $RPM_BUILD_ROOT/%{_mingw32_libdir}/pkgconfig/nspr.pc
126
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
135
136 popd
137
138
139 %clean
140 rm -rf $RPM_BUILD_ROOT
141
142
143 %files
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
156
157
158 %changelog
159 * Wed Feb 18 2009 Richard W.M. Jones <rjones@redhat.com> - 4.7.2-5
160 - Fix build inside mock.
161
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.
164
165 * Tue Jan 13 2009 Richard W.M. Jones <rjones@redhat.com> - 4.7.2-3
166 - Requires pkgconfig.
167
168 * Mon Nov 10 2008 Richard W.M. Jones <rjones@redhat.com> - 4.7.2-2
169 - Initial RPM release.