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

4.104.114.9
Last change on this file since 9589c665 was 9589c665, checked in by Ralf Corsepius <ralf.corsepius@…>, on Sep 3, 2008 at 10:48:11 PM

Regenerate.

  • Property mode set to 100644
File size: 15.2 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-languages="$languages" $optargs
191
192%if "%_host" != "%_build"
193  # Bug in gcc-3.2.1:
194  # Somehow, gcc doesn't get syslimits.h right for Cdn-Xs
195  mkdir -p gcc/include
196  cp ../gcc-%{gcc_pkgvers}/gcc/gsyslimits.h gcc/include/syslimits.h
197%endif
198
199  make %{?_smp_mflags} all
200  make info
201  cd ..
202
203%install
204  export PATH="%{_bindir}:${PATH}"
205  rm -rf $RPM_BUILD_ROOT
206
207  cd build
208
209  make DESTDIR=$RPM_BUILD_ROOT install
210  cd ..
211
212  cd build/avr-rtems4.9/newlib
213  make DESTDIR=$RPM_BUILD_ROOT install-info
214  cd ../../..
215
216%if "%{gcc_version}" <= "4.1.2"
217# Misplaced header file
218  if test -f $RPM_BUILD_ROOT%{_includedir}/mf-runtime.h; then
219    mv $RPM_BUILD_ROOT%{_includedir}/mf-runtime.h \
220      $RPM_BUILD_ROOT%{gcclib}/avr-rtems4.9/%{gcc_version}/include/
221  fi
222%endif
223
224  # host library
225  rm -f  ${RPM_BUILD_ROOT}%{_libdir}/libiberty.a
226
227  # We use the version from binutils
228  rm -f $RPM_BUILD_ROOT%{_bindir}/avr-rtems4.9-c++filt%{_exeext}
229
230
231  # We don't ship info/dir
232  rm -f $RPM_BUILD_ROOT%{_infodir}/dir
233  touch $RPM_BUILD_ROOT%{_infodir}/dir
234
235
236%if "%{gcc_version}" >= "3.4"
237  # Bug in gcc-3.4.0pre
238  rm -f $RPM_BUILD_ROOT%{_bindir}/avr-rtems4.9-avr-rtems4.9-gcjh%{_exeext}
239%endif
240
241%if "%{gcc_version}" >= "3.3"
242  # Bug in gcc-3.3.x/gcc-3.4.x: Despite we don't need fixincludes, it installs
243  # the fixinclude-install-tools
244  rm -rf ${RPM_BUILD_ROOT}%{gcclib}/avr-rtems4.9/%{gcc_version}/install-tools
245  rm -rf ${RPM_BUILD_ROOT}%{gccexec}/avr-rtems4.9/%{gcc_version}/install-tools
246%endif
247
248  # Collect multilib subdirectories
249  f=`build/gcc/xgcc -Bbuild/gcc/ --print-multi-lib | sed -e 's,;.*$,,'`
250
251  echo "%defattr(-,root,root,-)" > build/files.newlib
252  TGTDIR="%{_exec_prefix}/avr-rtems4.9/lib"
253  for i in $f; do
254    case $i in
255    \.) echo "%dir ${TGTDIR}" >> build/files.newlib
256      ;;
257    *)  echo "%dir ${TGTDIR}/$i" >> build/files.newlib
258      ;;
259    esac
260  done
261
262  rm -f dirs ;
263  echo "%defattr(-,root,root,-)" >> dirs
264  echo "%dir %{_prefix}" >> dirs
265  echo "%dir %{_libdir}" >> dirs
266%if "%{gcc_version}" >= "3.4"
267  echo "%dir %{_libexecdir}" >> dirs
268%endif
269  echo "%dir %{gcclib}" >> dirs
270  echo "%dir %{gcclib}/avr-rtems4.9" >> dirs
271
272  TGTDIR="%{gcclib}/avr-rtems4.9/%{gcc_version}"
273  for i in $f; do
274    case $i in
275    \.) echo "%dir ${TGTDIR}" >> dirs
276      ;;
277    *)  echo "%dir ${TGTDIR}/$i" >> dirs
278      ;;
279    esac
280  done
281
282  # Collect files to go into different packages
283  cp dirs build/files.gcc
284  cp dirs build/files.g77
285  cp dirs build/files.gfortran
286  cp dirs build/files.objc
287  cp dirs build/files.gcj
288  cp dirs build/files.g++
289
290  TGTDIR="%{gcclib}/avr-rtems4.9/%{gcc_version}"
291  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
292  for i in $f; do
293    case $i in
294    *lib*.la) rm ${RPM_BUILD_ROOT}/$i ;; # ignore: gcc produces bogus libtool libs
295    *f771) ;;
296    *f951) ;;
297    *cc1) ;;
298    *cc1obj) ;;
299    *cc1plus) ;; # ignore: explicitly put into rpm elsewhere
300    *collect2) ;;
301    *libobjc*) echo "$i" >> build/files.objc ;;
302    *include/objc*) ;;
303    *include/g++*);;
304    *include/c++*);;
305    *adainclude*);;
306    *adalib*);;
307    *gnat1);;
308    *jc1) ;;
309    *jvgenmain) ;;
310    */libgfortran*.*) echo "$i" >> build/files.gfortran ;;
311    */libstdc++.*) echo "$i" >> build/files.g++ ;;
312    */libsupc++.*) echo "$i" >> build/files.g++ ;;
313    *) echo "$i" >> build/files.gcc ;;
314    esac
315  done
316
317  TGTDIR="%{_exec_prefix}/avr-rtems4.9/lib"
318  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
319  for i in $f; do
320    case $i in
321    *lib*.la) rm ${RPM_BUILD_ROOT}/$i;; # ignore - gcc produces bogus libtool libs
322    *libiberty.a) rm ${RPM_BUILD_ROOT}/$i ;; # ignore - GPL'ed
323# all other files belong to newlib
324    *) echo "$i" >> build/files.newlib ;;
325    esac
326  done
327# Extract %%__os_install_post into os_install_post~
328cat << \EOF > os_install_post~
329%__os_install_post
330EOF
331
332# Generate customized brp-*scripts
333cat os_install_post~ | while read a x y; do
334case $a in
335# Prevent brp-strip* from trying to handle foreign binaries
336*/brp-strip*)
337  b=$(basename $a)
338  sed -e 's,find $RPM_BUILD_ROOT,find $RPM_BUILD_ROOT%_bindir $RPM_BUILD_ROOT%_libexecdir,' $a > $b
339  chmod a+x $b
340  ;;
341# Fix up brp-compress to handle %%_prefix != /usr
342*/brp-compress*)
343  b=$(basename $a)
344  sed -e 's,\./usr/,.%{_prefix}/,g' < $a > $b
345  chmod a+x $b
346  ;;
347esac
348done
349
350sed -e 's,^[ ]*/usr/lib/rpm.*/brp-strip,./brp-strip,' \
351  -e 's,^[ ]*/usr/lib/rpm.*/brp-compress,./brp-compress,' \
352< os_install_post~ > os_install_post
353%define __os_install_post . ./os_install_post
354
355
356cat << EOF > %{_builddir}/%{name}-%{gcc_rpmvers}/find-provides
357#!/bin/sh
358grep -E -v '^${RPM_BUILD_ROOT}%{_exec_prefix}/avr-rtems4.9/(lib|include|sys-root)' \
359  | grep -v '^${RPM_BUILD_ROOT}%{gcclib}/avr-rtems4.9/' | %__find_provides
360EOF
361chmod +x %{_builddir}/%{name}-%{gcc_rpmvers}/find-provides
362%define __find_provides %{_builddir}/%{name}-%{gcc_rpmvers}/find-provides
363
364cat << EOF > %{_builddir}/%{name}-%{gcc_rpmvers}/find-requires
365#!/bin/sh
366grep -E -v '^${RPM_BUILD_ROOT}%{_exec_prefix}/avr-rtems4.9/(lib|include|sys-root)' \
367  | grep -v '^${RPM_BUILD_ROOT}%{gcclib}/avr-rtems4.9/' | %__find_requires
368EOF
369chmod +x %{_builddir}/%{name}-%{gcc_rpmvers}/find-requires
370%define __find_requires %{_builddir}/%{name}-%{gcc_rpmvers}/find-requires
371
372%clean
373  rm -rf $RPM_BUILD_ROOT
374
375# ==============================================================
376# rtems-4.9-avr-rtems4.9-gcc
377# ==============================================================
378# %package -n rtems-4.9-avr-rtems4.9-gcc
379# Summary:        GNU cc compiler for avr-rtems4.9
380# Group:          Development/Tools
381# Version:        %{gcc_rpmvers}
382# Requires:       rtems-4.9-avr-rtems4.9-binutils
383# Requires:       rtems-4.9-avr-rtems4.9-newlib = %{newlib_version}-%{release}
384# License:      GPL
385
386# %if %build_infos
387# Requires:      rtems-4.9-gcc-common
388# %endif
389
390%description -n rtems-4.9-avr-rtems4.9-gcc
391GNU cc compiler for avr-rtems4.9.
392
393%files -n rtems-4.9-avr-rtems4.9-gcc -f build/files.gcc
394%defattr(-,root,root)
395%dir %{_mandir}
396%dir %{_mandir}/man1
397%{_mandir}/man1/avr-rtems4.9-gcc.1*
398%if "%{gcc_version}" >= "3.4"
399%{_mandir}/man1/avr-rtems4.9-cpp.1*
400%{_mandir}/man1/avr-rtems4.9-gcov.1*
401%endif
402
403%dir %{_bindir}
404%{_bindir}/avr-rtems4.9-cpp%{_exeext}
405%{_bindir}/avr-rtems4.9-gcc%{_exeext}
406%if "%{gcc_version}" >= "3.3"
407%{_bindir}/avr-rtems4.9-gcc-%{gcc_version}%{_exeext}
408%endif
409%{_bindir}/avr-rtems4.9-gcov%{_exeext}
410%{_bindir}/avr-rtems4.9-gccbug
411
412%dir %{gcclib}/avr-rtems4.9/%{gcc_version}/include
413%if "%{gcc_version}" > "4.0.3"
414%if "avr-rtems4.9" != "bfin-rtems4.9"
415%if "avr-rtems4.9" != "avr-rtems4.9"
416%dir %{gcclib}/avr-rtems4.9/%{gcc_version}/include/ssp
417%endif
418%endif
419%endif
420
421%dir %{gccexec}
422%dir %{gccexec}/avr-rtems4.9
423%dir %{gccexec}/avr-rtems4.9/%{gcc_version}
424%{gccexec}/avr-rtems4.9/%{gcc_version}/cc1%{_exeext}
425%{gccexec}/avr-rtems4.9/%{gcc_version}/collect2%{_exeext}
426
427# ==============================================================
428# rtems-4.9-gcc-common
429# ==============================================================
430%package -n rtems-4.9-gcc-common
431Summary:        Base package for rtems gcc and newlib C Library
432Group:          Development/Tools
433Version:        %{gcc_rpmvers}
434License:        GPL
435
436Requires(post):         /sbin/install-info
437Requires(preun):        /sbin/install-info
438
439%description -n rtems-4.9-gcc-common
440GCC files that are shared by all targets.
441
442%files -n rtems-4.9-gcc-common
443%defattr(-,root,root)
444%dir %{_infodir}
445%ghost %{_infodir}/dir
446%{_infodir}/cpp.info*
447%{_infodir}/cppinternals.info*
448%{_infodir}/gcc.info*
449%{_infodir}/gccint.info*
450%if "%{gcc_version}" >= "3.4"
451%{_infodir}/gccinstall.info*
452%endif
453
454%dir %{_mandir}
455%if "%{gcc_version}" < "3.4"
456%dir %{_mandir}/man1
457%{_mandir}/man1/cpp.1*
458%{_mandir}/man1/gcov.1*
459%endif
460%dir %{_mandir}/man7
461%{_mandir}/man7/fsf-funding.7*
462%{_mandir}/man7/gfdl.7*
463%{_mandir}/man7/gpl.7*
464
465%post -n rtems-4.9-gcc-common
466  /sbin/install-info --info-dir=%{_infodir} %{_infodir}/cpp.info.gz || :
467  /sbin/install-info --info-dir=%{_infodir} %{_infodir}/cppinternals.info.gz || :
468  /sbin/install-info --info-dir=%{_infodir} %{_infodir}/gcc.info.gz || :
469  /sbin/install-info --info-dir=%{_infodir} %{_infodir}/gccint.info.gz || :
470%if "%{gcc_version}" >= "3.4"
471  /sbin/install-info --info-dir=%{_infodir} %{_infodir}/gccinstall.info.gz || :
472%endif
473
474%preun -n rtems-4.9-gcc-common
475if [ $1 -eq 0 ]; then
476  /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/cpp.info.gz || :
477  /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/cppinternals.info.gz || :
478  /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/gcc.info.gz || :
479  /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/gccint.info.gz || :
480%if "%{gcc_version}" >= "3.4"
481  /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/gccinstall.info.gz || :
482%endif
483fi
484
485
486
487
488# ==============================================================
489# rtems-4.9-avr-rtems4.9-newlib
490# ==============================================================
491%package -n rtems-4.9-avr-rtems4.9-newlib
492Summary:        C Library (newlib) for avr-rtems4.9
493Group:          Development/Tools
494License:        Distributable
495Version:        %{newlib_version}
496
497Provides:       rtems-4.9-avr-rtems4.9-libc = %{newlib_version}-%{release}
498Obsoletes:      rtems-4.9-avr-rtems4.9-libc < %{newlib_version}-%{release}
499
500Requires:       rtems-4.9-newlib-common
501
502%description -n rtems-4.9-avr-rtems4.9-newlib
503Newlib C Library for avr-rtems4.9.
504
505%files -n rtems-4.9-avr-rtems4.9-newlib -f build/files.newlib
506%defattr(-,root,root)
507%dir %{_prefix}
508%dir %{_exec_prefix}/avr-rtems4.9
509%{_exec_prefix}/avr-rtems4.9/include
510
511# ==============================================================
512# rtems-4.9-newlib-common
513# ==============================================================
514%package -n rtems-4.9-newlib-common
515Summary:        Base package for RTEMS newlib C Library
516Group:          Development/Tools
517Version:        %{newlib_version}
518License:        Distributable
519
520Requires(post):         /sbin/install-info
521Requires(preun):        /sbin/install-info
522
523%description -n rtems-4.9-newlib-common
524newlib files that are shared by all targets.
525
526%files -n rtems-4.9-newlib-common
527%defattr(-,root,root)
528%dir %{_infodir}
529%ghost %{_infodir}/dir
530%{_infodir}/libc.info*
531%{_infodir}/libm.info*
532
533%post -n rtems-4.9-newlib-common
534  /sbin/install-info --info-dir=%{_infodir} %{_infodir}/libc.info.gz || :
535  /sbin/install-info --info-dir=%{_infodir} %{_infodir}/libm.info.gz || :
536
537%preun -n rtems-4.9-newlib-common
538if [ $1 -eq 0 ]; then
539  /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/libc.info.gz || :
540  /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/libm.info.gz || :
541fi
542
Note: See TracBrowser for help on using the repository browser.