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

4.9
Last change on this file since 9852009 was 9852009, checked in by Ralf Corsepius <ralf.corsepius@…>, on Sep 10, 2008 at 7:43:40 PM

Regenerate.

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