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

4.104.114.9
Last change on this file since c6b590d was c6b590d, checked in by Ralf Corsepius <ralf.corsepius@…>, on Nov 9, 2007 at 5:10:18 PM

Regenerate.

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