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

4.104.114.84.95
Last change on this file since f7e1564 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
RevLine 
[afe5cac]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
[3e1526f0]24Source0:      ftp://ftp.gnu.org/pub/gnu/gcc/gcc-@gcc_version@.tar.gz
[afe5cac]25# Source0:      ftp://ftp.gnu.org/pub/gnu/gcc/gcc-@gcc_version@.tar.bz2
26# gcc 2.95.x
[3e1526f0]27# Source0:      ftp://ftp.gnu.org/pub/gnu/gcc/gcc-@gcc_version@.tar.bz2
[afe5cac]28Source1:        ftp://sources.redhat.com/pub/newlib/newlib-@newlib_version@.tar.gz
[df1f734]29@PATCH1@
30@PATCH3@
[afe5cac]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
[fa42a76b]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
[4aba88a1]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
[99e797a5]64%if "@target_alias@" == "arm-rtems"
65%define build_gcj       1
66%endif
67
68%if "@target_alias@" == "c4x-rtems"
[4aba88a1]69%define build_cxx       0
[513afacb]70%endif
71
[fa42a76b]72%if "@target_alias@" == "i386-rtems"
[f7e1564]73%define build_gnat      %_gnat
[99e797a5]74%define build_gcj       1
[fa42a76b]75%endif
76
[513afacb]77%if "@target_alias@" == "i960-rtems"
[4aba88a1]78%define build_cxx       0
[513afacb]79%endif
80
[99e797a5]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
[513afacb]89%if "@target_alias@" == "powerpc-rtems"
[fa42a76b]90%define build_gnat      %_gnat
[99e797a5]91%define build_gcj       1
[513afacb]92%endif
93
94%if "@target_alias@" == "sparc-rtems"
[fa42a76b]95%define build_gnat      %_gnat
[99e797a5]96%define build_gcj       1
[4aba88a1]97%endif
98
[afe5cac]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
[6e9746a2]116%setup -c -T -n %{name} -a0 -a1
[afe5cac]117
[df1f734]118@PATCH2@
119@PATCH4@
[afe5cac]120
[6e9746a2]121  cd gcc-@gcc_version@
[d35b77f]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
[6e9746a2]127    contrib/gcc_update --touch
128  cd ..
129
[afe5cac]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
[60ac65d]137# HACK: This doesn't work
[3f60b2aa]138# %if "%{_target_os}" != "%{_build_os}"
139#    CONFIGURE_ARGS="--build=%{_build} --host=%{_target}"
140# %endif
[99e797a5]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"
[afe5cac]144
[513afacb]145  languages="c"
146%if %build_cxx
147  languages="$languages,c++"
148%endif
[4aba88a1]149%if %build_g77
150  languages="$languages,g77"
151%endif
152%if %build_gcj
[99e797a5]153  languages="$languages,java"
[4aba88a1]154%endif
155%if %build_objc
156  languages="$languages,objc"
157%endif
158%if %build_gnat
159  languages="$languages,ada"
160%endif
[afe5cac]161  ../gcc-@gcc_version@/configure $CONFIGURE_ARGS --target=@target_alias@ \
162    --with-gnu-as --with-gnu-ld --with-newlib --verbose \
[6e9746a2]163    --with-system-zlib --disable-nls \
164    --enable-version-specific-runtime-libs \
[4aba88a1]165    --enable-threads=rtems --prefix=%{_prefix} \
[99e797a5]166    --enable-languages=$languages ${libgcj_flag}
[4aba88a1]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
[afe5cac]172  make all
[4aba88a1]173%if %build_gnat
[fa42a76b]174# This gnat configuration is crap :(
175
[4aba88a1]176# This is what is documented, but it doesn't work for me (RC)
177#  make gnatlib_and_tools
[513afacb]178  make -C gcc cross-gnattools
179  make -C gcc ada.all.cross
[fa42a76b]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
[4aba88a1]193%endif
[afe5cac]194  make info
195
196%install
197  cd build
[fa42a76b]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
[6e9746a2]204
[513afacb]205  make prefix=$RPM_BUILD_ROOT%{_prefix} \
206    bindir=$RPM_BUILD_ROOT%{_bindir} install
[afe5cac]207  cd @target_alias@/newlib
[4aba88a1]208  make prefix=$RPM_BUILD_ROOT%{_prefix} \
209    bindir=$RPM_BUILD_ROOT%{_bindir} install-info
[6e9746a2]210  # cd back to build/
211  cd ../..
[afe5cac]212
[fa42a76b]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
[d35b77f]222
223  # host library
224  rm -f  ${RPM_BUILD_ROOT}%{_prefix}/lib/libiberty.a
[df1f734]225
[fa42a76b]226%if "@gcc_version@" < "3.0"
[afe5cac]227  # Bug in gcc-2.95.x: It bogusly tries to share cpp for all targets.
228  # Rename it to target_alias-cpp
[fa42a76b]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
[afe5cac]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
[55f4d3d4]247  f=`gcc/xgcc -Bgcc/ --print-multi-lib | sed -e 's,;.*$,,'`
[6e9746a2]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"
[afe5cac]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
[6e9746a2]274  cp dirs files.g++
[afe5cac]275
[6e9746a2]276  TGTDIR="%{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@"
[afe5cac]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
[d35b77f]280    *lib*.la) rm ${RPM_BUILD_ROOT}/$i ;; # ignore: gcc produces bogus libtool libs
[afe5cac]281    *f771) ;;
282    *cc1obj) ;;
283    *libobjc*) echo "$i" >> files.objc ;;
284    *include/objc*) ;;
[6e9746a2]285    *include/g++*);;
[682c7502]286    *include/c++*);;
[513afacb]287    *adainclude*);;
288    *adalib*);;
289    *gnat1);;
[afe5cac]290    *jc1) ;;
291    *jvgenmain) ;;
[343d4ff]292    *cc1plus) ;; # ignore: explicitly put into rpm elsewhere
[6e9746a2]293    *libstdc++.a) echo "$i" >> files.g++ ;;
294    *libsupc++.a) echo "$i" >> files.g++ ;;
[afe5cac]295    *) echo "$i" >> files.gcc ;;
296    esac
297  done
298
[6e9746a2]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
[d35b77f]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
[6e9746a2]305# all other files belong to gcc
306    *) echo "$i" >> files.gcc ;;
307    esac
308  done
309
[afe5cac]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.