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 Apr 12, 2005 at 8:25:38 AM

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
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#
44%{?!_with_sources:NoSource:     0}
45%{?!_with_sources:NoSource:     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%define _gnat   %{?gnat:%gnat}%{!?gnat:0}
52
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
57%define _gcj    %{?gcj:%gcj}%{!?gcj:0}
58
59%define build_cxx       %{?cxx:%cxx}%{!?cxx:1}
60%define build_g77       %{?g77:%g77}%{!?g77:0}
61%define build_objc      %{?objc:%objc}%{!?objc:0}
62%define build_gcj       0
63%define build_gnat      0
64
65%if "%{gcc_target}" == "arm-rtems@osversion@"
66%define build_gcj       %_gcj
67%endif
68
69%if "%{gcc_target}" == "avr-rtems@osversion@"
70%define build_cxx       0
71%endif
72
73%if "%{gcc_target}" == "tic4x-rtems@osversion@"
74%define build_cxx       0
75%endif
76
77# OBSOLETE: use tic4x instead
78%if "%{gcc_target}" == "c4x-rtems@osversion@"
79%define build_cxx       0
80%endif
81
82%if "%{gcc_target}" == "i386-rtems@osversion@"
83%define build_gnat      %_gnat
84%define build_gcj       %_gcj
85%endif
86
87%if "%{gcc_target}" == "m68k-rtems@osversion@"
88%define build_gcj       %_gcj
89%endif
90
91%if "%{gcc_target}" == "mips-rtems@osversion@"
92%define build_gnat      %_gnat
93%define build_gcj       %_gcj
94%endif
95
96%if "%{gcc_target}" == "powerpc-rtems@osversion@"
97%define build_gnat      %_gnat
98%define build_gcj       %_gcj
99%endif
100
101# gcc 3.4.0 is broken for embedded sparc and gnat trips it.
102%if "%{gcc_target}" == "sparc-rtems@osversion@"
103%if "%{gcc_version}" >= "3.4"
104%define build_gnat      0
105%else
106%define build_gnat      %_gnat
107%endif
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%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
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
151# untar the sources inside %{gcc_target}-gcc-newlib
152%setup -c -T -n %{name}-%{version} -a0 -a1
153
154cd gcc-%{gcc_version}
155%{?PATCH0:%patch0 -p1}
156cd ..
157cd newlib-%{newlib_version}
158%{?PATCH1:%patch1 -p1}
159cd ..
160
161  cd gcc-%{gcc_version}
162    sed -e 's/\(version_string = \"[^\"]*\)/\1 (RTEMS gcc-%{gcc_version}-@gcc_patch_version@\/newlib-%{newlib_version}-@newlib_patch_version@-@Release@)/' \
163    gcc/version.c > gcc/version.c~
164    mv gcc/version.c~  gcc/version.c
165
166  # Fix timestamps
167    contrib/gcc_update --touch
168  cd ..
169
170  # Copy the C library into gcc's source tree
171  ln -s ../newlib-%{newlib_version}/newlib gcc-%{gcc_version}
172  test -d build || mkdir build
173
174%build
175  cd build
176
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"
180
181  languages="c"
182%if %build_cxx
183  languages="$languages,c++"
184%endif
185%if %build_g77
186  languages="$languages,g77"
187%endif
188%if %build_gcj
189  languages="$languages,java"
190%endif
191%if %build_objc
192  languages="$languages,objc"
193%endif
194%if %build_gnat
195  languages="$languages,ada"
196%endif
197
198  export PATH="%{_bindir}:${PATH}"
199  ../gcc-%{gcc_version}/configure \
200    --prefix=%{_prefix} --mandir=%{_mandir} \
201    --infodir=%{_infodir} \
202    --build=%_build --host=%_host \
203    --target=%{gcc_target} \
204    --with-gnu-as --with-gnu-ld --with-newlib --verbose \
205    --with-system-zlib --disable-nls \
206    --enable-version-specific-runtime-libs \
207    --enable-threads=rtems \
208    --enable-languages=$languages ${libgcj_flag}
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
214  cp ../gcc-%{gcc_version}/gcc/gsyslimits.h gcc/include/syslimits.h
215%endif
216
217%if %build_gnat
218%if "%{gcc_version}" < "3.4"
219  cd ../gcc-%{gcc_version}/gcc/ada
220  touch treeprs.ads [es]info.h nmake.ad[bs]
221  cd ../../../build
222%endif
223%endif
224
225  make all
226%if %build_gnat
227# This gnat configuration is crap :(
228
229%if "%{gcc_version}" >= "3.4"
230# This is what is documented - Of cause it doesn't work.
231  make -C gcc gnatlib
232  make -C gcc cross-gnattools
233  make -C gcc ada.all.cross
234%endif
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
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
244  GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/%{gcc_target}/newlib/targ-include"
245  GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/../newlib-%{newlib_version}/newlib/libc/include"
246  GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/../gcc-%{gcc_version}/include"
247# Without this xgcc doesn't find the target's binutils.
248  GNATLIBCFLAGS="$GNATLIBCFLAGS -B%{_prefix}/%{gcc_target}/bin/"
249%if "%{gcc_target}" == "mips-rtems@osversion@"
250  GNATLIBCFLAGS="$GNATLIBCFLAGS -G0"
251%endif
252  make -C gcc GNATLIBCFLAGS="${GNATLIBCFLAGS}" gnatlib
253%endif
254%endif
255  make info
256
257%install
258  export PATH="%{_bindir}:${PATH}"
259  test $RPM_BUILD_ROOT = "%{_defaultbuildroot}" && \
260    rm -rf $RPM_BUILD_ROOT
261
262  cd build
263# Bug in gcc-2.95.1: It doesn't build this installation directory
264# If it doesn't find it, gcc doesn't install %{gcc_target}/bin/gcc
265%if "%{gcc_version}" < "3.0"
266  ../gcc-%{gcc_version}/mkinstalldirs \
267    $RPM_BUILD_ROOT%{_prefix}/%{gcc_target}/bin
268%endif
269
270  make prefix=$RPM_BUILD_ROOT%{_prefix} \
271    bindir=$RPM_BUILD_ROOT%{_bindir} \
272    mandir=$RPM_BUILD_ROOT%{_mandir} \
273    infodir=$RPM_BUILD_ROOT%{_infodir} \
274    install
275  cd %{gcc_target}/newlib
276  make prefix=$RPM_BUILD_ROOT%{_prefix} \
277    bindir=$RPM_BUILD_ROOT%{_bindir} \
278    mandir=$RPM_BUILD_ROOT%{_mandir} \
279    infodir=$RPM_BUILD_ROOT%{_infodir} \
280    install-info
281  # cd back to build/
282  cd ../..
283
284%if %build_gnat
285# Install a copy of gcc as gnatgcc
286# Enables us to mix different versions of gnat and gnatgcc
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}
290%endif
291
292  # Bug in gcc-3.x: It puts the build dirs into *.la files
293
294  # host library
295  rm -f  ${RPM_BUILD_ROOT}%{_prefix}/lib/libiberty.a
296
297  # We use the version from binutils
298  rm -f $RPM_BUILD_ROOT%{_prefix}/bin/%{gcc_target}-c++filt%{_exeext}
299
300  # We don't ship info/dir
301  rm -f $RPM_BUILD_ROOT%{_infodir}/dir
302
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
308%if "%{gcc_version}" >= "3.3"
309  # Bug in gcc-3.3.x/gcc-3.4.x: Despite we don't need fixincludes, it installs
310  # the fixinclude-install-tools
311  rm -rf ${RPM_BUILD_ROOT}%{gccexec}/%{gcc_target}/%{gcc_version}/install-tools
312%endif
313
314%if "%{gcc_version}" < "3.0"
315  # Bug in gcc-2.95.x: It bogusly tries to share cpp for all targets.
316  # Rename it to target_alias-cpp
317  if test -f $RPM_BUILD_ROOT%{_prefix}/bin/cpp%{_exeext};
318  then
319    mv $RPM_BUILD_ROOT%{_prefix}/bin/cpp%{_exeext} \
320      $RPM_BUILD_ROOT%{_prefix}/bin/%{gcc_target}-cpp%{_exeext}
321  fi
322%endif
323
324  # gzip info files
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
331
332  # gzip man pages
333  gzip -9qf $RPM_BUILD_ROOT%{_mandir}/man?/*.? 2>/dev/null
334
335  rm -f dirs ;
336  echo "%defattr(-,root,root)" >> dirs
337  echo "%dir %{_prefix}/lib" >> dirs ;
338  echo "%dir %{gcclib}" >> dirs ;
339  echo "%dir %{gcclib}/%{gcc_target}" >> dirs ;
340
341  # Collect multilib subdirectories
342  f=`gcc/xgcc -Bgcc/ --print-multi-lib | sed -e 's,;.*$,,'`
343
344  TGTDIR="%{gcclib}/%{gcc_target}/%{gcc_version}"
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
354  TGTDIR="%{_prefix}/%{gcc_target}/lib"
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
369  cp dirs files.g++
370
371  TGTDIR="%{gcclib}/%{gcc_target}/%{gcc_version}"
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
375    *lib*.la) rm ${RPM_BUILD_ROOT}/$i ;; # ignore: gcc produces bogus libtool libs
376    *f771) ;;
377    *cc1) ;;
378    *cc1obj) ;;
379    *cc1plus) ;; # ignore: explicitly put into rpm elsewhere
380    *collect2) ;;
381    *libobjc*) echo "$i" >> files.objc ;;
382    *include/objc*) ;;
383    *include/g++*);;
384    *include/c++*);;
385    *adainclude*);;
386    *adalib*);;
387    *gnat1);;
388    *jc1) ;;
389    *jvgenmain) ;;
390    *libstdc++.a) echo "$i" >> files.g++ ;;
391    *libsupc++.a) echo "$i" >> files.g++ ;;
392    *) echo "$i" >> files.gcc ;;
393    esac
394  done
395
396  TGTDIR="%{_prefix}/%{gcc_target}/lib"
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
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
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.