source: rtems/contrib/crossrpms/rtems4.9/powerpc/rtems-4.9-powerpc-rtems4.9-gcc.spec @ dc00c8d

4.104.114.9
Last change on this file since dc00c8d was dc00c8d, checked in by Ralf Corsepius <ralf.corsepius@…>, on Nov 13, 2007 at 3:09:44 PM

backup.

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