source: rtems/scripts/gcc3newlib/gccnewlib.add @ 956e450

4.104.114.84.95
Last change on this file since 956e450 was 956e450, checked in by Ralf Corsepius <ralf.corsepius@…>, on 09/23/04 at 06:18:35

2004-09-23 Ralf Corsepius <ralf_corsepius@…>

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