source: rtems/contrib/crossrpms/cygwin/i686/i686-pc-cygwin-gcc.spec @ facca98

4.104.11
Last change on this file since facca98 was facca98, checked in by Ralf Corsepius <ralf.corsepius@…>, on May 7, 2009 at 2:40:22 PM

New.

  • Property mode set to 100644
File size: 12.8 KB
Line 
1#
2# Please send bugfixes or comments to
3#       http://www.rtems.org/bugzilla
4#
5
6
7%ifos cygwin cygwin32 mingw mingw32
8%define _exeext .exe
9%define debug_package           %{nil}
10%define _libdir                 %{_exec_prefix}/lib
11%else
12%define _exeext %{nil}
13%endif
14
15%ifos cygwin cygwin32
16%define optflags -O3 -pipe -march=i486 -funroll-loops
17%endif
18
19%ifos mingw mingw32
20%if %{defined _mingw32_cflags}
21%define optflags %{_mingw32_cflags}
22%else
23%define optflags -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -mms-bitfields
24%endif
25%endif
26
27%if "%{_build}" != "%{_host}"
28%define _host_rpmprefix %{_host}-
29%else
30%define _host_rpmprefix %{nil}
31%endif
32
33
34%define gcc_pkgvers 3.4.4
35%define gcc_version 3.4.4
36%define gcc_rpmvers %{expand:%(echo "3.4.4" | tr - _ )}
37
38
39Name:           i686-pc-cygwin-gcc
40Summary:        i686-pc-cygwin gcc
41
42Group:          Development/Tools
43Version:        %{gcc_rpmvers}
44Release:        0.20090506.1%{?dist}
45License:        GPL
46URL:            http://gcc.gnu.org
47BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
48
49%define _use_internal_dependency_generator 0
50
51BuildRequires:  %{_host_rpmprefix}gcc
52
53%if "%{gcc_version}" >= "4.3.0"
54%define _gmp_minvers            4.1
55%else
56%if "%{gcc_version}" >= "4.2.0"
57%endif
58%endif
59
60%if %{defined _gmp_minvers}
61BuildRequires: gmp-devel >= %{_gmp_minvers}
62%if "%{_build}" != "%{_host}"
63BuildRequires:  %{_host_rpmprefix}gmp-devel >= %{_gmp_minvers}
64%endif
65%endif
66
67
68%if "%{gcc_version}" >= "4.4.0"
69%define _mpfr_minvers   2.3.2
70%define mpfr_version    2.4.1
71%else
72%if "%{gcc_version}" >= "4.3.0"
73%define _mpfr_minvers   2.3.1
74%define mpfr_version    2.3.2
75%else
76%if "%{gcc_version}" >= "4.2.0"
77%endif
78%endif
79%endif
80
81%if %{defined _mpfr_minvers}
82# FIXME: This is an ugly cludge
83%{?fc9:%global mpfr_provided 2.3.1}
84%{?fc10:%global mpfr_provided 2.3.2}
85%{?fc11:%global mpfr_provided 2.4.1}
86%{?suse10_3:%global mpfr_provided 2.2.1}
87%{?cygwin:%global mpfr_provided 2.4.1}
88%{?mingw32:%global mpfr_provided %{nil}}
89
90%if %{defined mpfr_provided}
91%if "%{mpfr_provided}" < "%{_mpfr_minvers}"
92%define _build_mpfr 1
93%else
94%if "%{_build}" != "%{_host}"
95BuildRequires:  %{_host_rpmprefix}mpfr-devel >= %{_mpfr_minvers}
96%else
97BuildRequires: mpfr-devel >= %{_mpfr_minvers}
98%endif
99%endif
100%else
101%define _build_mpfr 1
102%endif
103
104%endif
105
106%if "%{_build}" != "%{_host}"
107BuildRequires:  i686-pc-cygwin-gcc = %{gcc_rpmvers}
108%endif
109
110%if "%{gcc_version}" >= "4.2.0"
111BuildRequires:  flex bison
112%endif
113
114
115BuildRequires:  texinfo >= 4.2
116BuildRequires:  i686-pc-cygwin-binutils
117BuildRequires:  i686-pc-cygwin-sys-root
118
119Requires:       i686-pc-cygwin-binutils
120Requires:       i686-pc-cygwin-sys-root
121Requires:       i686-pc-cygwin-w32api
122
123
124%if "%{gcc_version}" >= "3.4"
125%define gcclib %{_libdir}/gcc
126%define gccexec %{_libexecdir}/gcc
127%else
128%define gcclib %{_libdir}/gcc-lib
129%define gccexec %{_libdir}/gcc-lib
130%endif
131
132Source0:        ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-core-%{gcc_pkgvers}.tar.bz2
133%{?_without_sources:NoSource:   0}
134
135Source1:        ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-g++-%{gcc_pkgvers}.tar.bz2
136%{?_without_sources:NoSource:   1}
137
138
139# Cygwin patch from
140# ftp://cygwin.com/pub/cygwin/release/gcc/gcc-core/gcc-core-3.4.4-3-src.tar.bz2
141Source70: gcc-3.4.4-3.patch
142
143
144%if "%{gcc_version}" >= "4.3.0"
145Source60:    http://www.mpfr.org/mpfr-current/mpfr-%{mpfr_version}.tar.bz2
146%endif
147
148%description
149Cross gcc for i686-pc-cygwin.
150
151%prep
152%setup -c -T -n %{name}-%{version}
153
154%setup -q -T -D -n %{name}-%{version} -a0
155%{?PATCH0:%patch0 -p0}
156
157%setup -q -T -D -n %{name}-%{version} -a1
158%{?PATCH1:%patch1 -p0}
159
160
161
162
163
164
165%if 0%{?_build_mpfr}
166%setup -q -T -D -n %{name}-%{version} -a60
167%{?PATCH60:%patch60 -p1}
168  # Build mpfr one-tree style
169  ln -s ../mpfr-%{mpfr_version} gcc-%{gcc_pkgvers}/mpfr
170%endif
171
172# cygwin patches can't be directly applied through rpm
173cd gcc-%{gcc_pkgvers}
174patch -p1 -t < %{SOURCE70} || true
175cd ..
176
177  # Fix timestamps
178  cd gcc-%{gcc_pkgvers}
179  contrib/gcc_update --touch
180  cd ..
181%build
182  mkdir -p build
183
184  cd build
185
186  languages="c"
187  languages="$languages,c++"
188%if "%{_build}" != "%{_host}"
189  CFLAGS_FOR_BUILD="-g -O2 -Wall" \
190  CC="%{_host}-gcc ${RPM_OPT_FLAGS}" \
191%else
192# gcc is not ready to be compiled with -std=gnu99
193  CC=$(echo "%{__cc} ${RPM_OPT_FLAGS}" | sed -e 's,-std=gnu99 ,,') \
194%endif
195  ../gcc-%{gcc_pkgvers}/configure \
196    --prefix=%{_prefix} \
197    --bindir=%{_bindir} \
198    --exec_prefix=%{_exec_prefix} \
199    --includedir=%{_includedir} \
200    --libdir=%{_libdir} \
201    --libexecdir=%{_libexecdir} \
202    --mandir=%{_mandir} \
203    --infodir=%{_infodir} \
204    --datadir=%{_datadir} \
205    --build=%_build --host=%_host \
206    --target=i686-pc-cygwin \
207    --disable-libstdcxx-pch \
208    --with-gnu-as --with-gnu-ld --verbose \
209    --with-newlib \
210    --with-system-zlib \
211    --disable-nls --without-included-gettext \
212    --disable-win32-registry \
213    --enable-version-specific-runtime-libs \
214    --enable-threads \
215    --with-sysroot=%{_exec_prefix}/i686-pc-cygwin/sys-root \
216    --enable-languages="$languages" $optargs
217
218%if "%_host" != "%_build"
219  # Bug in gcc-3.2.1:
220  # Somehow, gcc doesn't get syslimits.h right for Cdn-Xs
221  mkdir -p gcc/include
222  cp ../gcc-%{gcc_pkgvers}/gcc/gsyslimits.h gcc/include/syslimits.h
223%endif
224
225  make %{?_smp_mflags} all
226  cd ..
227
228%install
229  rm -rf $RPM_BUILD_ROOT
230
231  cd build
232
233  make DESTDIR=$RPM_BUILD_ROOT install
234  cd ..
235
236
237%if "%{gcc_version}" <= "4.1.2"
238# Misplaced header file
239  if test -f $RPM_BUILD_ROOT%{_includedir}/mf-runtime.h; then
240    mv $RPM_BUILD_ROOT%{_includedir}/mf-runtime.h \
241      $RPM_BUILD_ROOT%{gcclib}/i686-pc-cygwin/%{gcc_version}/include/
242  fi
243%endif
244
245  # host library
246  rm -f  ${RPM_BUILD_ROOT}%{_libdir}/libiberty.a
247
248  # We use the version from binutils
249  rm -f $RPM_BUILD_ROOT%{_bindir}/i686-pc-cygwin-c++filt%{_exeext}
250
251
252# Conflict with a native GCC's infos
253  rm -rf $RPM_BUILD_ROOT%{_infodir}
254
255# Conflict with a native GCC's man pages
256  rm -rf $RPM_BUILD_ROOT%{_mandir}/man7
257
258
259%if "%{gcc_version}" >= "3.4"
260  # Bug in gcc-3.4.0pre
261  rm -f $RPM_BUILD_ROOT%{_bindir}/i686-pc-cygwin-i686-pc-cygwin-gcjh%{_exeext}
262%endif
263
264%if "%{gcc_version}" >= "3.3"
265  # Bug in gcc-3.3.x/gcc-3.4.x: Despite we don't need fixincludes, it installs
266  # the fixinclude-install-tools
267  rm -rf ${RPM_BUILD_ROOT}%{gcclib}/i686-pc-cygwin/%{gcc_version}/install-tools
268  rm -rf ${RPM_BUILD_ROOT}%{gccexec}/i686-pc-cygwin/%{gcc_version}/install-tools
269%endif
270
271  # Bug in gcc > 4.1.0: Installs an unused, empty directory
272  if test -d ${RPM_BUILD_ROOT}%{_prefix}/i686-pc-cygwin/include/bits; then
273    rmdir ${RPM_BUILD_ROOT}%{_prefix}/i686-pc-cygwin/include/bits
274  fi
275
276  # Collect multilib subdirectories
277  f=`build/gcc/xgcc -Bbuild/gcc/ --print-multi-lib | sed -e 's,;.*$,,'`
278
279
280  rm -f dirs ;
281  echo "%defattr(-,root,root,-)" >> dirs
282  echo "%dir %{gcclib}" >> dirs
283  echo "%dir %{gcclib}/i686-pc-cygwin" >> dirs
284
285  TGTDIR="%{gcclib}/i686-pc-cygwin/%{gcc_version}"
286  for i in $f; do
287    case $i in
288    \.) echo "%dir ${TGTDIR}" >> dirs
289      ;;
290    *)  echo "%dir ${TGTDIR}/$i" >> dirs
291      ;;
292    esac
293  done
294
295  # Collect files to go into different packages
296  cp dirs build/files.gcc
297  cp dirs build/files.g77
298  cp dirs build/files.gfortran
299  cp dirs build/files.objc
300  cp dirs build/files.gcj
301  cp dirs build/files.g++
302
303  TGTDIR="%{gcclib}/i686-pc-cygwin/%{gcc_version}"
304  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
305  for i in $f; do
306    case $i in
307    *lib*.la) rm ${RPM_BUILD_ROOT}/$i ;; # ignore: gcc produces bogus libtool libs
308    *f771) ;;
309    *f951) ;;
310    *cc1) ;;
311    *cc1obj) ;;
312    *cc1plus) ;; # ignore: explicitly put into rpm elsewhere
313    *collect2) ;;
314    *libobjc*) echo "$i" >> build/files.objc ;;
315    *include/objc*) ;;
316    *include/g++*);;
317    *include/c++*);;
318    *adainclude*);;
319    *adalib*);;
320    *gnat1);;
321    *jc1) ;;
322    *jvgenmain) ;;
323    */libgfortran*.*) echo "$i" >> build/files.gfortran ;;
324    */libstdc++.*) echo "$i" >> build/files.g++ ;;
325    */libsupc++.*) echo "$i" >> build/files.g++ ;;
326    *) echo "$i" >> build/files.gcc ;;
327    esac
328  done
329
330  TGTDIR="%{_exec_prefix}/i686-pc-cygwin/lib"
331  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
332  for i in $f; do
333    case $i in
334    *lib*.la) rm ${RPM_BUILD_ROOT}/$i;; # ignore - gcc produces bogus libtool libs
335    *libiberty.a) rm ${RPM_BUILD_ROOT}/$i ;; # ignore - GPL'ed
336# all other files belong to newlib
337    *) echo "$i" >> build/files.newlib ;;
338    esac
339  done
340# Extract %%__os_install_post into os_install_post~
341cat << \EOF > os_install_post~
342%__os_install_post
343EOF
344
345# Generate customized brp-*scripts
346cat os_install_post~ | while read a x y; do
347case $a in
348# Prevent brp-strip* from trying to handle foreign binaries
349*/brp-strip*)
350  b=$(basename $a)
351  sed -e 's,find $RPM_BUILD_ROOT,find $RPM_BUILD_ROOT%_bindir $RPM_BUILD_ROOT%_libexecdir,' $a > $b
352  chmod a+x $b
353  ;;
354esac
355done
356
357sed -e 's,^[ ]*/usr/lib/rpm.*/brp-strip,./brp-strip,' \
358< os_install_post~ > os_install_post
359%define __os_install_post . ./os_install_post
360
361
362cat << EOF > %{_builddir}/%{name}-%{gcc_rpmvers}/find-provides
363#!/bin/sh
364grep -E -v '^${RPM_BUILD_ROOT}%{_exec_prefix}/i686-pc-cygwin/(lib|include|sys-root)' \
365  | grep -v '^${RPM_BUILD_ROOT}%{gcclib}/i686-pc-cygwin/' | %__find_provides
366EOF
367chmod +x %{_builddir}/%{name}-%{gcc_rpmvers}/find-provides
368%define __find_provides %{_builddir}/%{name}-%{gcc_rpmvers}/find-provides
369
370cat << EOF > %{_builddir}/%{name}-%{gcc_rpmvers}/find-requires
371#!/bin/sh
372grep -E -v '^${RPM_BUILD_ROOT}%{_exec_prefix}/i686-pc-cygwin/(lib|include|sys-root)' \
373  | grep -v '^${RPM_BUILD_ROOT}%{gcclib}/i686-pc-cygwin/' | %__find_requires
374EOF
375chmod +x %{_builddir}/%{name}-%{gcc_rpmvers}/find-requires
376%define __find_requires %{_builddir}/%{name}-%{gcc_rpmvers}/find-requires
377
378%ifnarch noarch
379# Extract %%__debug_install_post into debug_install_post~
380cat << \EOF > debug_install_post~
381%__debug_install_post
382EOF
383
384# Generate customized debug_install_post script
385cat debug_install_post~ | while read a x y; do
386case $a in
387# Prevent find-debuginfo.sh* from trying to handle foreign binaries
388*/find-debuginfo.sh)
389  b=$(basename $a)
390  sed -e 's,find "$RPM_BUILD_ROOT" !,find "$RPM_BUILD_ROOT"%_bindir "$RPM_BUILD_ROOT"%_libexecdir !,' $a > $b
391  chmod a+x $b
392  ;;
393esac
394done
395
396sed -e 's,^[ ]*/usr/lib/rpm/find-debuginfo.sh,./find-debuginfo.sh,' \
397< debug_install_post~ > debug_install_post
398%define __debug_install_post . ./debug_install_post
399
400%endif
401
402%clean
403  rm -rf $RPM_BUILD_ROOT
404
405# ==============================================================
406# i686-pc-cygwin-gcc
407# ==============================================================
408# %package -n i686-pc-cygwin-gcc
409# Summary:        GNU cc compiler for i686-pc-cygwin
410# Group:          Development/Tools
411# Version:        %{gcc_rpmvers}
412# Requires:       i686-pc-cygwin-binutils
413# Requires:       i686-pc-cygwin-newlib = %{newlib_version}-@NEWLIB_RPMREL@
414# License:      GPL
415
416# %if %build_infos
417# Requires:      gcc-common
418# %endif
419
420%description -n i686-pc-cygwin-gcc
421GNU cc compiler for i686-pc-cygwin.
422
423%files -n i686-pc-cygwin-gcc -f build/files.gcc
424%defattr(-,root,root)
425%{_mandir}/man1/i686-pc-cygwin-gcc.1*
426%if "%{gcc_version}" >= "3.4"
427%{_mandir}/man1/i686-pc-cygwin-cpp.1*
428%{_mandir}/man1/i686-pc-cygwin-gcov.1*
429%endif
430
431%{_bindir}/i686-pc-cygwin-cpp%{_exeext}
432%{_bindir}/i686-pc-cygwin-gcc%{_exeext}
433%if "%{gcc_version}" >= "3.3"
434%{_bindir}/i686-pc-cygwin-gcc-%{gcc_version}%{_exeext}
435%endif
436%{_bindir}/i686-pc-cygwin-gcov%{_exeext}
437%{_bindir}/i686-pc-cygwin-gccbug
438
439%dir %{gcclib}/i686-pc-cygwin/%{gcc_version}/include
440%if "%{gcc_version}" > "4.0.3"
441%if "i686-pc-cygwin" != "bfin-rtems4.10"
442%if "i686-pc-cygwin" != "avr-rtems4.10"
443%dir %{gcclib}/i686-pc-cygwin/%{gcc_version}/include/ssp
444%endif
445%endif
446%endif
447
448%if "%{gcc_version}" >= "4.3.0"
449%dir %{gcclib}/i686-pc-cygwin/%{gcc_version}/include-fixed
450%endif
451
452%dir %{gccexec}
453%dir %{gccexec}/i686-pc-cygwin
454%dir %{gccexec}/i686-pc-cygwin/%{gcc_version}
455%{gccexec}/i686-pc-cygwin/%{gcc_version}/cc1%{_exeext}
456%{gccexec}/i686-pc-cygwin/%{gcc_version}/collect2%{_exeext}
457
458# ==============================================================
459# i686-pc-cygwin-gcc-c++
460# ==============================================================
461%package -n i686-pc-cygwin-gcc-c++
462Summary:        GCC c++ compiler for i686-pc-cygwin
463Group:          Development/Tools
464Version:        %{gcc_rpmvers}
465License:        GPL
466
467%if "%{_build}" != "%{_host}"
468BuildRequires:  i686-pc-cygwin-gcc-c++ = %{gcc_rpmvers}
469%endif
470Provides:       i686-pc-cygwin-c++ = %{gcc_rpmvers}-%{release}
471Obsoletes:      i686-pc-cygwin-c++ < %{gcc_rpmvers}-%{release}
472
473Requires:       i686-pc-cygwin-gcc = %{gcc_rpmvers}-%{release}
474
475%description -n i686-pc-cygwin-gcc-c++
476GCC c++ compiler for i686-pc-cygwin.
477
478%files -n i686-pc-cygwin-gcc-c++ -f build/files.g++
479%defattr(-,root,root)
480%{_mandir}/man1/i686-pc-cygwin-g++.1*
481
482%{_bindir}/i686-pc-cygwin-c++%{_exeext}
483%{_bindir}/i686-pc-cygwin-g++%{_exeext}
484
485%dir %{gccexec}
486%dir %{gccexec}/i686-pc-cygwin
487%dir %{gccexec}/i686-pc-cygwin/%{gcc_version}
488%{gccexec}/i686-pc-cygwin/%{gcc_version}/cc1plus%{_exeext}
489
490%dir %{gcclib}/i686-pc-cygwin/%{gcc_version}/include
491%{gcclib}/i686-pc-cygwin/%{gcc_version}/include/c++
492
493
494
Note: See TracBrowser for help on using the repository browser.