source: rtems/scripts/gcc3newlib/gccnewlib.add @ 83774d7

4.104.114.84.95
Last change on this file since 83774d7 was 83774d7, checked in by Ralf Corsepius <ralf.corsepius@…>, on 01/12/05 at 06:14:41

2005-01-12 Ralf Corsepius <ralf.corsepius@…>

  • gcc3newlib/gccnewlib.add: Change my email address. Add tic4x-*.
  • Property mode set to 100644
File size: 11.4 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:       ralf.corsepius@rtems.org 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}" == "tic4x-rtems@osversion@"
87%define build_cxx       0
88%endif
89
90# OBSOLETE: use tic4x instead
91%if "%{gcc_target}" == "c4x-rtems@osversion@"
92%define build_cxx       0
93%endif
94
95%if "%{gcc_target}" == "i386-rtems@osversion@"
96%define build_gnat      %_gnat
97%define build_gcj       %_gcj
98%endif
99
100%if "%{gcc_target}" == "m68k-rtems@osversion@"
101%define build_gcj       %_gcj
102%endif
103
104%if "%{gcc_target}" == "mips-rtems@osversion@"
105%define build_gnat      %_gnat
106%define build_gcj       %_gcj
107%endif
108
109%if "%{gcc_target}" == "powerpc-rtems@osversion@"
110%define build_gnat      %_gnat
111%define build_gcj       %_gcj
112%endif
113
114# gcc 3.4.0 is broken for embedded sparc and gnat trips it.
115%if "%{gcc_target}" == "sparc-rtems@osversion@"
116%if "%{gcc_version}" >= "3.4"
117%define build_gnat      0
118%else
119%define build_gnat      %_gnat
120%endif
121%define build_gcj       %_gcj
122%endif
123
124%if %build_gcj
125# Building gcj requires bison and zlib
126BuildPreReq:    bison
127%if "%_vendor" == "redhat"
128BuildPreReq:    zlib-devel
129%endif
130%endif
131
132%if %build_gnat
133# Building gnat requires gnat
134%if "%_vendor" == "redhat"
135# This really isn't available until RedHat 8.0.  How to conditionalize this?
136# BuildPreReq:  gcc-gnat
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
167@PATCH2@
168@PATCH4@
169
170  cd gcc-%{gcc_version}
171    sed -e 's/\(version_string = \"[^\"]*\)/\1 (RTEMS gcc-%{gcc_version}-@gcc_patch_version@\/newlib-%{newlib_version}-@newlib_patch_version@-@Release@)/' \
172    gcc/version.c > gcc/version.c~
173    mv gcc/version.c~  gcc/version.c
174
175  # Fix timestamps
176    contrib/gcc_update --touch
177  cd ..
178
179  # Copy the C library into gcc's source tree
180  ln -s ../newlib-%{newlib_version}/newlib gcc-%{gcc_version}
181  test -d build || mkdir build
182
183%build
184  cd build
185
186#  ALERT: GCJ would be better if we could add this flag and build
187#  it's libraries but this code isn't ready to be embedded.
188#  libgcj_flag="--enable-libgcj"
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_gcj
198  languages="$languages,java"
199%endif
200%if %build_objc
201  languages="$languages,objc"
202%endif
203%if %build_gnat
204  languages="$languages,ada"
205%endif
206
207  export PATH="%{_bindir}:${PATH}"
208  ../gcc-%{gcc_version}/configure \
209    --prefix=%{_prefix} --mandir=%{_mandir} \
210    --infodir=%{_infodir} \
211    --build=%_build --host=%_host \
212    --target=%{gcc_target} \
213    --with-gnu-as --with-gnu-ld --with-newlib --verbose \
214    --with-system-zlib --disable-nls \
215    --enable-version-specific-runtime-libs \
216    --enable-threads=rtems \
217    --enable-languages=$languages ${libgcj_flag}
218
219%if "%_host" != "%_build"
220  # Bug in gcc-3.2.1:
221  # Somehow, gcc doesn't get syslimits.h right for Cdn-Xs
222  test -d gcc/include || mkdir -p gcc/include
223  cp ../gcc-%{gcc_version}/gcc/gsyslimits.h gcc/include/syslimits.h
224%endif
225
226%if %build_gnat
227%if "%{gcc_version}" < "3.4"
228  cd ../gcc-%{gcc_version}/gcc/ada
229  touch treeprs.ads [es]info.h nmake.ad[bs]
230  cd ../../../build
231%endif
232%endif
233
234  make all
235%if %build_gnat
236# This gnat configuration is crap :(
237
238%if "%{gcc_version}" >= "3.4"
239# This is what is documented - Of cause it doesn't work.
240  make -C gcc gnatlib
241  make -C gcc cross-gnattools
242  make -C gcc ada.all.cross
243%endif
244
245%if "%{gcc_version}" < "3.4"
246# This is what had worked for some versions of gcc.
247  make -C gcc cross-gnattools
248  make -C gcc ada.all.cross
249# This is what gcc/ada/Makefile.in contains by default,
250# but what we override below
251  GNATLIBCFLAGS="-g -O2"
252# Let gnatlib building find newlib's headers
253  GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/%{gcc_target}/newlib/targ-include"
254  GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/../newlib-%{newlib_version}/newlib/libc/include"
255  GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/../gcc-%{gcc_version}/include"
256# Without this xgcc doesn't find the target's binutils.
257  GNATLIBCFLAGS="$GNATLIBCFLAGS -B%{_prefix}/%{gcc_target}/bin/"
258%if "%{gcc_target}" == "mips-rtems@osversion@"
259  GNATLIBCFLAGS="$GNATLIBCFLAGS -G0"
260%endif
261  make -C gcc GNATLIBCFLAGS="${GNATLIBCFLAGS}" gnatlib
262%endif
263%endif
264  make info
265
266%install
267  export PATH="%{_bindir}:${PATH}"
268  test $RPM_BUILD_ROOT = "%{_defaultbuildroot}" && \
269    rm -rf $RPM_BUILD_ROOT
270
271  cd build
272# Bug in gcc-2.95.1: It doesn't build this installation directory
273# If it doesn't find it, gcc doesn't install %{gcc_target}/bin/gcc
274%if "%{gcc_version}" < "3.0"
275  ../gcc-%{gcc_version}/mkinstalldirs \
276    $RPM_BUILD_ROOT%{_prefix}/%{gcc_target}/bin
277%endif
278
279  make prefix=$RPM_BUILD_ROOT%{_prefix} \
280    bindir=$RPM_BUILD_ROOT%{_bindir} \
281    mandir=$RPM_BUILD_ROOT%{_mandir} \
282    infodir=$RPM_BUILD_ROOT%{_infodir} \
283    install
284  cd %{gcc_target}/newlib
285  make prefix=$RPM_BUILD_ROOT%{_prefix} \
286    bindir=$RPM_BUILD_ROOT%{_bindir} \
287    mandir=$RPM_BUILD_ROOT%{_mandir} \
288    infodir=$RPM_BUILD_ROOT%{_infodir} \
289    install-info
290  # cd back to build/
291  cd ../..
292
293%if %build_gnat
294# Install a copy of gcc as gnatgcc
295# Enables us to mix different versions of gnat and gnatgcc
296  rm -f $RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-gnatgcc%{_exeext}
297  ln $RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-gcc%{_exeext} \
298    $RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-gnatgcc%{_exeext}
299%endif
300
301  # Bug in gcc-3.x: It puts the build dirs into *.la files
302
303  # host library
304  rm -f  ${RPM_BUILD_ROOT}%{_prefix}/lib/libiberty.a
305
306  # We use the version from binutils
307  rm -f $RPM_BUILD_ROOT%{_prefix}/bin/%{gcc_target}-c++filt%{_exeext}
308
309  # We don't ship info/dir
310  rm -f $RPM_BUILD_ROOT%{_infodir}/dir
311
312%if "%{gcc_version}" >= "3.4"
313  # Bug in gcc-3.4.0pre
314  rm -f $RPM_BUILD_ROOT%{_prefix}/bin/%{gcc_target}-%{gcc_target}-gcjh%{_exeext}
315%endif
316
317%if "%{gcc_version}" >= "3.3"
318  # Bug in gcc-3.3.x/gcc-3.4.x: Despite we don't need fixincludes, it installs
319  # the fixinclude-install-tools
320  rm -rf ${RPM_BUILD_ROOT}%{gccexec}/%{gcc_target}/%{gcc_version}/install-tools
321%endif
322
323%if "%{gcc_version}" < "3.0"
324  # Bug in gcc-2.95.x: It bogusly tries to share cpp for all targets.
325  # Rename it to target_alias-cpp
326  if test -f $RPM_BUILD_ROOT%{_prefix}/bin/cpp%{_exeext};
327  then
328    mv $RPM_BUILD_ROOT%{_prefix}/bin/cpp%{_exeext} \
329      $RPM_BUILD_ROOT%{_prefix}/bin/%{gcc_target}-cpp%{_exeext}
330  fi
331%endif
332
333  # gzip info files
334  ls $RPM_BUILD_ROOT%{_infodir}/*.info \
335    $RPM_BUILD_ROOT%{_infodir}/*.info-? \
336    $RPM_BUILD_ROOT%{_infodir}/*.info-?? \
337  | while read a; do \
338    gzip -9qf $a 2>/dev/null; \
339  done
340
341  # gzip man pages
342  gzip -9qf $RPM_BUILD_ROOT%{_mandir}/man?/*.? 2>/dev/null
343
344  rm -f dirs ;
345  echo "%defattr(-,root,root)" >> dirs
346  echo "%dir %{_prefix}/lib" >> dirs ;
347  echo "%dir %{gcclib}" >> dirs ;
348  echo "%dir %{gcclib}/%{gcc_target}" >> dirs ;
349
350  # Collect multilib subdirectories
351  f=`gcc/xgcc -Bgcc/ --print-multi-lib | sed -e 's,;.*$,,'`
352
353  TGTDIR="%{gcclib}/%{gcc_target}/%{gcc_version}"
354  for i in $f; do
355    case $i in
356    \.) echo "%dir ${TGTDIR}" >> dirs
357      ;;
358    *)  echo "%dir ${TGTDIR}/$i" >> dirs
359      ;;
360    esac
361  done
362
363  TGTDIR="%{_prefix}/%{gcc_target}/lib"
364  for i in $f; do
365    case $i in
366    \.) echo "%dir ${TGTDIR}" >> dirs
367      ;;
368    *)  echo "%dir ${TGTDIR}/$i" >> dirs
369      ;;
370    esac
371  done
372
373  # Collect files to go into different packages
374  cp dirs files.gcc
375  cp dirs files.g77
376  cp dirs files.objc
377  cp dirs files.gcj
378  cp dirs files.g++
379
380  TGTDIR="%{gcclib}/%{gcc_target}/%{gcc_version}"
381  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
382  for i in $f; do
383    case $i in
384    *lib*.la) rm ${RPM_BUILD_ROOT}/$i ;; # ignore: gcc produces bogus libtool libs
385    *f771) ;;
386    *cc1) ;;
387    *cc1obj) ;;
388    *cc1plus) ;; # ignore: explicitly put into rpm elsewhere
389    *collect2) ;;
390    *libobjc*) echo "$i" >> files.objc ;;
391    *include/objc*) ;;
392    *include/g++*);;
393    *include/c++*);;
394    *adainclude*);;
395    *adalib*);;
396    *gnat1);;
397    *jc1) ;;
398    *jvgenmain) ;;
399    *libstdc++.a) echo "$i" >> files.g++ ;;
400    *libsupc++.a) echo "$i" >> files.g++ ;;
401    *) echo "$i" >> files.gcc ;;
402    esac
403  done
404
405  TGTDIR="%{_prefix}/%{gcc_target}/lib"
406  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
407  for i in $f; do
408    case $i in
409    *lib*.la) rm ${RPM_BUILD_ROOT}/$i;; # ignore - gcc produces bogus libtool libs
410    *libiberty.a) rm ${RPM_BUILD_ROOT}/$i ;; # ignore - GPL'ed
411# all other files belong to gcc
412    *) echo "$i" >> files.gcc ;;
413    esac
414  done
415
Note: See TracBrowser for help on using the repository browser.