source: rtems/scripts/gcc3newlib/gccnewlib.add @ 4f7ee21

4.104.114.84.95
Last change on this file since 4f7ee21 was 4f7ee21, checked in by Joel Sherrill <joel.sherrill@…>, on 12/06/02 at 13:51:15

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

  • setup.def: Updated patch to fix m68k cut and paste bug which turned a tab into spaces in a Makefile fragment.
  • gcc3newlib/gccnewlib.add: If building gnat for the mips, the library must be built with a -G0 option.
  • Property mode set to 100644
File size: 8.9 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%if "@target_alias@" == "mips-rtems"
194  GNATLIBCFLAGS="$GNATLIBCFLAGS -G0"
195%endif
196  make -C gcc GNATLIBCFLAGS="${GNATLIBCFLAGS}" gnatlib
197%endif
198  make info
199
200%install
201  cd build
202# Bug in gcc-2.95.1: It doesn't build this installation directory
203# If it doesn't find it, gcc doesn't install @target_alias@/bin/gcc
204%if "@gcc_version@" < "3.0"
205  ../gcc-@gcc_version@/mkinstalldirs \
206    $RPM_BUILD_ROOT%{_prefix}/@target_alias@/bin
207%endif
208
209  make prefix=$RPM_BUILD_ROOT%{_prefix} \
210    bindir=$RPM_BUILD_ROOT%{_bindir} install
211  cd @target_alias@/newlib
212  make prefix=$RPM_BUILD_ROOT%{_prefix} \
213    bindir=$RPM_BUILD_ROOT%{_bindir} install-info
214  # cd back to build/
215  cd ../..
216
217%if %build_gnat
218# Install a copy of gcc as gnatgcc
219# Enables us to mix different versions of gnat and gnatgcc
220  rm -f $RPM_BUILD_ROOT%{_bindir}/@target_alias@-gnatgcc@exe_ext@
221  ln $RPM_BUILD_ROOT%{_bindir}/@target_alias@-gcc@exe_ext@ \
222    $RPM_BUILD_ROOT%{_bindir}/@target_alias@-gnatgcc@exe_ext@
223%endif
224
225  # Bug in gcc-3.x: It puts the build dirs into *.la files
226
227  # host library
228  rm -f  ${RPM_BUILD_ROOT}%{_prefix}/lib/libiberty.a
229
230%if "@gcc_version@" < "3.0"
231  # Bug in gcc-2.95.x: It bogusly tries to share cpp for all targets.
232  # Rename it to target_alias-cpp
233  if test -f $RPM_BUILD_ROOT%{_prefix}/bin/cpp@exe_ext@;
234  then
235    mv $RPM_BUILD_ROOT%{_prefix}/bin/cpp@exe_ext@ \
236      $RPM_BUILD_ROOT%{_prefix}/bin/@target_alias@-cpp@exe_ext@
237  fi
238%endif
239
240  # gzip info files
241  gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info 2>/dev/null
242  gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info-? 2>/dev/null
243  gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info-?? 2>/dev/null
244
245  rm -f dirs ;
246  echo "%dir %{_prefix}/lib" >> dirs ;
247  echo "%dir %{_prefix}/lib/gcc-lib" >> dirs ;
248  echo "%dir %{_prefix}/lib/gcc-lib/@target_alias@" >> dirs ;
249
250  # Collect multilib subdirectories
251  f=`gcc/xgcc -Bgcc/ --print-multi-lib | sed -e 's,;.*$,,'`
252
253  TGTDIR="%{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@"
254  for i in $f; do
255    case $i in
256    \.) echo "%dir ${TGTDIR}" >> dirs
257      ;;
258    *)  echo "%dir ${TGTDIR}/$i" >> dirs
259      ;;
260    esac
261  done
262
263  TGTDIR="%{_prefix}/@target_alias@/lib"
264  for i in $f; do
265    case $i in
266    \.) echo "%dir ${TGTDIR}" >> dirs
267      ;;
268    *)  echo "%dir ${TGTDIR}/$i" >> dirs
269      ;;
270    esac
271  done
272
273  # Collect files to go into different packages
274  cp dirs files.gcc
275  cp dirs files.g77
276  cp dirs files.objc
277  cp dirs files.gcj
278  cp dirs files.g++
279
280  TGTDIR="%{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@"
281  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
282  for i in $f; do
283    case $i in
284    *lib*.la) rm ${RPM_BUILD_ROOT}/$i ;; # ignore: gcc produces bogus libtool libs
285    *f771) ;;
286    *cc1obj) ;;
287    *libobjc*) echo "$i" >> files.objc ;;
288    *include/objc*) ;;
289    *include/g++*);;
290    *include/c++*);;
291    *adainclude*);;
292    *adalib*);;
293    *gnat1);;
294    *jc1) ;;
295    *jvgenmain) ;;
296    *cc1plus) ;; # ignore: explicitly put into rpm elsewhere
297    *libstdc++.a) echo "$i" >> files.g++ ;;
298    *libsupc++.a) echo "$i" >> files.g++ ;;
299    *) echo "$i" >> files.gcc ;;
300    esac
301  done
302
303  TGTDIR="%{_prefix}/@target_alias@/lib"
304  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
305  for i in $f; do
306    case $i in
307    *lib*.la) rm ${RPM_BUILD_ROOT}/$i;; # ignore - gcc produces bogus libtool libs
308    *libiberty.a) rm ${RPM_BUILD_ROOT}/$i ;; # ignore - GPL'ed
309# all other files belong to gcc
310    *) echo "$i" >> files.gcc ;;
311    esac
312  done
313
314%clean
315# let rpm --clean remove BuildRoot iif using the default BuildRoot
316  test "$RPM_BUILD_ROOT" = "%{_tmppath}/%{name}" && \
317    rm -rf $RPM_BUILD_ROOT
Note: See TracBrowser for help on using the repository browser.