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

4.104.114.84.95
Last change on this file since d35b77f was d35b77f, checked in by Ralf Corsepius <ralf.corsepius@…>, on 11/25/02 at 15:24:05

2002-11-25 Ralf Corsepius <corsepiu@…>

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