source: rtems/scripts/gcc3newlib/gccnewlib.add @ 2e332a9

4.104.114.84.95
Last change on this file since 2e332a9 was 2e332a9, checked in by Joel Sherrill <joel.sherrill@…>, on 12/02/02 at 19:17:27

2002-12-02 Joel Sherrill <joel@…>

  • setup.def, gcc3newlib/gccnewlib.add: Updated to gcc 3.2.1 RPM revision 2 which enabled the mips-rtems gnat using gcc 3.2.1 patch 20021129.
  • Property mode set to 100644
File size: 8.8 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  cd gcc-@gcc_version@
123    sed -e 's/\(version_string = \"[^\"]*\)/\1 (OAR Corporation gcc-@gcc_version@-@gcc_patch_version@\/newlib-@newlib_version@-@newlib_patch_version@ @Release@)/' \
124    gcc/version.c > gcc/version.c~
125    mv gcc/version.c~  gcc/version.c
126
127  # Fix timestamps
128    contrib/gcc_update --touch
129  cd ..
130
131  # Copy the C library into gcc's source tree
132  ln -s ../newlib-@newlib_version@/newlib gcc-@gcc_version@
133  test -d build || mkdir build
134
135%build
136  cd build
137
138# HACK: This doesn't work
139# %if "%{_target_os}" != "%{_build_os}"
140#    CONFIGURE_ARGS="--build=%{_build} --host=%{_target}"
141# %endif
142#  ALERT: GCJ would be better if we could add this flag and build
143#  it's libraries but this code isn't ready to be embedded.
144#  libgcj_flag="--enable-libgcj"
145
146  languages="c"
147%if %build_cxx
148  languages="$languages,c++"
149%endif
150%if %build_g77
151  languages="$languages,g77"
152%endif
153%if %build_gcj
154  languages="$languages,java"
155%endif
156%if %build_objc
157  languages="$languages,objc"
158%endif
159%if %build_gnat
160  languages="$languages,ada"
161%endif
162  ../gcc-@gcc_version@/configure $CONFIGURE_ARGS --target=@target_alias@ \
163    --with-gnu-as --with-gnu-ld --with-newlib --verbose \
164    --with-system-zlib --disable-nls \
165    --enable-version-specific-runtime-libs \
166    --enable-threads=rtems --prefix=%{_prefix} \
167    --enable-languages=$languages ${libgcj_flag}
168%if %build_gnat
169  cd ../gcc-@gcc_version@/gcc/ada
170  touch treeprs.ads [es]info.h nmake.ad[bs]
171  cd ../../../build
172%endif
173  make all
174%if %build_gnat
175# This gnat configuration is crap :(
176
177# This is what is documented, but it doesn't work for me (RC)
178#  make gnatlib_and_tools
179  make -C gcc cross-gnattools
180  make -C gcc ada.all.cross
181
182# This should work, but doesn't.
183#  make -C gcc gnatlib
184
185# This is what gcc/ada/Makefile.in contains by default,
186# but what we override below
187  GNATLIBCFLAGS="-g -O2"
188# Let gnatlib building find newlib's headers
189  GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/@target_alias@/newlib/targ-include"
190  GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/../newlib-@newlib_version@/newlib/libc/include"
191# Without this xgcc doesn't find the target's binutils.
192  GNATLIBCFLAGS="$GNATLIBCFLAGS -B%{_prefix}/@target_alias@/bin/"
193  make -C gcc GNATLIBCFLAGS="${GNATLIBCFLAGS}" gnatlib
194%endif
195  make info
196
197%install
198  cd build
199# Bug in gcc-2.95.1: It doesn't build this installation directory
200# If it doesn't find it, gcc doesn't install @target_alias@/bin/gcc
201%if "@gcc_version@" < "3.0"
202  ../gcc-@gcc_version@/mkinstalldirs \
203    $RPM_BUILD_ROOT%{_prefix}/@target_alias@/bin
204%endif
205
206  make prefix=$RPM_BUILD_ROOT%{_prefix} \
207    bindir=$RPM_BUILD_ROOT%{_bindir} install
208  cd @target_alias@/newlib
209  make prefix=$RPM_BUILD_ROOT%{_prefix} \
210    bindir=$RPM_BUILD_ROOT%{_bindir} install-info
211  # cd back to build/
212  cd ../..
213
214%if %build_gnat
215# Install a copy of gcc as gnatgcc
216# Enables us to mix different versions of gnat and gnatgcc
217  rm -f $RPM_BUILD_ROOT%{_bindir}/@target_alias@-gnatgcc@exe_ext@
218  ln $RPM_BUILD_ROOT%{_bindir}/@target_alias@-gcc@exe_ext@ \
219    $RPM_BUILD_ROOT%{_bindir}/@target_alias@-gnatgcc@exe_ext@
220%endif
221
222  # Bug in gcc-3.x: It puts the build dirs into *.la files
223
224  # host library
225  rm -f  ${RPM_BUILD_ROOT}%{_prefix}/lib/libiberty.a
226
227%if "@gcc_version@" < "3.0"
228  # Bug in gcc-2.95.x: It bogusly tries to share cpp for all targets.
229  # Rename it to target_alias-cpp
230  if test -f $RPM_BUILD_ROOT%{_prefix}/bin/cpp@exe_ext@;
231  then
232    mv $RPM_BUILD_ROOT%{_prefix}/bin/cpp@exe_ext@ \
233      $RPM_BUILD_ROOT%{_prefix}/bin/@target_alias@-cpp@exe_ext@
234  fi
235%endif
236
237  # gzip info files
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  gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info-?? 2>/dev/null
241
242  rm -f dirs ;
243  echo "%dir %{_prefix}/lib" >> dirs ;
244  echo "%dir %{_prefix}/lib/gcc-lib" >> dirs ;
245  echo "%dir %{_prefix}/lib/gcc-lib/@target_alias@" >> dirs ;
246
247  # Collect multilib subdirectories
248  f=`gcc/xgcc -Bgcc/ --print-multi-lib | sed -e 's,;.*$,,'`
249
250  TGTDIR="%{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@"
251  for i in $f; do
252    case $i in
253    \.) echo "%dir ${TGTDIR}" >> dirs
254      ;;
255    *)  echo "%dir ${TGTDIR}/$i" >> dirs
256      ;;
257    esac
258  done
259
260  TGTDIR="%{_prefix}/@target_alias@/lib"
261  for i in $f; do
262    case $i in
263    \.) echo "%dir ${TGTDIR}" >> dirs
264      ;;
265    *)  echo "%dir ${TGTDIR}/$i" >> dirs
266      ;;
267    esac
268  done
269
270  # Collect files to go into different packages
271  cp dirs files.gcc
272  cp dirs files.g77
273  cp dirs files.objc
274  cp dirs files.gcj
275  cp dirs files.g++
276
277  TGTDIR="%{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@"
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) rm ${RPM_BUILD_ROOT}/$i ;; # ignore: gcc produces bogus libtool libs
282    *f771) ;;
283    *cc1obj) ;;
284    *libobjc*) echo "$i" >> files.objc ;;
285    *include/objc*) ;;
286    *include/g++*);;
287    *include/c++*);;
288    *adainclude*);;
289    *adalib*);;
290    *gnat1);;
291    *jc1) ;;
292    *jvgenmain) ;;
293    *cc1plus) ;; # ignore: explicitly put into rpm elsewhere
294    *libstdc++.a) echo "$i" >> files.g++ ;;
295    *libsupc++.a) echo "$i" >> files.g++ ;;
296    *) echo "$i" >> files.gcc ;;
297    esac
298  done
299
300  TGTDIR="%{_prefix}/@target_alias@/lib"
301  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
302  for i in $f; do
303    case $i in
304    *lib*.la) rm ${RPM_BUILD_ROOT}/$i;; # ignore - gcc produces bogus libtool libs
305    *libiberty.a) rm ${RPM_BUILD_ROOT}/$i ;; # ignore - GPL'ed
306# all other files belong to gcc
307    *) echo "$i" >> files.gcc ;;
308    esac
309  done
310
311%clean
312# let rpm --clean remove BuildRoot iif using the default BuildRoot
313  test "$RPM_BUILD_ROOT" = "%{_tmppath}/%{name}" && \
314    rm -rf $RPM_BUILD_ROOT
Note: See TracBrowser for help on using the repository browser.