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

4.104.114.9
Last change on this file since ee54f23 was ee54f23, checked in by Ralf Corsepius <ralf.corsepius@…>, on Oct 12, 2007 at 2:19:02 AM

gdb-6.7-2

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