source: rtems/scripts/gccnewlib/gccnewlib.add @ 633c36a

4.104.114.84.95
Last change on this file since 633c36a was 633c36a, checked in by Ralf Corsepius <ralf.corsepius@…>, on Apr 25, 2005 at 12:20:12 PM

2005-04-25 Ralf Corsepius <ralf.corsepius@…>

  • gccnewlib/gccnewlib.add: Abandond c4x-*.
  • Property mode set to 100644
File size: 11.9 KB
Line 
1
2%define gcc_version     @gcc_version@
3%define newlib_version  @newlib_version@
4
5%define gcc_target      @target_alias@
6
7Name:           %{rpmprefix}%{gcc_target}-gcc-newlib
8Summary:        gcc and newlib C Library for %{gcc_target}.
9Group:          %{rpmgroup}
10Release:        @Release@
11Epoch:          0
12License:        gcc is GPL/LGPL ; newlib no has restrictions on run-time usage
13
14Packager:       ralf.corsepius@rtems.org and joel@OARcorp.com
15
16Version:        gcc%{gcc_version}newlib%{newlib_version}
17
18%if "%{gcc_version}" >= "3.2.2"
19Source0: ftp://ftp.gnu.org/pub/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}@gcc_suffix@
20%else
21%if "%{gcc_version}" >= "3.0"
22Source0: ftp://ftp.gnu.org/pub/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}.tar.gz
23%else
24Source0: ftp://ftp.gnu.org/pub/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}-everything.tar.gz
25%endif
26%endif
27Source1:        ftp://sources.redhat.com/pub/newlib/newlib-%{newlib_version}@newlib_suffix@
28@PATCH1@
29@PATCH3@
30BuildPreReq:    texinfo >= 4.2
31BuildPreReq:    %{rpmprefix}%{gcc_target}-binutils
32#
33# The original sources are not included in the source RPM.
34# If we included them, then the source RPMs for each target
35# would duplicate MBs of source unnecessarily.  This is
36# a duplication of over 30 MBs of source for each of
37# the more than 10 targets it is possible to build.
38#
39# You can get them yourself from the Internet and copy them to
40# your /usr/src/redhat/SOURCES directory ($RPM_SOURCE_DIR).
41# Or you can try the ftp options of rpm :-)
42#
43%{?!_with_sources:NoSource:     0}
44%{?!_with_sources:NoSource:     1}
45
46# Use rpm -ba --define 'gnat [0|1]' xxx.spec to override building gnat for
47# those targets wanting to support ada.
48
49# default to not building gnat
50%define _gnat   %{?gnat:%gnat}%{!?gnat:0}
51
52# Use rpm -ba --define 'gcj [0|1]' xxx.spec to override building gcj for
53# those targets wanting to support gcj.
54
55# default to not building gcj
56%define _gcj    %{?gcj:%gcj}%{!?gcj:0}
57
58%define build_cxx       %{?cxx:%cxx}%{!?cxx:1}
59%if "%{gcc_version}" >= "4.0.0"
60%define build_f95       %{?f95:%f95}%{!?f95:0}
61%define build_g77       0
62%else
63%define build_f95       0
64%define build_g77       %{?g77:%g77}%{!?g77:0}
65%endif
66%define build_objc      %{?objc:%objc}%{!?objc:0}
67%define build_gcj       0
68%define build_gnat      0
69
70%if "%{gcc_target}" == "arm-rtems@osversion@"
71%define build_gcj       %_gcj
72%endif
73
74%if "%{gcc_target}" == "avr-rtems@osversion@"
75%define build_cxx       0
76%endif
77
78%if "%{gcc_target}" == "tic4x-rtems@osversion@"
79%define build_cxx       0
80%endif
81
82# OBSOLETE: use tic4x instead
83%if "%{gcc_target}" == "c4x-rtems@osversion@"
84%define build_cxx       0
85%endif
86
87# OBSOLETE: use tic4x instead
88%if "%{gcc_target}" == "c4x-rtems@osversion@"
89%define build_cxx       0
90%endif
91
92%if "%{gcc_target}" == "i386-rtems@osversion@"
93%define build_gnat      %_gnat
94%define build_gcj       %_gcj
95%endif
96
97%if "%{gcc_target}" == "m68k-rtems@osversion@"
98%define build_gcj       %_gcj
99%endif
100
101%if "%{gcc_target}" == "mips-rtems@osversion@"
102%define build_gnat      %_gnat
103%define build_gcj       %_gcj
104%endif
105
106%if "%{gcc_target}" == "powerpc-rtems@osversion@"
107%define build_gnat      %_gnat
108%define build_gcj       %_gcj
109%endif
110
111# gcc 3.4.0 is broken for embedded sparc and gnat trips it.
112%if "%{gcc_target}" == "sparc-rtems@osversion@"
113%if "%{gcc_version}" >= "3.4"
114%define build_gnat      0
115%else
116%define build_gnat      %_gnat
117%endif
118%define build_gcj       %_gcj
119%endif
120
121%if %build_gcj
122# Building gcj requires bison and zlib
123BuildRequires:  bison
124%endif
125
126%if "%_vendor" == "redhat"
127%if %build_gcj
128BuildRequires:  zlib-devel
129%endif
130%if %build_gnat
131# Building gnat requires gnat
132# This really isn't available until RedHat 8.0.  How to conditionalize this?
133BuildRequires:  gcc-gnat
134%endif
135%if %build_f95
136BuildRequires: gmp-devel
137%endif
138%endif
139
140%if "%{gcc_version}" >= "3.4"
141%define gcclib %{_libdir}/gcc
142%define gccexec %{_libexecdir}/gcc
143%else
144%define gcclib %{_libdir}/gcc-lib
145%define gccexec %{_libdir}/gcc-lib
146%endif
147
148%description
149RTEMS is an open source operating system for embedded systems.
150
151This is gcc's and newlib C Library's sources with patches for RTEMS.
152
153 The original sources are not included in the source RPM.
154 If we included them, then the source RPMs for each target
155 would duplicate MBs of source unnecessarily.  This is
156 a duplication of over 30 MBs of source for each of
157 the more than 10 targets it is possible to build.
158
159 You can get them yourself from the Internet and copy them to
160 your /usr/src/[redhat|packages]/SOURCES directory ($RPM_SOURCE_DIR).
161 Or you can try the ftp options of rpm :-)
162
163%prep
164# untar the sources inside %{gcc_target}-gcc-newlib
165%setup -c -T -n %{name}-%{version} -a0 -a1
166
167cd gcc-%{gcc_version}
168%{?PATCH0:%patch0 -p1}
169cd ..
170cd newlib-%{newlib_version}
171%{?PATCH1:%patch1 -p1}
172cd ..
173
174  cd gcc-%{gcc_version}
175    sed -e 's/\(version_string.* = \"[^\"]*\)/\1 (RTEMS gcc-%{gcc_version}-@gcc_patch_version@\/newlib-%{newlib_version}-@newlib_patch_version@-@Release@)/' \
176    gcc/version.c > gcc/version.c~
177    mv gcc/version.c~  gcc/version.c
178
179  # Fix timestamps
180    contrib/gcc_update --touch
181  cd ..
182
183  # Copy the C library into gcc's source tree
184  ln -s ../newlib-%{newlib_version}/newlib gcc-%{gcc_version}
185  test -d build || mkdir build
186
187%build
188  cd build
189
190  languages="c"
191%if %build_cxx
192  languages="$languages,c++"
193%endif
194%if %build_g77
195  languages="$languages,g77"
196%endif
197%if %build_f95
198  languages="$languages,f95"
199%endif
200%if %build_gcj
201  languages="$languages,java"
202%endif
203%if %build_objc
204  languages="$languages,objc"
205%endif
206%if %build_gnat
207  languages="$languages,ada"
208%endif
209
210  export PATH="%{_bindir}:${PATH}"
211  ../gcc-%{gcc_version}/configure \
212    --prefix=%{_prefix} \
213    --bindir=%{_bindir} \
214    --includedir=%{_includedir} \
215    --libdir=%{_libdir} \
216    --mandir=%{_mandir} \
217    --infodir=%{_infodir} \
218    --build=%_build --host=%_host \
219    --target=%{gcc_target} \
220    --with-gnu-as --with-gnu-ld --with-newlib --verbose \
221    --with-system-zlib --disable-nls \
222    --enable-version-specific-runtime-libs \
223    --enable-threads=rtems \
224    --enable-languages=$languages ${libgcj_flag}
225
226%if "%_host" != "%_build"
227  # Bug in gcc-3.2.1:
228  # Somehow, gcc doesn't get syslimits.h right for Cdn-Xs
229  test -d gcc/include || mkdir -p gcc/include
230  cp ../gcc-%{gcc_version}/gcc/gsyslimits.h gcc/include/syslimits.h
231%endif
232
233%if %build_gnat
234%if "%{gcc_version}" < "3.4"
235  cd ../gcc-%{gcc_version}/gcc/ada
236  touch treeprs.ads [es]info.h nmake.ad[bs]
237  cd ../../../build
238%endif
239%endif
240
241  make all
242%if %build_gnat
243# This gnat configuration is crap :(
244
245%if "%{gcc_version}" >= "3.4"
246# This is what is documented - Of cause it doesn't work.
247  make -C gcc gnatlib
248  make -C gcc cross-gnattools
249  make -C gcc ada.all.cross
250%endif
251
252%if "%{gcc_version}" < "3.4"
253# This is what had worked for some versions of gcc.
254  make -C gcc cross-gnattools
255  make -C gcc ada.all.cross
256# This is what gcc/ada/Makefile.in contains by default,
257# but what we override below
258  GNATLIBCFLAGS="-g -O2"
259# Let gnatlib building find newlib's headers
260  GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/%{gcc_target}/newlib/targ-include"
261  GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/../newlib-%{newlib_version}/newlib/libc/include"
262  GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/../gcc-%{gcc_version}/include"
263# Without this xgcc doesn't find the target's binutils.
264  GNATLIBCFLAGS="$GNATLIBCFLAGS -B%{_prefix}/%{gcc_target}/bin/"
265%if "%{gcc_target}" == "mips-rtems@osversion@"
266  GNATLIBCFLAGS="$GNATLIBCFLAGS -G0"
267%endif
268  make -C gcc GNATLIBCFLAGS="${GNATLIBCFLAGS}" gnatlib
269%endif
270%endif
271  make info
272
273%install
274  export PATH="%{_bindir}:${PATH}"
275  rm -rf $RPM_BUILD_ROOT
276
277  cd build
278# Bug in gcc-2.95.1: It doesn't build this installation directory
279# If it doesn't find it, gcc doesn't install %{gcc_target}/bin/gcc
280%if "%{gcc_version}" < "3.0"
281  mkdir -p $RPM_BUILD_ROOT%{_prefix}/%{gcc_target}/bin
282%endif
283
284  make prefix=$RPM_BUILD_ROOT%{_prefix} \
285    bindir=$RPM_BUILD_ROOT%{_bindir} \
286    libdir=$RPM_BUILD_ROOT%{_libdir} \
287    includedir=$RPM_BUILD_ROOT%{_includedir} \
288    mandir=$RPM_BUILD_ROOT%{_mandir} \
289    infodir=$RPM_BUILD_ROOT%{_infodir} \
290    install
291  cd %{gcc_target}/newlib
292  make prefix=$RPM_BUILD_ROOT%{_prefix} \
293    bindir=$RPM_BUILD_ROOT%{_bindir} \
294    libdir=$RPM_BUILD_ROOT%{_libdir} \
295    includedir=$RPM_BUILD_ROOT%{_includedir} \
296    mandir=$RPM_BUILD_ROOT%{_mandir} \
297    infodir=$RPM_BUILD_ROOT%{_infodir} \
298    install-info
299  # cd back to build/
300  cd ../..
301
302%if %build_gnat
303# Install a copy of gcc as gnatgcc
304# Enables us to mix different versions of gnat and gnatgcc
305  rm -f $RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-gnatgcc%{_exeext}
306  ln $RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-gcc%{_exeext} \
307    $RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-gnatgcc%{_exeext}
308%endif
309
310  # Bug in gcc-3.x: It puts the build dirs into *.la files
311
312  # host library
313  rm -f  ${RPM_BUILD_ROOT}%{_prefix}/lib/libiberty.a
314
315  # We use the version from binutils
316  rm -f $RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-c++filt%{_exeext}
317
318  # We don't ship info/dir
319  rm -f $RPM_BUILD_ROOT%{_infodir}/dir
320
321%if %build_f95
322#  # Bug in gcc-4.0.0pre
323#  mv $RPM_BUILD_ROOT%{_bindir}/gfortran $RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-gfortran
324%endif
325
326%if "%{gcc_version}" >= "3.4"
327  # Bug in gcc-3.4.0pre
328  rm -f $RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-%{gcc_target}-gcjh%{_exeext}
329%endif
330
331%if "%{gcc_version}" >= "3.3"
332  # Bug in gcc-3.3.x/gcc-3.4.x: Despite we don't need fixincludes, it installs
333  # the fixinclude-install-tools
334  rm -rf ${RPM_BUILD_ROOT}%{gcclib}/%{gcc_target}/%{gcc_version}/install-tools
335  rm -rf ${RPM_BUILD_ROOT}%{gccexec}/%{gcc_target}/%{gcc_version}/install-tools
336%endif
337
338%if "%{gcc_version}" < "3.0"
339  # Bug in gcc-2.95.x: It bogusly tries to share cpp for all targets.
340  # Rename it to target_alias-cpp
341  if test -f $RPM_BUILD_ROOT%{_bindir}/cpp%{_exeext};
342  then
343    mv $RPM_BUILD_ROOT%{_bindir}/cpp%{_exeext} \
344      $RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-cpp%{_exeext}
345  fi
346%endif
347
348  # gzip info files
349  ls $RPM_BUILD_ROOT%{_infodir}/*.info \
350    $RPM_BUILD_ROOT%{_infodir}/*.info-? \
351    $RPM_BUILD_ROOT%{_infodir}/*.info-?? \
352  | while read a; do \
353    gzip -9qf $a 2>/dev/null; \
354  done
355
356  # gzip man pages
357  gzip -9qf $RPM_BUILD_ROOT%{_mandir}/man?/*.? 2>/dev/null
358
359  rm -f dirs ;
360  echo "%defattr(-,root,root)" >> dirs
361  echo "%dir %{_prefix}/lib" >> dirs ;
362  echo "%dir %{gcclib}" >> dirs ;
363  echo "%dir %{gcclib}/%{gcc_target}" >> dirs ;
364
365  # Collect multilib subdirectories
366  f=`gcc/xgcc -Bgcc/ --print-multi-lib | sed -e 's,;.*$,,'`
367
368  TGTDIR="%{gcclib}/%{gcc_target}/%{gcc_version}"
369  for i in $f; do
370    case $i in
371    \.) echo "%dir ${TGTDIR}" >> dirs
372      ;;
373    *)  echo "%dir ${TGTDIR}/$i" >> dirs
374      ;;
375    esac
376  done
377
378  TGTDIR="%{_prefix}/%{gcc_target}/lib"
379  for i in $f; do
380    case $i in
381    \.) echo "%dir ${TGTDIR}" >> dirs
382      ;;
383    *)  echo "%dir ${TGTDIR}/$i" >> dirs
384      ;;
385    esac
386  done
387
388  # Collect files to go into different packages
389  cp dirs files.gcc
390  cp dirs files.g77
391  cp dirs files.gfortran
392  cp dirs files.objc
393  cp dirs files.gcj
394  cp dirs files.g++
395
396  TGTDIR="%{gcclib}/%{gcc_target}/%{gcc_version}"
397  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
398  for i in $f; do
399    case $i in
400    *lib*.la) rm ${RPM_BUILD_ROOT}/$i ;; # ignore: gcc produces bogus libtool libs
401    *f771) ;;
402    *f951) ;;
403    *cc1) ;;
404    *cc1obj) ;;
405    *cc1plus) ;; # ignore: explicitly put into rpm elsewhere
406    *collect2) ;;
407    *libobjc*) echo "$i" >> files.objc ;;
408    *include/objc*) ;;
409    *include/g++*);;
410    *include/c++*);;
411    *adainclude*);;
412    *adalib*);;
413    *gnat1);;
414    *jc1) ;;
415    *jvgenmain) ;;
416    *libgfortran*.a) echo "$i" >> files.gfortran ;;
417    *libstdc++.a) echo "$i" >> files.g++ ;;
418    *libsupc++.a) echo "$i" >> files.g++ ;;
419    *) echo "$i" >> files.gcc ;;
420    esac
421  done
422
423  TGTDIR="%{_prefix}/%{gcc_target}/lib"
424  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
425  for i in $f; do
426    case $i in
427    *lib*.la) rm ${RPM_BUILD_ROOT}/$i;; # ignore - gcc produces bogus libtool libs
428    *libiberty.a) rm ${RPM_BUILD_ROOT}/$i ;; # ignore - GPL'ed
429# all other files belong to gcc
430    *) echo "$i" >> files.gcc ;;
431    esac
432  done
433
Note: See TracBrowser for help on using the repository browser.