source: rtems/contrib/crossrpms/rtems4.9/avr/rtems-4.9-avr-rtems4.9-gcc.spec @ e2fe8948

4.104.114.9
Last change on this file since e2fe8948 was e2fe8948, checked in by Ralf Corsepius <ralf.corsepius@…>, on Mar 2, 2008 at 6:52:59 AM

Regenerate.

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