source: rtems/scripts/gcc3newlib/gccnewlib.add @ ff65620

4.104.114.84.95
Last change on this file since ff65620 was f7e1564, checked in by Joel Sherrill <joel.sherrill@…>, on 11/28/02 at 21:12:23

2002-11-28 Joel Sherrill <joel@…>

  • setup.def: Updated to gcc-3.2 and newlib1.1.0 RPM version 6.
  • gcc3newlib/gccnewlib.add: Reenabled i386-rtems gnat.
  • Property mode set to 100644
File size: 8.8 KB
Line 
1#
2# spec file for building gcc for rtems
3#
4# Copyright  (c) 1999,2000,2001 OARCorp, Huntsville, AL
5#
6# please send bugfixes or comments to joel@OARcorp.com
7#
8
9%define _prefix @prefix@
10
11Vendor:       OAR Corporation
12Distribution: Linux
13Name:         @target_alias@-gcc-newlib
14Summary:      gcc and newlib C Library for @target_alias@.
15Group:        rtems
16Release:      @Release@
17License:      gcc is GPL/LGPL ; newlib no has restrictions on run-time usage
18
19Autoreqprov:    on
20Packager:       corsepiu@faw.uni-ulm.de and joel@OARcorp.com
21
22Version:        gcc@gcc_version@newlib@newlib_version@
23# gcc 3.x and gcc 2.9
24Source0:      ftp://ftp.gnu.org/pub/gnu/gcc/gcc-@gcc_version@.tar.gz
25# Source0:      ftp://ftp.gnu.org/pub/gnu/gcc/gcc-@gcc_version@.tar.bz2
26# gcc 2.95.x
27# Source0:      ftp://ftp.gnu.org/pub/gnu/gcc/gcc-@gcc_version@.tar.bz2
28Source1:        ftp://sources.redhat.com/pub/newlib/newlib-@newlib_version@.tar.gz
29@PATCH1@
30@PATCH3@
31Buildroot:      %{_tmppath}/%{name}
32
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.2"
51# default to building gnat
52%define _gnat   %{?gnat:%gnat}%{!?gnat:1}
53%else
54# default to not building gnat
55%define _gnat   %{?gnat:%gnat}%{!?gnat:0}
56%endif
57
58%define build_cxx       1
59%define build_g77       0
60%define build_objc      0
61%define build_gcj       0
62%define build_gnat      0
63
64%if "@target_alias@" == "arm-rtems"
65%define build_gcj       1
66%endif
67
68%if "@target_alias@" == "c4x-rtems"
69%define build_cxx       0
70%endif
71
72%if "@target_alias@" == "i386-rtems"
73%define build_gnat      %_gnat
74%define build_gcj       1
75%endif
76
77%if "@target_alias@" == "i960-rtems"
78%define build_cxx       0
79%endif
80
81%if "@target_alias@" == "m68k-rtems"
82%define build_gcj       1
83%endif
84
85%if "@target_alias@" == "mips-rtems"
86%define build_gcj       1
87%endif
88
89%if "@target_alias@" == "powerpc-rtems"
90%define build_gnat      %_gnat
91%define build_gcj       1
92%endif
93
94%if "@target_alias@" == "sparc-rtems"
95%define build_gnat      %_gnat
96%define build_gcj       1
97%endif
98
99%description
100RTEMS is an open source operating system for embedded systems.
101
102This is gcc's and newlib C Library's sources with patches for RTEMS.
103
104 The original sources are not included in the source RPM.
105 If we included them, then the source RPMs for each target
106 would duplicate MBs of source unnecessarily.  This is
107 a duplication of over 30 MBs of source for each of
108 the more than 10 targets it is possible to build.
109
110 You can get them yourself from the Internet and copy them to
111 your /usr/src/[redhat|packages]/SOURCES directory ($RPM_SOURCE_DIR).
112 Or you can try the ftp options of rpm :-)
113
114%prep
115# untar the sources inside @target_alias@-gcc-newlib
116%setup -c -T -n %{name} -a0 -a1
117
118@PATCH2@
119@PATCH4@
120
121  cd gcc-@gcc_version@
122    sed -e 's/\(version_string = \"[^\"]*\)/\1 (OAR Corporation gcc-@gcc_version@-@gcc_patch_version@\/newlib-@newlib_version@-@newlib_patch_version@ @Release@)/' \
123    gcc/version.c > gcc/version.c~
124    mv gcc/version.c~  gcc/version.c
125
126  # Fix timestamps
127    contrib/gcc_update --touch
128  cd ..
129
130  # Copy the C library into gcc's source tree
131  ln -s ../newlib-@newlib_version@/newlib gcc-@gcc_version@
132  test -d build || mkdir build
133
134%build
135  cd build
136
137# HACK: This doesn't work
138# %if "%{_target_os}" != "%{_build_os}"
139#    CONFIGURE_ARGS="--build=%{_build} --host=%{_target}"
140# %endif
141#  ALERT: GCJ would be better if we could add this flag and build
142#  it's libraries but this code isn't ready to be embedded.
143#  libgcj_flag="--enable-libgcj"
144
145  languages="c"
146%if %build_cxx
147  languages="$languages,c++"
148%endif
149%if %build_g77
150  languages="$languages,g77"
151%endif
152%if %build_gcj
153  languages="$languages,java"
154%endif
155%if %build_objc
156  languages="$languages,objc"
157%endif
158%if %build_gnat
159  languages="$languages,ada"
160%endif
161  ../gcc-@gcc_version@/configure $CONFIGURE_ARGS --target=@target_alias@ \
162    --with-gnu-as --with-gnu-ld --with-newlib --verbose \
163    --with-system-zlib --disable-nls \
164    --enable-version-specific-runtime-libs \
165    --enable-threads=rtems --prefix=%{_prefix} \
166    --enable-languages=$languages ${libgcj_flag}
167%if %build_gnat
168  cd ../gcc-@gcc_version@/gcc/ada
169  touch treeprs.ads [es]info.h nmake.ad[bs]
170  cd ../../../build
171%endif
172  make all
173%if %build_gnat
174# This gnat configuration is crap :(
175
176# This is what is documented, but it doesn't work for me (RC)
177#  make gnatlib_and_tools
178  make -C gcc cross-gnattools
179  make -C gcc ada.all.cross
180
181# This should work, but doesn't.
182#  make -C gcc gnatlib
183
184# This is what gcc/ada/Makefile.in contains by default,
185# but what we override below
186  GNATLIBCFLAGS="-g -O2"
187# Let gnatlib building find newlib's headers
188  GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/@target_alias@/newlib/targ-include"
189  GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/../newlib-@newlib_version@/newlib/libc/include"
190# Without this xgcc doesn't find the target's binutils.
191  GNATLIBCFLAGS="$GNATLIBCFLAGS -B%{_prefix}/@target_alias@/bin/"
192  make -C gcc GNATLIBCFLAGS="${GNATLIBCFLAGS}" gnatlib
193%endif
194  make info
195
196%install
197  cd build
198# Bug in gcc-2.95.1: It doesn't build this installation directory
199# If it doesn't find it, gcc doesn't install @target_alias@/bin/gcc
200%if "@gcc_version@" < "3.0"
201  ../gcc-@gcc_version@/mkinstalldirs \
202    $RPM_BUILD_ROOT%{_prefix}/@target_alias@/bin
203%endif
204
205  make prefix=$RPM_BUILD_ROOT%{_prefix} \
206    bindir=$RPM_BUILD_ROOT%{_bindir} install
207  cd @target_alias@/newlib
208  make prefix=$RPM_BUILD_ROOT%{_prefix} \
209    bindir=$RPM_BUILD_ROOT%{_bindir} install-info
210  # cd back to build/
211  cd ../..
212
213%if %build_gnat
214# Install a copy of gcc as gnatgcc
215# Enables us to mix different versions of gnat and gnatgcc
216  rm -f $RPM_BUILD_ROOT%{_bindir}/@target_alias@-gnatgcc@exe_ext@
217  ln $RPM_BUILD_ROOT%{_bindir}/@target_alias@-gcc@exe_ext@ \
218    $RPM_BUILD_ROOT%{_bindir}/@target_alias@-gnatgcc@exe_ext@
219%endif
220
221  # Bug in gcc-3.x: It puts the build dirs into *.la files
222
223  # host library
224  rm -f  ${RPM_BUILD_ROOT}%{_prefix}/lib/libiberty.a
225
226%if "@gcc_version@" < "3.0"
227  # Bug in gcc-2.95.x: It bogusly tries to share cpp for all targets.
228  # Rename it to target_alias-cpp
229  if test -f $RPM_BUILD_ROOT%{_prefix}/bin/cpp@exe_ext@;
230  then
231    mv $RPM_BUILD_ROOT%{_prefix}/bin/cpp@exe_ext@ \
232      $RPM_BUILD_ROOT%{_prefix}/bin/@target_alias@-cpp@exe_ext@
233  fi
234%endif
235
236  # gzip info files
237  gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info 2>/dev/null
238  gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info-? 2>/dev/null
239  gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info-?? 2>/dev/null
240
241  rm -f dirs ;
242  echo "%dir %{_prefix}/lib" >> dirs ;
243  echo "%dir %{_prefix}/lib/gcc-lib" >> dirs ;
244  echo "%dir %{_prefix}/lib/gcc-lib/@target_alias@" >> dirs ;
245
246  # Collect multilib subdirectories
247  f=`gcc/xgcc -Bgcc/ --print-multi-lib | sed -e 's,;.*$,,'`
248
249  TGTDIR="%{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@"
250  for i in $f; do
251    case $i in
252    \.) echo "%dir ${TGTDIR}" >> dirs
253      ;;
254    *)  echo "%dir ${TGTDIR}/$i" >> dirs
255      ;;
256    esac
257  done
258
259  TGTDIR="%{_prefix}/@target_alias@/lib"
260  for i in $f; do
261    case $i in
262    \.) echo "%dir ${TGTDIR}" >> dirs
263      ;;
264    *)  echo "%dir ${TGTDIR}/$i" >> dirs
265      ;;
266    esac
267  done
268
269  # Collect files to go into different packages
270  cp dirs files.gcc
271  cp dirs files.g77
272  cp dirs files.objc
273  cp dirs files.gcj
274  cp dirs files.g++
275
276  TGTDIR="%{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@"
277  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
278  for i in $f; do
279    case $i in
280    *lib*.la) rm ${RPM_BUILD_ROOT}/$i ;; # ignore: gcc produces bogus libtool libs
281    *f771) ;;
282    *cc1obj) ;;
283    *libobjc*) echo "$i" >> files.objc ;;
284    *include/objc*) ;;
285    *include/g++*);;
286    *include/c++*);;
287    *adainclude*);;
288    *adalib*);;
289    *gnat1);;
290    *jc1) ;;
291    *jvgenmain) ;;
292    *cc1plus) ;; # ignore: explicitly put into rpm elsewhere
293    *libstdc++.a) echo "$i" >> files.g++ ;;
294    *libsupc++.a) echo "$i" >> files.g++ ;;
295    *) echo "$i" >> files.gcc ;;
296    esac
297  done
298
299  TGTDIR="%{_prefix}/@target_alias@/lib"
300  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
301  for i in $f; do
302    case $i in
303    *lib*.la) rm ${RPM_BUILD_ROOT}/$i;; # ignore - gcc produces bogus libtool libs
304    *libiberty.a) rm ${RPM_BUILD_ROOT}/$i ;; # ignore - GPL'ed
305# all other files belong to gcc
306    *) echo "$i" >> files.gcc ;;
307    esac
308  done
309
310%clean
311# let rpm --clean remove BuildRoot iif using the default BuildRoot
312  test "$RPM_BUILD_ROOT" = "%{_tmppath}/%{name}" && \
313    rm -rf $RPM_BUILD_ROOT
Note: See TracBrowser for help on using the repository browser.