source: rtems/scripts/gcc3newlib/gccnewlib.add @ 09969a8d

Last change on this file since 09969a8d was 8a1d1e0b, checked in by Ralf Corsepius <ralf.corsepius@…>, on 02/26/03 at 15:52:36

2003-02-26 Ralf Corsepius <corsepiu@…>

  • gcc3newlib/gccnewlib.add: Add %gcc_version, %newlib_version. Apply %gcc_version, %newlib_version.
  • gcc3newlib/target-c++.add: Apply %gcc_version, %newlib_version.
  • gcc3newlib/target-g77.add: Apply %gcc_version, %newlib_version.
  • gcc3newlib/target-gcc.add: Apply %gcc_version, %newlib_version.
  • gcc3newlib/target-gcj.add: Apply %gcc_version, %newlib_version.
  • gcc3newlib/target-gnat.add: Apply %gcc_version, %newlib_version.
  • gcc3newlib/target-objc.add: Apply %gcc_version, %newlib_version.
  • Property mode set to 100644
File size: 9.3 KB
Line 
1
2%define gcc_version     @gcc_version@
3%define newlib_version  @newlib_version@
4
5Name:         @target_alias@-gcc-newlib
6Summary:      gcc and newlib C Library for @target_alias@.
7Group:        rtems
8Release:      @Release@
9License:      gcc is GPL/LGPL ; newlib no has restrictions on run-time usage
10
11Autoreqprov:    on
12Packager:       corsepiu@faw.uni-ulm.de and joel@OARcorp.com
13
14Version:        gcc%{gcc_version}newlib%{newlib_version}
15# gcc 3.x and gcc 2.9
16Source0:      ftp://ftp.gnu.org/pub/gnu/gcc/gcc-%{gcc_version}.tar.gz
17# Source0:      ftp://ftp.gnu.org/pub/gnu/gcc/gcc-%{gcc_version}.tar.bz2
18# gcc 2.95.x
19# Source0:      ftp://ftp.gnu.org/pub/gnu/gcc/gcc-%{gcc_version}.tar.bz2
20Source1:        ftp://sources.redhat.com/pub/newlib/newlib-%{newlib_version}.tar.gz
21@PATCH1@
22@PATCH3@
23BuildPreReq:    texinfo >= 4.2
24BuildPreReq:    @target_alias@-binutils
25#
26# The original sources are not included in the source RPM.
27# If we included them, then the source RPMs for each target
28# would duplicate MBs of source unnecessarily.  This is
29# a duplication of over 30 MBs of source for each of
30# the more than 10 targets it is possible to build.
31#
32# You can get them yourself from the Internet and copy them to
33# your /usr/src/redhat/SOURCES directory ($RPM_SOURCE_DIR).
34# Or you can try the ftp options of rpm :-)
35#
36NoSource:       0
37NoSource:       1
38
39# Use rpm -ba --define 'gnat [0|1]' xxx.spec to override building gnat for
40# those targets wanting to support ada.
41
42%if "%{gcc_version}" >= "3.2"
43# default to building gnat
44%define _gnat   %{?gnat:%gnat}%{!?gnat:1}
45%else
46# default to not building gnat
47%define _gnat   %{?gnat:%gnat}%{!?gnat:0}
48%endif
49
50# Use rpm -ba --define 'gcj [0|1]' xxx.spec to override building gcj for
51# those targets wanting to support gcj.
52
53%if "%{gcc_version}" >= "3.2"
54# default to building gcj
55%define _gcj    %{?gcj:%gcj}%{!?gcj:1}
56%else
57# default to not building gcj
58%define _gcj    %{?gnat:%gcj}%{!?gcj:0}
59%endif
60
61
62%define build_cxx       1
63%define build_g77       0
64%define build_objc      0
65%define build_gcj       0
66%define build_gnat      0
67
68%if "@target_alias@" == "arm-rtems"
69%define build_gcj       %_gcj
70%endif
71
72%if "@target_alias@" == "c4x-rtems"
73%define build_cxx       0
74%endif
75
76%if "@target_alias@" == "i386-rtems"
77%define build_gnat      %_gnat
78%define build_gcj       %_gcj
79%endif
80
81%if "@target_alias@" == "i960-rtems"
82%define build_cxx       0
83%endif
84
85%if "@target_alias@" == "m68k-rtems"
86%define build_gcj       %_gcj
87%endif
88
89%if "@target_alias@" == "mips-rtems"
90%define build_gnat      %_gnat
91%define build_gcj       %_gcj
92%endif
93
94%if "@target_alias@" == "powerpc-rtems"
95%define build_gnat      %_gnat
96%define build_gcj       %_gcj
97%endif
98
99%if "@target_alias@" == "sparc-rtems"
100%define build_gnat      %_gnat
101%define build_gcj       %_gcj
102%endif
103
104%if %build_gcj
105# Building gcj requires bison and zlib
106BuildPreReq:    bison
107%if "%_vendor" == "redhat"
108BuildPreReq:    zlib-devel
109%endif
110%endif
111
112%if %build_gnat
113# Building gnat requires gnat
114%if "%_vendor" == "redhat"
115BuildPreReq:    gcc-gnat
116%endif
117%endif
118
119%description
120RTEMS is an open source operating system for embedded systems.
121
122This is gcc's and newlib C Library's sources with patches for RTEMS.
123
124 The original sources are not included in the source RPM.
125 If we included them, then the source RPMs for each target
126 would duplicate MBs of source unnecessarily.  This is
127 a duplication of over 30 MBs of source for each of
128 the more than 10 targets it is possible to build.
129
130 You can get them yourself from the Internet and copy them to
131 your /usr/src/[redhat|packages]/SOURCES directory ($RPM_SOURCE_DIR).
132 Or you can try the ftp options of rpm :-)
133
134%prep
135# untar the sources inside @target_alias@-gcc-newlib
136%setup -c -T -n %{name} -a0 -a1
137
138@PATCH2@
139@PATCH4@
140
141  cd gcc-%{gcc_version}
142    sed -e 's/\(version_string = \"[^\"]*\)/\1 (OAR Corporation gcc-%{gcc_version}-@gcc_patch_version@\/newlib-%{newlib_version}-@newlib_patch_version@-@Release@)/' \
143    gcc/version.c > gcc/version.c~
144    mv gcc/version.c~  gcc/version.c
145
146  # Fix timestamps
147    contrib/gcc_update --touch
148  cd ..
149
150  # Copy the C library into gcc's source tree
151  ln -s ../newlib-%{newlib_version}/newlib gcc-%{gcc_version}
152  test -d build || mkdir build
153
154%build
155  cd build
156
157#  ALERT: GCJ would be better if we could add this flag and build
158#  it's libraries but this code isn't ready to be embedded.
159#  libgcj_flag="--enable-libgcj"
160
161  languages="c"
162%if %build_cxx
163  languages="$languages,c++"
164%endif
165%if %build_g77
166  languages="$languages,g77"
167%endif
168%if %build_gcj
169  languages="$languages,java"
170%endif
171%if %build_objc
172  languages="$languages,objc"
173%endif
174%if %build_gnat
175  languages="$languages,ada"
176%endif
177  ../gcc-%{gcc_version}/configure \
178    --build=%_build --host=%_host \
179    --target=@target_alias@ \
180    --with-gnu-as --with-gnu-ld --with-newlib --verbose \
181    --with-system-zlib --disable-nls \
182    --enable-version-specific-runtime-libs \
183    --enable-threads=rtems --prefix=%{_prefix} \
184    --enable-languages=$languages ${libgcj_flag}
185
186%if "%_host" != "%_build"
187  # Bug in gcc-3.2.1:
188  # Somehow, gcc doesn't get syslimits.h right for Cdn-Xs
189  test -d gcc/include || mkdir -p gcc/include
190  cp ../gcc-%{gcc_version}/gcc/gsyslimits.h gcc/include/syslimits.h
191%endif
192
193%if %build_gnat
194  cd ../gcc-%{gcc_version}/gcc/ada
195  touch treeprs.ads [es]info.h nmake.ad[bs]
196  cd ../../../build
197%endif
198  make all
199%if %build_gnat
200# This gnat configuration is crap :(
201
202# This is what is documented, but it doesn't work for me (RC)
203#  make gnatlib_and_tools
204  make -C gcc cross-gnattools
205  make -C gcc ada.all.cross
206
207# This should work, but doesn't.
208#  make -C gcc gnatlib
209
210# This is what gcc/ada/Makefile.in contains by default,
211# but what we override below
212  GNATLIBCFLAGS="-g -O2"
213# Let gnatlib building find newlib's headers
214  GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/@target_alias@/newlib/targ-include"
215  GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/../newlib-%{newlib_version}/newlib/libc/include"
216# Without this xgcc doesn't find the target's binutils.
217  GNATLIBCFLAGS="$GNATLIBCFLAGS -B%{_prefix}/@target_alias@/bin/"
218%if "@target_alias@" == "mips-rtems"
219  GNATLIBCFLAGS="$GNATLIBCFLAGS -G0"
220%endif
221  make -C gcc GNATLIBCFLAGS="${GNATLIBCFLAGS}" gnatlib
222%endif
223  make info
224
225%install
226  cd build
227# Bug in gcc-2.95.1: It doesn't build this installation directory
228# If it doesn't find it, gcc doesn't install @target_alias@/bin/gcc
229%if "%{gcc_version}" < "3.0"
230  ../gcc-%{gcc_version}/mkinstalldirs \
231    $RPM_BUILD_ROOT%{_prefix}/@target_alias@/bin
232%endif
233
234  make prefix=$RPM_BUILD_ROOT%{_prefix} \
235    bindir=$RPM_BUILD_ROOT%{_bindir} install
236  cd @target_alias@/newlib
237  make prefix=$RPM_BUILD_ROOT%{_prefix} \
238    bindir=$RPM_BUILD_ROOT%{_bindir} install-info
239  # cd back to build/
240  cd ../..
241
242%if %build_gnat
243# Install a copy of gcc as gnatgcc
244# Enables us to mix different versions of gnat and gnatgcc
245  rm -f $RPM_BUILD_ROOT%{_bindir}/@target_alias@-gnatgcc%{_exeext}
246  ln $RPM_BUILD_ROOT%{_bindir}/@target_alias@-gcc%{_exeext} \
247    $RPM_BUILD_ROOT%{_bindir}/@target_alias@-gnatgcc%{_exeext}
248%endif
249
250  # Bug in gcc-3.x: It puts the build dirs into *.la files
251
252  # host library
253  rm -f  ${RPM_BUILD_ROOT}%{_prefix}/lib/libiberty.a
254
255%if "%{gcc_version}" < "3.0"
256  # Bug in gcc-2.95.x: It bogusly tries to share cpp for all targets.
257  # Rename it to target_alias-cpp
258  if test -f $RPM_BUILD_ROOT%{_prefix}/bin/cpp%{_exeext};
259  then
260    mv $RPM_BUILD_ROOT%{_prefix}/bin/cpp%{_exeext} \
261      $RPM_BUILD_ROOT%{_prefix}/bin/@target_alias@-cpp%{_exeext}
262  fi
263%endif
264
265  # gzip info files
266  gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info 2>/dev/null
267  gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info-? 2>/dev/null
268  gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info-?? 2>/dev/null
269
270  rm -f dirs ;
271  echo "%defattr(-,root,root)" >> dirs
272  echo "%dir %{_prefix}/lib" >> dirs ;
273  echo "%dir %{_prefix}/lib/gcc-lib" >> dirs ;
274  echo "%dir %{_prefix}/lib/gcc-lib/@target_alias@" >> dirs ;
275
276  # Collect multilib subdirectories
277  f=`gcc/xgcc -Bgcc/ --print-multi-lib | sed -e 's,;.*$,,'`
278
279  TGTDIR="%{_prefix}/lib/gcc-lib/@target_alias@/%{gcc_version}"
280  for i in $f; do
281    case $i in
282    \.) echo "%dir ${TGTDIR}" >> dirs
283      ;;
284    *)  echo "%dir ${TGTDIR}/$i" >> dirs
285      ;;
286    esac
287  done
288
289  TGTDIR="%{_prefix}/@target_alias@/lib"
290  for i in $f; do
291    case $i in
292    \.) echo "%dir ${TGTDIR}" >> dirs
293      ;;
294    *)  echo "%dir ${TGTDIR}/$i" >> dirs
295      ;;
296    esac
297  done
298
299  # Collect files to go into different packages
300  cp dirs files.gcc
301  cp dirs files.g77
302  cp dirs files.objc
303  cp dirs files.gcj
304  cp dirs files.g++
305
306  TGTDIR="%{_prefix}/lib/gcc-lib/@target_alias@/%{gcc_version}"
307  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
308  for i in $f; do
309    case $i in
310    *lib*.la) rm ${RPM_BUILD_ROOT}/$i ;; # ignore: gcc produces bogus libtool libs
311    *f771) ;;
312    *cc1obj) ;;
313    *libobjc*) echo "$i" >> files.objc ;;
314    *include/objc*) ;;
315    *include/g++*);;
316    *include/c++*);;
317    *adainclude*);;
318    *adalib*);;
319    *gnat1);;
320    *jc1) ;;
321    *jvgenmain) ;;
322    *cc1plus) ;; # ignore: explicitly put into rpm elsewhere
323    *libstdc++.a) echo "$i" >> files.g++ ;;
324    *libsupc++.a) echo "$i" >> files.g++ ;;
325    *) echo "$i" >> files.gcc ;;
326    esac
327  done
328
329  TGTDIR="%{_prefix}/@target_alias@/lib"
330  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
331  for i in $f; do
332    case $i in
333    *lib*.la) rm ${RPM_BUILD_ROOT}/$i;; # ignore - gcc produces bogus libtool libs
334    *libiberty.a) rm ${RPM_BUILD_ROOT}/$i ;; # ignore - GPL'ed
335# all other files belong to gcc
336    *) echo "$i" >> files.gcc ;;
337    esac
338  done
339
Note: See TracBrowser for help on using the repository browser.