source: rtems/scripts/gcc3newlib/gccnewlib.add @ 3da33bf8

4.104.114.84.95
Last change on this file since 3da33bf8 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
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@
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
16Version:        gcc%{gcc_version}newlib%{newlib_version}
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
26Source1:        ftp://sources.redhat.com/pub/newlib/newlib-%{newlib_version}.tar.gz
27@PATCH1@
28@PATCH3@
29BuildPreReq:    texinfo >= 4.2
30BuildPreReq:    %{rpmprefix}%{gcc_target}-binutils
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
45# Use rpm -ba --define 'gnat [0|1]' xxx.spec to override building gnat for
46# those targets wanting to support ada.
47
48%if "%{gcc_version}" >= "3.4"
49# default to building gnat
50%define _gnat   %{?gnat:%gnat}%{!?gnat:1}
51%else
52# default to not building gnat
53# gcc-3.3: Doesn't support cross-building gnatlib
54%define _gnat   %{?gnat:%gnat}%{!?gnat:0}
55%endif
56
57# Use rpm -ba --define 'gcj [0|1]' xxx.spec to override building gcj for
58# those targets wanting to support gcj.
59
60%if "%{gcc_version}" >= "3.4"
61# default to building gcj
62%define _gcj    %{?gcj:%gcj}%{!?gcj:1}
63%else
64# default to not building gcj
65%define _gcj    %{?gcj:%gcj}%{!?gcj:0}
66%endif
67
68
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
75%if "%{gcc_target}" == "arm-rtems@osversion@"
76%define build_gcj       %_gcj
77%endif
78
79%if "%{gcc_target}" == "c4x-rtems@osversion@"
80%define build_cxx       0
81%endif
82
83%if "%{gcc_target}" == "i386-rtems@osversion@"
84%define build_gnat      %_gnat
85%define build_gcj       %_gcj
86%endif
87
88%if "%{gcc_target}" == "i960-rtems@osversion@"
89%define build_cxx       0
90%endif
91
92%if "%{gcc_target}" == "m68k-rtems@osversion@"
93%define build_gcj       %_gcj
94%endif
95
96%if "%{gcc_target}" == "mips-rtems@osversion@"
97%define build_gnat      %_gnat
98%define build_gcj       %_gcj
99%endif
100
101%if "%{gcc_target}" == "powerpc-rtems@osversion@"
102%define build_gnat      %_gnat
103%define build_gcj       %_gcj
104%endif
105
106%if "%{gcc_target}" == "sparc-rtems@osversion@"
107%define build_gnat      %_gnat
108%define build_gcj       %_gcj
109%endif
110
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"
122# This really isn't available until RedHat 8.0.  How to conditionalize this?
123# BuildPreReq:  gcc-gnat
124%endif
125%endif
126
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
143# untar the sources inside %{gcc_target}-gcc-newlib
144%setup -c -T -n %{name}-%{version} -a0 -a1
145
146@PATCH2@
147@PATCH4@
148
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@)/' \
151    gcc/version.c > gcc/version.c~
152    mv gcc/version.c~  gcc/version.c
153
154  # Fix timestamps
155    contrib/gcc_update --touch
156  cd ..
157
158  # Copy the C library into gcc's source tree
159  ln -s ../newlib-%{newlib_version}/newlib gcc-%{gcc_version}
160  test -d build || mkdir build
161
162%build
163  cd build
164
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"
168
169  languages="c"
170%if %build_cxx
171  languages="$languages,c++"
172%endif
173%if %build_g77
174  languages="$languages,g77"
175%endif
176%if %build_gcj
177  languages="$languages,java"
178%endif
179%if %build_objc
180  languages="$languages,objc"
181%endif
182%if %build_gnat
183  languages="$languages,ada"
184%endif
185
186  export PATH="%{_bindir}:${PATH}"
187  ../gcc-%{gcc_version}/configure \
188    --build=%_build --host=%_host \
189    --target=%{gcc_target} \
190    --with-gnu-as --with-gnu-ld --with-newlib --verbose \
191    --with-system-zlib --disable-nls \
192    --enable-version-specific-runtime-libs \
193    --enable-threads=rtems --prefix=%{_prefix} \
194    --enable-languages=$languages ${libgcj_flag}
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
200  cp ../gcc-%{gcc_version}/gcc/gsyslimits.h gcc/include/syslimits.h
201%endif
202
203%if %build_gnat
204  cd ../gcc-%{gcc_version}/gcc/ada
205  touch treeprs.ads [es]info.h nmake.ad[bs]
206  cd ../../../build
207%endif
208  make all
209%if %build_gnat
210# This gnat configuration is crap :(
211
212# This is what is documented, but it doesn't work for me (RC)
213#  make gnatlib_and_tools
214  make -C gcc cross-gnattools
215  make -C gcc ada.all.cross
216
217# This should work, but doesn't.
218#  make -C gcc gnatlib
219
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
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
240  GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/%{gcc_target}/newlib/targ-include"
241  GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/../newlib-%{newlib_version}/newlib/libc/include"
242  GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/../gcc-%{gcc_version}/include"
243# Without this xgcc doesn't find the target's binutils.
244  GNATLIBCFLAGS="$GNATLIBCFLAGS -B%{_prefix}/%{gcc_target}/bin/"
245%if "%{gcc_target}" == "mips-rtems@osversion@"
246  GNATLIBCFLAGS="$GNATLIBCFLAGS -G0"
247%endif
248  make -C gcc GNATLIBCFLAGS="${GNATLIBCFLAGS}" gnatlib
249%endif
250
251  make info
252
253%install
254  export PATH="%{_bindir}:${PATH}"
255  cd build
256# Bug in gcc-2.95.1: It doesn't build this installation directory
257# If it doesn't find it, gcc doesn't install %{gcc_target}/bin/gcc
258%if "%{gcc_version}" < "3.0"
259  ../gcc-%{gcc_version}/mkinstalldirs \
260    $RPM_BUILD_ROOT%{_prefix}/%{gcc_target}/bin
261%endif
262
263  make prefix=$RPM_BUILD_ROOT%{_prefix} \
264    bindir=$RPM_BUILD_ROOT%{_bindir} install
265  cd %{gcc_target}/newlib
266  make prefix=$RPM_BUILD_ROOT%{_prefix} \
267    bindir=$RPM_BUILD_ROOT%{_bindir} install-info
268  # cd back to build/
269  cd ../..
270
271%if %build_gnat
272# Install a copy of gcc as gnatgcc
273# Enables us to mix different versions of gnat and gnatgcc
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}
277%endif
278
279  # Bug in gcc-3.x: It puts the build dirs into *.la files
280
281  # host library
282  rm -f  ${RPM_BUILD_ROOT}%{_prefix}/lib/libiberty.a
283
284  # We use the version from binutils
285  rm -f $RPM_BUILD_ROOT%{_prefix}/bin/%{gcc_target}-c++filt%{_exeext}
286
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
293%if "%{gcc_version}" < "3.0"
294  # Bug in gcc-2.95.x: It bogusly tries to share cpp for all targets.
295  # Rename it to target_alias-cpp
296  if test -f $RPM_BUILD_ROOT%{_prefix}/bin/cpp%{_exeext};
297  then
298    mv $RPM_BUILD_ROOT%{_prefix}/bin/cpp%{_exeext} \
299      $RPM_BUILD_ROOT%{_prefix}/bin/%{gcc_target}-cpp%{_exeext}
300  fi
301%endif
302
303  # gzip info files
304  gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info 2>/dev/null
305%if "%{gcc_version}" < "3.3"
306  # gcc-3.3 ships monolytic *.infos
307  gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info-? 2>/dev/null
308  gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info-?? 2>/dev/null
309%endif
310
311  rm -f dirs ;
312  echo "%defattr(-,root,root)" >> dirs
313  echo "%dir %{_prefix}/lib" >> dirs ;
314  echo "%dir %{_prefix}/lib/gcc-lib" >> dirs ;
315  echo "%dir %{_prefix}/lib/gcc-lib/%{gcc_target}" >> dirs ;
316
317  # Collect multilib subdirectories
318  f=`gcc/xgcc -Bgcc/ --print-multi-lib | sed -e 's,;.*$,,'`
319
320  TGTDIR="%{_prefix}/lib/gcc-lib/%{gcc_target}/%{gcc_version}"
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
330  TGTDIR="%{_prefix}/%{gcc_target}/lib"
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
345  cp dirs files.g++
346
347  TGTDIR="%{_prefix}/lib/gcc-lib/%{gcc_target}/%{gcc_version}"
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
351    *lib*.la) rm ${RPM_BUILD_ROOT}/$i ;; # ignore: gcc produces bogus libtool libs
352    *f771) ;;
353    *cc1obj) ;;
354    *libobjc*) echo "$i" >> files.objc ;;
355    *include/objc*) ;;
356    *include/g++*);;
357    *include/c++*);;
358    *adainclude*);;
359    *adalib*);;
360    *gnat1);;
361    *jc1) ;;
362    *jvgenmain) ;;
363    *cc1plus) ;; # ignore: explicitly put into rpm elsewhere
364    *libstdc++.a) echo "$i" >> files.g++ ;;
365    *libsupc++.a) echo "$i" >> files.g++ ;;
366    *) echo "$i" >> files.gcc ;;
367    esac
368  done
369
370  TGTDIR="%{_prefix}/%{gcc_target}/lib"
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
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
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.