source: rtems/scripts/gcc3newlib/gccnewlib.add @ e4c2a09

4.104.114.84.95
Last change on this file since e4c2a09 was e4c2a09, checked in by Ralf Corsepius <ralf.corsepius@…>, on 04/12/05 at 08:25:38

2005-04-12 Ralf Corsepius <ralf.corsepius@…>

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