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

4.104.114.9
Last change on this file since 3c7a743 was 3c7a743, checked in by Ralf Corsepius <ralf.corsepius@…>, on Feb 27, 2008 at 9:09:49 AM

Upgrade to gcc-4.3.0-RC-20080222.

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