smock: use $basearch in smock.mock.extra
[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:        7%{?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 BuildRequires:  mingw32-filesystem >= 33
26 BuildRequires:  mingw32-gcc
27 BuildRequires:  mingw32-binutils
28
29 Requires:       pkgconfig
30
31
32 %description
33 NSPR provides platform independence for non-GUI operating system
34 facilities. These facilities include threads, thread synchronization,
35 normal file and network I/O, interval timing and calendar time, basic
36 memory management (malloc and free) and shared library linking.
37
38
39 %prep
40 %setup -q -n nspr-%{version}
41
42 cp ./mozilla/nsprpub/config/nspr-config.in \
43    ./mozilla/nsprpub/config/nspr-config-pc.in
44 %patch1 -p0
45
46 cp %{SOURCE2} ./mozilla/nsprpub/config/
47
48
49 %build
50 pushd mozilla/nsprpub
51
52 # Configure for Windows cross-compiling.
53 %{_mingw32_configure} \
54   --includedir=%{_mingw32_includedir}/nspr4 \
55   --enable-optimize="%{_mingw32_cflags}" \
56   --disable-debug \
57   --enable-win32-target=WINNT \
58   --enable-64bit=no
59
60 # NSPR comes with its own "special" install program called nsinstall.
61 # This must be built as a native program.
62 make -C config CC=gcc CFLAGS="-DXP_UNIX=1"
63
64 # Now build the rest using the "special" nsinstall.
65 make \
66   NSINSTALL=$(pwd)/config/nsinstall \
67   RANLIB=i686-pc-mingw32-ranlib \
68   RC=i686-pc-mingw32-windres \
69   %{?_smp_mflags}
70
71 popd
72
73
74 %install
75 rm -rf $RPM_BUILD_ROOT
76
77 pushd mozilla/nsprpub
78
79 # 'make install' doesn't appear to work, so do it by hand.
80 mkdir -p $RPM_BUILD_ROOT%{_mingw32_bindir}
81 mkdir -p $RPM_BUILD_ROOT%{_mingw32_libdir}
82 mkdir -p $RPM_BUILD_ROOT%{_mingw32_includedir}
83 install dist/bin/*.dll $RPM_BUILD_ROOT%{_mingw32_bindir}
84 install dist/lib/*.a $RPM_BUILD_ROOT%{_mingw32_libdir}
85 cp -rL dist/include/nspr $RPM_BUILD_ROOT%{_mingw32_includedir}/
86
87 # Write an nspr pkgconfig file.
88
89 NSPR_LIBS=`./config/nspr-config --libs`
90 NSPR_CFLAGS=`./config/nspr-config --cflags`
91 NSPR_VERSION=`./config/nspr-config --version`
92 %{__mkdir_p} $RPM_BUILD_ROOT/%{_mingw32_libdir}/pkgconfig
93
94 cat ./config/nspr-config-vars > \
95                      $RPM_BUILD_ROOT/%{_mingw32_libdir}/pkgconfig/nspr.pc
96
97 cat %{SOURCE1} | sed -e "s,%%libdir%%,%{_mingw32_libdir},g" \
98                      -e "s,%%prefix%%,%{_mingw32_prefix},g" \
99                      -e "s,%%exec_prefix%%,%{_mingw32_prefix},g" \
100                      -e "s,%%includedir%%,%{_mingw32_includedir}/nspr4,g" \
101                      -e "s,%%NSPR_VERSION%%,$NSPR_VERSION,g" \
102                      -e "s,%%FULL_NSPR_LIBS%%,$NSPR_LIBS,g" \
103                      -e "s,%%FULL_NSPR_CFLAGS%%,$NSPR_CFLAGS,g" >> \
104                      $RPM_BUILD_ROOT/%{_mingw32_libdir}/pkgconfig/nspr.pc
105
106 popd
107
108
109 %clean
110 rm -rf $RPM_BUILD_ROOT
111
112
113 %files
114 %defattr(-,root,root)
115 %{_mingw32_bindir}/libnspr4.dll
116 %{_mingw32_bindir}/libplc4.dll
117 %{_mingw32_bindir}/libplds4.dll
118 %{_mingw32_libdir}/libnspr4.a
119 %{_mingw32_libdir}/libplc4.a
120 %{_mingw32_libdir}/libnspr4_s.a
121 %{_mingw32_libdir}/libplc4_s.a
122 %{_mingw32_libdir}/libplds4.a
123 %{_mingw32_libdir}/libplds4_s.a
124 %{_mingw32_libdir}/pkgconfig/nspr.pc
125 %{_mingw32_includedir}/nspr
126
127
128 %changelog
129 * Fri Feb 20 2009 Richard W.M. Jones <rjones@redhat.com> - 4.7.2-7
130 - Rebuild for mingw32-gcc 4.4
131
132 * Wed Feb 18 2009 Richard W.M. Jones <rjones@redhat.com> - 4.7.2-6
133 - Fix build inside mock.
134
135 * Tue Feb 17 2009 Richard W.M. Jones <rjones@redhat.com> - 4.7.2-4
136 - 'cp -L' to install header files, not symlinks to header files.
137
138 * Tue Jan 13 2009 Richard W.M. Jones <rjones@redhat.com> - 4.7.2-3
139 - Requires pkgconfig.
140
141 * Mon Nov 10 2008 Richard W.M. Jones <rjones@redhat.com> - 4.7.2-2
142 - Initial RPM release.