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 Nov 25, 2002 at 3:24:05 PM

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
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_gcj       1
74%endif
75
76%if "@target_alias@" == "i960-rtems"
77%define build_cxx       0
78%endif
79
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
88%if "@target_alias@" == "powerpc-rtems"
89%define build_gnat      %_gnat
90%define build_gcj       1
91%endif
92
93%if "@target_alias@" == "sparc-rtems"
94%define build_gnat      %_gnat
95%define build_gcj       1
96%endif
97
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
115%setup -c -T -n %{name} -a0 -a1
116
117@PATCH2@
118@PATCH4@
119
120  cd gcc-@gcc_version@
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
126    contrib/gcc_update --touch
127  cd ..
128
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
136# HACK: This doesn't work
137# %if "%{_target_os}" != "%{_build_os}"
138#    CONFIGURE_ARGS="--build=%{_build} --host=%{_target}"
139# %endif
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"
143
144  languages="c"
145%if %build_cxx
146  languages="$languages,c++"
147%endif
148%if %build_g77
149  languages="$languages,g77"
150%endif
151%if %build_gcj
152  languages="$languages,java"
153%endif
154%if %build_objc
155  languages="$languages,objc"
156%endif
157%if %build_gnat
158  languages="$languages,ada"
159%endif
160  ../gcc-@gcc_version@/configure $CONFIGURE_ARGS --target=@target_alias@ \
161    --with-gnu-as --with-gnu-ld --with-newlib --verbose \
162    --with-system-zlib --disable-nls \
163    --enable-version-specific-runtime-libs \
164    --enable-threads=rtems --prefix=%{_prefix} \
165    --enable-languages=$languages ${libgcj_flag}
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
171  make all
172%if %build_gnat
173# This gnat configuration is crap :(
174
175# This is what is documented, but it doesn't work for me (RC)
176#  make gnatlib_and_tools
177  make -C gcc cross-gnattools
178  make -C gcc ada.all.cross
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
192%endif
193  make info
194
195%install
196  cd build
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
203
204  make prefix=$RPM_BUILD_ROOT%{_prefix} \
205    bindir=$RPM_BUILD_ROOT%{_bindir} install
206  cd @target_alias@/newlib
207  make prefix=$RPM_BUILD_ROOT%{_prefix} \
208    bindir=$RPM_BUILD_ROOT%{_bindir} install-info
209  # cd back to build/
210  cd ../..
211
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
221
222  # host library
223  rm -f  ${RPM_BUILD_ROOT}%{_prefix}/lib/libiberty.a
224
225%if "@gcc_version@" < "3.0"
226  # Bug in gcc-2.95.x: It bogusly tries to share cpp for all targets.
227  # Rename it to target_alias-cpp
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
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
246  f=`gcc/xgcc -Bgcc/ --print-multi-lib | sed -e 's,;.*$,,'`
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"
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
273  cp dirs files.g++
274
275  TGTDIR="%{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@"
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
279    *lib*.la) rm ${RPM_BUILD_ROOT}/$i ;; # ignore: gcc produces bogus libtool libs
280    *f771) ;;
281    *cc1obj) ;;
282    *libobjc*) echo "$i" >> files.objc ;;
283    *include/objc*) ;;
284    *include/g++*);;
285    *include/c++*);;
286    *adainclude*);;
287    *adalib*);;
288    *gnat1);;
289    *jc1) ;;
290    *jvgenmain) ;;
291    *cc1plus) ;; # ignore: explicitly put into rpm elsewhere
292    *libstdc++.a) echo "$i" >> files.g++ ;;
293    *libsupc++.a) echo "$i" >> files.g++ ;;
294    *) echo "$i" >> files.gcc ;;
295    esac
296  done
297
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
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
304# all other files belong to gcc
305    *) echo "$i" >> files.gcc ;;
306    esac
307  done
308
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.