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

4.104.114.84.95
Last change on this file since fa42a76b was fa42a76b, checked in by Ralf Corsepius <ralf.corsepius@…>, on 08/19/02 at 06:28:42

2002-08-19 Ralf Corsepius <corsepiu@…>

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