summaryrefslogtreecommitdiffstats
path: root/contrib/crossrpms/mingw32/i686/i686-pc-mingw32-gmp.spec
blob: 3a417363b1033812563682c972f05c81a3bea780 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#
# Please send bugfixes or comments to
# 	http://www.rtems.org/bugzilla
#


%ifos cygwin cygwin32 mingw mingw32
%define _exeext .exe
%define debug_package           %{nil}
%define _libdir                 %{_exec_prefix}/lib
%else
%define _exeext %{nil}
%endif

%ifos cygwin cygwin32
%define optflags -O3 -pipe -march=i486 -funroll-loops
%endif

%ifos mingw mingw32
%if %{defined _mingw32_cflags}
%define optflags %{_mingw32_cflags}
%else
%define optflags -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -mms-bitfields
%endif
%endif

%if "%{_build}" != "%{_host}"
%define _host_rpmprefix %{_host}-
%else
%define _host_rpmprefix %{nil}
%endif

%define gmp_version 4.3.2
%define gmp_rpmvers %{expand:%(echo 4.3.2 | tr - _)} 
%define debug_package %{nil}

Name:         i686-pc-mingw32-gmp
Release:      0.20100319.1%{?dist}
License:      GPL
Group:        Development/Tools

BuildArch:	noarch
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

Version:      	%gmp_rpmvers
Summary:      	MinGW gmp Libraries

Source0:	ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmp_version}.tar.bz2

Provides:	i686-pc-mingw32-gmp-devel = %{version}-%{release}

%define _mingw32_target          i686-pc-mingw32

# Fedora ships a mingw toolchain installed to /usr
%define _mingw32_sysroot /usr/%{_mingw32_target}/sys-root

BuildRequires:  m4
BuildRequires:	i686-pc-mingw32-gcc

%description
MinGW gmp libraries.

%prep
%setup -c -q

%build
  %if "%{_prefix}" != "/usr"
    export PATH="%{_bindir}:${PATH}"
  %endif

  mkdir -p build

  cd build

  ../gmp-%{gmp_version}/configure \
    --prefix=%{_mingw32_sysroot}/mingw \
    --bindir=%{_bindir} \
    --exec_prefix=%{_mingw32_sysroot}/mingw \
    --includedir=%{_mingw32_sysroot}/mingw/include \
    --libdir=%{_mingw32_sysroot}/mingw/lib \
    --libexecdir=%{_mingw32_sysroot}/mingw/libexec \
    --mandir=%{_mingw32_sysroot}/mingw/share/man \
    --infodir=%{_mingw32_sysroot}/mingw/share/info \
    --datadir=%{_mingw32_sysroot}/mingw/share \
    --build=%_build --host=i686-pc-mingw32 \
    --enable-static \
    --disable-shared

  cd ..

%install
  rm -rf $RPM_BUILD_ROOT

  cd build

  make DESTDIR=$RPM_BUILD_ROOT install

  cd ..
# Extract %%__os_install_post into os_install_post~
cat << \EOF > os_install_post~
%__os_install_post
EOF

# Generate customized brp-*scripts
cat os_install_post~ | while read a x y; do
case $a in
# Prevent brp-strip* from trying to handle foreign binaries
*/brp-strip*)
  b=$(basename $a)
  sed -e 's,find $RPM_BUILD_ROOT,find $RPM_BUILD_ROOT%_bindir $RPM_BUILD_ROOT%_libexecdir,' $a > $b
  chmod a+x $b
  ;;
esac
done

sed -e 's,^[ ]*/usr/lib/rpm.*/brp-strip,./brp-strip,' \
< os_install_post~ > os_install_post 
%define __os_install_post . ./os_install_post


cat << EOF > %{_builddir}/%{name}-%{gmp_rpmvers}/find-provides
#!/bin/sh
grep -E -v '^${RPM_BUILD_ROOT}%{_exec_prefix}/i686-pc-mingw32/(lib|include|sys-root)' \
  %{?_gcclibdir:| grep -v '^${RPM_BUILD_ROOT}%{_gcclibdir}/gcc/i686-pc-mingw32/'} | %__find_provides
EOF
chmod +x %{_builddir}/%{name}-%{gmp_rpmvers}/find-provides
%define __find_provides %{_builddir}/%{name}-%{gmp_rpmvers}/find-provides

cat << EOF > %{_builddir}/%{name}-%{gmp_rpmvers}/find-requires
#!/bin/sh
grep -E -v '^${RPM_BUILD_ROOT}%{_exec_prefix}/i686-pc-mingw32/(lib|include|sys-root)' \
  %{?_gcclibdir:| grep -v '^${RPM_BUILD_ROOT}%{_gcclibdir}/gcc/i686-pc-mingw32/'} | %__find_requires
EOF
chmod +x %{_builddir}/%{name}-%{gmp_rpmvers}/find-requires
%define __find_requires %{_builddir}/%{name}-%{gmp_rpmvers}/find-requires

%ifnarch noarch
# Extract %%__debug_install_post into debug_install_post~
cat << \EOF > debug_install_post~
%__debug_install_post
EOF

# Generate customized debug_install_post script
cat debug_install_post~ | while read a x y; do
case $a in
# Prevent find-debuginfo.sh* from trying to handle foreign binaries
*/find-debuginfo.sh)
  b=$(basename $a)
  sed -e 's,find "$RPM_BUILD_ROOT" !,find "$RPM_BUILD_ROOT"%_bindir "$RPM_BUILD_ROOT"%_libexecdir !,' $a > $b
  chmod a+x $b
  ;;
esac
done

sed -e 's,^[ ]*/usr/lib/rpm/find-debuginfo.sh,./find-debuginfo.sh,' \
< debug_install_post~ > debug_install_post 
%define __debug_install_post . ./debug_install_post

%endif

%clean
  rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%{_mingw32_sysroot}/mingw
%exclude %{_mingw32_sysroot}/mingw/share/info/dir