source: rtems/contrib/crossrpms/rtems4.10/m32r/rtems-4.10-m32r-rtems4.10-gcc.spec @ 016c9ea

4.104.11
Last change on this file since 016c9ea was 016c9ea, checked in by Ralf Corsepius <ralf.corsepius@…>, on Aug 31, 2009 at 11:27:12 AM

Regenerate.

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