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

4.104.114.9
Last change on this file since 211c22eb was 211c22eb, checked in by Ralf Corsepius <ralf.corsepius@…>, on Mar 14, 2008 at 3:34:59 PM

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