source: rtems/scripts/gcc3newlib/gccnewlib.add @ 61f41e2

4.104.114.84.95
Last change on this file since 61f41e2 was 61f41e2, checked in by Ralf Corsepius <ralf.corsepius@…>, on 11/17/03 at 12:52:01

2003-11-17 Ralf Corsepius <corsepiu@…>

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