source: rtems/scripts/gcc3newlib/gccnewlib.add @ 3e1526f

4.104.114.84.95
Last change on this file since 3e1526f was 3e1526f, checked in by Joel Sherrill <joel.sherrill@…>, on Aug 21, 2002 at 6:50:04 PM

2002-08-21 Joel Sherrill <joel@…>

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