source: rtems/scripts/gcc3newlib/gccnewlib.add @ 233186a

4.104.114.84.95
Last change on this file since 233186a was 233186a, checked in by Ralf Corsepius <ralf.corsepius@…>, on 02/24/05 at 06:33:57

2005-02-24 Ralf Corsepius <ralf.corsepius@…>

  • gcc3newlib/gccnewlib.add, gcc3newlib/mkspec.in, setup.def: Add gcc_suffix. Add newlib_suffix.
  • Property mode set to 100644
File size: 11.4 KB
Line 
1
2%define gcc_version     @gcc_version@
3%define newlib_version  @newlib_version@
4
5%define gcc_target      @target_alias@
6
7Name:           %{rpmprefix}%{gcc_target}-gcc-newlib
8Summary:        gcc and newlib C Library for %{gcc_target}.
9Group:          %{rpmgroup}
10Release:        @Release@
11Epoch:          0
12License:        gcc is GPL/LGPL ; newlib no has restrictions on run-time usage
13
14Autoreqprov:    on
15Packager:       ralf.corsepius@rtems.org and joel@OARcorp.com
16
17Version:        gcc%{gcc_version}newlib%{newlib_version}
18
19%if "%{gcc_version}" >= "3.2.2"
20Source0: ftp://ftp.gnu.org/pub/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}@gcc_suffix@
21%else
22%if "%{gcc_version}" >= "3.0"
23Source0: ftp://ftp.gnu.org/pub/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}.tar.gz
24%else
25Source0: ftp://ftp.gnu.org/pub/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}-everything.tar.gz
26%endif
27%endif
28Source1:        ftp://sources.redhat.com/pub/newlib/newlib-%{newlib_version}@newlib_suffix@
29@PATCH1@
30@PATCH3@
31BuildPreReq:    texinfo >= 4.2
32BuildPreReq:    %{rpmprefix}%{gcc_target}-binutils
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# default to not building gnat
51# gcc-3.3: Doesn't support cross-building gnatlib
52# gcc-3.4.0: Doesn't support cross-build gnattools
53# gcc-4.0.0: Doesn't support newlib
54%define _gnat   %{?gnat:%gnat}%{!?gnat:0}
55
56# Use rpm -ba --define 'gcj [0|1]' xxx.spec to override building gcj for
57# those targets wanting to support gcj.
58
59%if "%{gcc_version}" >= "3.4"
60# default to building gcj
61%define _gcj    %{?gcj:%gcj}%{!?gcj:1}
62%else
63# default to not building gcj
64%define _gcj    %{?gcj:%gcj}%{!?gcj:0}
65%endif
66
67
68%define build_cxx       %{?cxx:%cxx}%{!?cxx:1}
69%define build_g77       %{?g77:%g77}%{!?g77:0}
70%define build_objc      %{?objc:%objc}%{!?objc:0}
71%define build_gcj       0
72%define build_gnat      0
73
74%if "%{gcc_target}" == "arm-rtems@osversion@"
75%define build_gcj       %_gcj
76%endif
77
78%if "%{gcc_target}" == "avr-rtems@osversion@"
79%define build_cxx       0
80%endif
81
82%if "%{gcc_target}" == "tic4x-rtems@osversion@"
83%define build_cxx       0
84%endif
85
86# OBSOLETE: use tic4x instead
87%if "%{gcc_target}" == "c4x-rtems@osversion@"
88%define build_cxx       0
89%endif
90
91%if "%{gcc_target}" == "i386-rtems@osversion@"
92%define build_gnat      %_gnat
93%define build_gcj       %_gcj
94%endif
95
96%if "%{gcc_target}" == "m68k-rtems@osversion@"
97%define build_gcj       %_gcj
98%endif
99
100%if "%{gcc_target}" == "mips-rtems@osversion@"
101%define build_gnat      %_gnat
102%define build_gcj       %_gcj
103%endif
104
105%if "%{gcc_target}" == "powerpc-rtems@osversion@"
106%define build_gnat      %_gnat
107%define build_gcj       %_gcj
108%endif
109
110# gcc 3.4.0 is broken for embedded sparc and gnat trips it.
111%if "%{gcc_target}" == "sparc-rtems@osversion@"
112%if "%{gcc_version}" >= "3.4"
113%define build_gnat      0
114%else
115%define build_gnat      %_gnat
116%endif
117%define build_gcj       %_gcj
118%endif
119
120%if %build_gcj
121# Building gcj requires bison and zlib
122BuildPreReq:    bison
123%if "%_vendor" == "redhat"
124BuildPreReq:    zlib-devel
125%endif
126%endif
127
128%if %build_gnat
129# Building gnat requires gnat
130%if "%_vendor" == "redhat"
131# This really isn't available until RedHat 8.0.  How to conditionalize this?
132# BuildPreReq:  gcc-gnat
133%endif
134%endif
135
136%if "%{gcc_version}" >= "3.4"
137%define gcclib %{_libdir}/gcc
138%define gccexec %{_libexecdir}/gcc
139%else
140%define gcclib %{_libdir}/gcc-lib
141%define gccexec %{_libdir}/gcc-lib
142%endif
143
144%description
145RTEMS is an open source operating system for embedded systems.
146
147This is gcc's and newlib C Library's sources with patches for RTEMS.
148
149 The original sources are not included in the source RPM.
150 If we included them, then the source RPMs for each target
151 would duplicate MBs of source unnecessarily.  This is
152 a duplication of over 30 MBs of source for each of
153 the more than 10 targets it is possible to build.
154
155 You can get them yourself from the Internet and copy them to
156 your /usr/src/[redhat|packages]/SOURCES directory ($RPM_SOURCE_DIR).
157 Or you can try the ftp options of rpm :-)
158
159%prep
160# untar the sources inside %{gcc_target}-gcc-newlib
161%setup -c -T -n %{name}-%{version} -a0 -a1
162
163@PATCH2@
164@PATCH4@
165
166  cd gcc-%{gcc_version}
167    sed -e 's/\(version_string = \"[^\"]*\)/\1 (RTEMS gcc-%{gcc_version}-@gcc_patch_version@\/newlib-%{newlib_version}-@newlib_patch_version@-@Release@)/' \
168    gcc/version.c > gcc/version.c~
169    mv gcc/version.c~  gcc/version.c
170
171  # Fix timestamps
172    contrib/gcc_update --touch
173  cd ..
174
175  # Copy the C library into gcc's source tree
176  ln -s ../newlib-%{newlib_version}/newlib gcc-%{gcc_version}
177  test -d build || mkdir build
178
179%build
180  cd build
181
182#  ALERT: GCJ would be better if we could add this flag and build
183#  it's libraries but this code isn't ready to be embedded.
184#  libgcj_flag="--enable-libgcj"
185
186  languages="c"
187%if %build_cxx
188  languages="$languages,c++"
189%endif
190%if %build_g77
191  languages="$languages,g77"
192%endif
193%if %build_gcj
194  languages="$languages,java"
195%endif
196%if %build_objc
197  languages="$languages,objc"
198%endif
199%if %build_gnat
200  languages="$languages,ada"
201%endif
202
203  export PATH="%{_bindir}:${PATH}"
204  ../gcc-%{gcc_version}/configure \
205    --prefix=%{_prefix} --mandir=%{_mandir} \
206    --infodir=%{_infodir} \
207    --build=%_build --host=%_host \
208    --target=%{gcc_target} \
209    --with-gnu-as --with-gnu-ld --with-newlib --verbose \
210    --with-system-zlib --disable-nls \
211    --enable-version-specific-runtime-libs \
212    --enable-threads=rtems \
213    --enable-languages=$languages ${libgcj_flag}
214
215%if "%_host" != "%_build"
216  # Bug in gcc-3.2.1:
217  # Somehow, gcc doesn't get syslimits.h right for Cdn-Xs
218  test -d gcc/include || mkdir -p gcc/include
219  cp ../gcc-%{gcc_version}/gcc/gsyslimits.h gcc/include/syslimits.h
220%endif
221
222%if %build_gnat
223%if "%{gcc_version}" < "3.4"
224  cd ../gcc-%{gcc_version}/gcc/ada
225  touch treeprs.ads [es]info.h nmake.ad[bs]
226  cd ../../../build
227%endif
228%endif
229
230  make all
231%if %build_gnat
232# This gnat configuration is crap :(
233
234%if "%{gcc_version}" >= "3.4"
235# This is what is documented - Of cause it doesn't work.
236  make -C gcc gnatlib
237  make -C gcc cross-gnattools
238  make -C gcc ada.all.cross
239%endif
240
241%if "%{gcc_version}" < "3.4"
242# This is what had worked for some versions of gcc.
243  make -C gcc cross-gnattools
244  make -C gcc ada.all.cross
245# This is what gcc/ada/Makefile.in contains by default,
246# but what we override below
247  GNATLIBCFLAGS="-g -O2"
248# Let gnatlib building find newlib's headers
249  GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/%{gcc_target}/newlib/targ-include"
250  GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/../newlib-%{newlib_version}/newlib/libc/include"
251  GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/../gcc-%{gcc_version}/include"
252# Without this xgcc doesn't find the target's binutils.
253  GNATLIBCFLAGS="$GNATLIBCFLAGS -B%{_prefix}/%{gcc_target}/bin/"
254%if "%{gcc_target}" == "mips-rtems@osversion@"
255  GNATLIBCFLAGS="$GNATLIBCFLAGS -G0"
256%endif
257  make -C gcc GNATLIBCFLAGS="${GNATLIBCFLAGS}" gnatlib
258%endif
259%endif
260  make info
261
262%install
263  export PATH="%{_bindir}:${PATH}"
264  test $RPM_BUILD_ROOT = "%{_defaultbuildroot}" && \
265    rm -rf $RPM_BUILD_ROOT
266
267  cd build
268# Bug in gcc-2.95.1: It doesn't build this installation directory
269# If it doesn't find it, gcc doesn't install %{gcc_target}/bin/gcc
270%if "%{gcc_version}" < "3.0"
271  ../gcc-%{gcc_version}/mkinstalldirs \
272    $RPM_BUILD_ROOT%{_prefix}/%{gcc_target}/bin
273%endif
274
275  make prefix=$RPM_BUILD_ROOT%{_prefix} \
276    bindir=$RPM_BUILD_ROOT%{_bindir} \
277    mandir=$RPM_BUILD_ROOT%{_mandir} \
278    infodir=$RPM_BUILD_ROOT%{_infodir} \
279    install
280  cd %{gcc_target}/newlib
281  make prefix=$RPM_BUILD_ROOT%{_prefix} \
282    bindir=$RPM_BUILD_ROOT%{_bindir} \
283    mandir=$RPM_BUILD_ROOT%{_mandir} \
284    infodir=$RPM_BUILD_ROOT%{_infodir} \
285    install-info
286  # cd back to build/
287  cd ../..
288
289%if %build_gnat
290# Install a copy of gcc as gnatgcc
291# Enables us to mix different versions of gnat and gnatgcc
292  rm -f $RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-gnatgcc%{_exeext}
293  ln $RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-gcc%{_exeext} \
294    $RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-gnatgcc%{_exeext}
295%endif
296
297  # Bug in gcc-3.x: It puts the build dirs into *.la files
298
299  # host library
300  rm -f  ${RPM_BUILD_ROOT}%{_prefix}/lib/libiberty.a
301
302  # We use the version from binutils
303  rm -f $RPM_BUILD_ROOT%{_prefix}/bin/%{gcc_target}-c++filt%{_exeext}
304
305  # We don't ship info/dir
306  rm -f $RPM_BUILD_ROOT%{_infodir}/dir
307
308%if "%{gcc_version}" >= "3.4"
309  # Bug in gcc-3.4.0pre
310  rm -f $RPM_BUILD_ROOT%{_prefix}/bin/%{gcc_target}-%{gcc_target}-gcjh%{_exeext}
311%endif
312
313%if "%{gcc_version}" >= "3.3"
314  # Bug in gcc-3.3.x/gcc-3.4.x: Despite we don't need fixincludes, it installs
315  # the fixinclude-install-tools
316  rm -rf ${RPM_BUILD_ROOT}%{gccexec}/%{gcc_target}/%{gcc_version}/install-tools
317%endif
318
319%if "%{gcc_version}" < "3.0"
320  # Bug in gcc-2.95.x: It bogusly tries to share cpp for all targets.
321  # Rename it to target_alias-cpp
322  if test -f $RPM_BUILD_ROOT%{_prefix}/bin/cpp%{_exeext};
323  then
324    mv $RPM_BUILD_ROOT%{_prefix}/bin/cpp%{_exeext} \
325      $RPM_BUILD_ROOT%{_prefix}/bin/%{gcc_target}-cpp%{_exeext}
326  fi
327%endif
328
329  # gzip info files
330  ls $RPM_BUILD_ROOT%{_infodir}/*.info \
331    $RPM_BUILD_ROOT%{_infodir}/*.info-? \
332    $RPM_BUILD_ROOT%{_infodir}/*.info-?? \
333  | while read a; do \
334    gzip -9qf $a 2>/dev/null; \
335  done
336
337  # gzip man pages
338  gzip -9qf $RPM_BUILD_ROOT%{_mandir}/man?/*.? 2>/dev/null
339
340  rm -f dirs ;
341  echo "%defattr(-,root,root)" >> dirs
342  echo "%dir %{_prefix}/lib" >> dirs ;
343  echo "%dir %{gcclib}" >> dirs ;
344  echo "%dir %{gcclib}/%{gcc_target}" >> dirs ;
345
346  # Collect multilib subdirectories
347  f=`gcc/xgcc -Bgcc/ --print-multi-lib | sed -e 's,;.*$,,'`
348
349  TGTDIR="%{gcclib}/%{gcc_target}/%{gcc_version}"
350  for i in $f; do
351    case $i in
352    \.) echo "%dir ${TGTDIR}" >> dirs
353      ;;
354    *)  echo "%dir ${TGTDIR}/$i" >> dirs
355      ;;
356    esac
357  done
358
359  TGTDIR="%{_prefix}/%{gcc_target}/lib"
360  for i in $f; do
361    case $i in
362    \.) echo "%dir ${TGTDIR}" >> dirs
363      ;;
364    *)  echo "%dir ${TGTDIR}/$i" >> dirs
365      ;;
366    esac
367  done
368
369  # Collect files to go into different packages
370  cp dirs files.gcc
371  cp dirs files.g77
372  cp dirs files.objc
373  cp dirs files.gcj
374  cp dirs files.g++
375
376  TGTDIR="%{gcclib}/%{gcc_target}/%{gcc_version}"
377  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
378  for i in $f; do
379    case $i in
380    *lib*.la) rm ${RPM_BUILD_ROOT}/$i ;; # ignore: gcc produces bogus libtool libs
381    *f771) ;;
382    *cc1) ;;
383    *cc1obj) ;;
384    *cc1plus) ;; # ignore: explicitly put into rpm elsewhere
385    *collect2) ;;
386    *libobjc*) echo "$i" >> files.objc ;;
387    *include/objc*) ;;
388    *include/g++*);;
389    *include/c++*);;
390    *adainclude*);;
391    *adalib*);;
392    *gnat1);;
393    *jc1) ;;
394    *jvgenmain) ;;
395    *libstdc++.a) echo "$i" >> files.g++ ;;
396    *libsupc++.a) echo "$i" >> files.g++ ;;
397    *) echo "$i" >> files.gcc ;;
398    esac
399  done
400
401  TGTDIR="%{_prefix}/%{gcc_target}/lib"
402  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
403  for i in $f; do
404    case $i in
405    *lib*.la) rm ${RPM_BUILD_ROOT}/$i;; # ignore - gcc produces bogus libtool libs
406    *libiberty.a) rm ${RPM_BUILD_ROOT}/$i ;; # ignore - GPL'ed
407# all other files belong to gcc
408    *) echo "$i" >> files.gcc ;;
409    esac
410  done
411
Note: See TracBrowser for help on using the repository browser.