source: rtems/scripts/gcc3newlib/gccnewlib.add @ 698b292

4.104.114.84.95
Last change on this file since 698b292 was 99e797a5, checked in by Joel Sherrill <joel.sherrill@…>, on 09/14/02 at 20:10:21

2002-09-14 Joel Sherrill <joel@…>

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