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

4.104.114.84.95
Last change on this file since cdf5ff65 was cdf5ff65, checked in by Ralf Corsepius <ralf.corsepius@…>, on Sep 4, 2003 at 2:39:05 PM

2003-09-04 Ralf Corsepius <corsepiu@…>

  • binutils/base-binutils.add: Add osversion support.
  • binutils/binutils.add: Add osversion support. %setup -n %{name}-%{version}. Don't remove c++filt.
  • binutils/target-binutils.add: Add osversion support. Pickup c++filt.
  • gcc3newlib/base-g77.add: Add osversion support.
  • gcc3newlib/base-gcc.add: Add osversion support.
  • gcc3newlib/base-gcj.add: Add osversion support.
  • gcc3newlib/base-gnat.add: Add osversion support.
  • gcc3newlib/gccnewlib.add: Add osversion support. Remove c++filt, %setup -n -n %{name}-%{version}.
  • gcc3newlib/target-c++.add: Add osversion support. Don't pickup c++filt.
  • gcc3newlib/target-g77.add: Add osversion support.
  • gcc3newlib/target-gcc.add: Add osversion support.
  • gcc3newlib/target-gcj.add: Add osversion support.
  • gcc3newlib/target-gnat.add: Add osversion support.
  • gccnewlib/gccnewlib.add: %setup -n %{name}-%{version}.
  • gdb/base-gdb.add: Add osversion support, rpmgroup, rpmprefix, gdb_version, gdb_target.
  • gdb/target-gdb.add: Ditto.
  • gdb/gdb.add: Ditto. %setup -n -n %{name}-%{version}.
  • Property mode set to 100644
File size: 10.0 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.2"
49# default to building gnat
50%define _gnat   %{?gnat:%gnat}%{!?gnat:1}
51%else
52# default to not building gnat
53%define _gnat   %{?gnat:%gnat}%{!?gnat:0}
54%endif
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.2"
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       1
69%define build_g77       0
70%define build_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}" == "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}" == "i960-rtems@osversion@"
88%define build_cxx       0
89%endif
90
91%if "%{gcc_target}" == "m68k-rtems@osversion@"
92%define build_gcj       %_gcj
93%endif
94
95%if "%{gcc_target}" == "mips-rtems@osversion@"
96%define build_gnat      %_gnat
97%define build_gcj       %_gcj
98%endif
99
100%if "%{gcc_target}" == "powerpc-rtems@osversion@"
101%define build_gnat      %_gnat
102%define build_gcj       %_gcj
103%endif
104
105%if "%{gcc_target}" == "sparc-rtems@osversion@"
106%define build_gnat      %_gnat
107%define build_gcj       %_gcj
108%endif
109
110%if %build_gcj
111# Building gcj requires bison and zlib
112BuildPreReq:    bison
113%if "%_vendor" == "redhat"
114BuildPreReq:    zlib-devel
115%endif
116%endif
117
118%if %build_gnat
119# Building gnat requires gnat
120%if "%_vendor" == "redhat"
121# This really isn't available until RedHat 8.0.  How to conditionalize this?
122# BuildPreReq:  gcc-gnat
123%endif
124%endif
125
126%description
127RTEMS is an open source operating system for embedded systems.
128
129This is gcc's and newlib C Library's sources with patches for RTEMS.
130
131 The original sources are not included in the source RPM.
132 If we included them, then the source RPMs for each target
133 would duplicate MBs of source unnecessarily.  This is
134 a duplication of over 30 MBs of source for each of
135 the more than 10 targets it is possible to build.
136
137 You can get them yourself from the Internet and copy them to
138 your /usr/src/[redhat|packages]/SOURCES directory ($RPM_SOURCE_DIR).
139 Or you can try the ftp options of rpm :-)
140
141%prep
142# untar the sources inside %{gcc_target}-gcc-newlib
143%setup -c -T -n %{name}-%{version} -a0 -a1
144
145@PATCH2@
146@PATCH4@
147
148  cd gcc-%{gcc_version}
149    sed -e 's/\(version_string = \"[^\"]*\)/\1 (OAR Corporation gcc-%{gcc_version}-@gcc_patch_version@\/newlib-%{newlib_version}-@newlib_patch_version@-@Release@)/' \
150    gcc/version.c > gcc/version.c~
151    mv gcc/version.c~  gcc/version.c
152
153  # Fix timestamps
154    contrib/gcc_update --touch
155  cd ..
156
157  # Copy the C library into gcc's source tree
158  ln -s ../newlib-%{newlib_version}/newlib gcc-%{gcc_version}
159  test -d build || mkdir build
160
161%build
162  cd build
163
164#  ALERT: GCJ would be better if we could add this flag and build
165#  it's libraries but this code isn't ready to be embedded.
166#  libgcj_flag="--enable-libgcj"
167
168  languages="c"
169%if %build_cxx
170  languages="$languages,c++"
171%endif
172%if %build_g77
173  languages="$languages,g77"
174%endif
175%if %build_gcj
176  languages="$languages,java"
177%endif
178%if %build_objc
179  languages="$languages,objc"
180%endif
181%if %build_gnat
182  languages="$languages,ada"
183%endif
184
185  export PATH="%{_bindir}:${PATH}"
186  ../gcc-%{gcc_version}/configure \
187    --build=%_build --host=%_host \
188    --target=%{gcc_target} \
189    --with-gnu-as --with-gnu-ld --with-newlib --verbose \
190    --with-system-zlib --disable-nls \
191    --enable-version-specific-runtime-libs \
192    --enable-threads=rtems --prefix=%{_prefix} \
193    --enable-languages=$languages ${libgcj_flag}
194
195%if "%_host" != "%_build"
196  # Bug in gcc-3.2.1:
197  # Somehow, gcc doesn't get syslimits.h right for Cdn-Xs
198  test -d gcc/include || mkdir -p gcc/include
199  cp ../gcc-%{gcc_version}/gcc/gsyslimits.h gcc/include/syslimits.h
200%endif
201
202  rm -f $RPM_BUILD_ROOT%{_prefix}/bin/%{gcc_target}-c++filt%{_exeext}
203
204%if %build_gnat
205  cd ../gcc-%{gcc_version}/gcc/ada
206  touch treeprs.ads [es]info.h nmake.ad[bs]
207  cd ../../../build
208%endif
209  make all
210%if %build_gnat
211# This gnat configuration is crap :(
212
213# This is what is documented, but it doesn't work for me (RC)
214#  make gnatlib_and_tools
215  make -C gcc cross-gnattools
216  make -C gcc ada.all.cross
217
218# This should work, but doesn't.
219#  make -C gcc gnatlib
220
221# This is what gcc/ada/Makefile.in contains by default,
222# but what we override below
223  GNATLIBCFLAGS="-g -O2"
224# Let gnatlib building find newlib's headers
225  GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/%{gcc_target}/newlib/targ-include"
226  GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/../newlib-%{newlib_version}/newlib/libc/include"
227# Without this xgcc doesn't find the target's binutils.
228  GNATLIBCFLAGS="$GNATLIBCFLAGS -B%{_prefix}/%{gcc_target}/bin/"
229%if "%{gcc_target}" == "mips-rtems@osversion@"
230  GNATLIBCFLAGS="$GNATLIBCFLAGS -G0"
231%endif
232  make -C gcc GNATLIBCFLAGS="${GNATLIBCFLAGS}" gnatlib
233%endif
234
235  make info
236
237%install
238  export PATH="%{_bindir}:${PATH}"
239  cd build
240# Bug in gcc-2.95.1: It doesn't build this installation directory
241# If it doesn't find it, gcc doesn't install %{gcc_target}/bin/gcc
242%if "%{gcc_version}" < "3.0"
243  ../gcc-%{gcc_version}/mkinstalldirs \
244    $RPM_BUILD_ROOT%{_prefix}/%{gcc_target}/bin
245%endif
246
247  make prefix=$RPM_BUILD_ROOT%{_prefix} \
248    bindir=$RPM_BUILD_ROOT%{_bindir} install
249  cd %{gcc_target}/newlib
250  make prefix=$RPM_BUILD_ROOT%{_prefix} \
251    bindir=$RPM_BUILD_ROOT%{_bindir} install-info
252  # cd back to build/
253  cd ../..
254
255%if %build_gnat
256# Install a copy of gcc as gnatgcc
257# Enables us to mix different versions of gnat and gnatgcc
258  rm -f $RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-gnatgcc%{_exeext}
259  ln $RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-gcc%{_exeext} \
260    $RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-gnatgcc%{_exeext}
261%endif
262
263  # Bug in gcc-3.x: It puts the build dirs into *.la files
264
265  # host library
266  rm -f  ${RPM_BUILD_ROOT}%{_prefix}/lib/libiberty.a
267
268%if "%{gcc_version}" < "3.3"
269  # We use the version from binutils
270  rm -f $RPM_BUILD_ROOT%{_prefix}/bin/%{gcc_target}-c++filt%{_exeext}
271%endif
272
273%if "%{gcc_version}" < "3.0"
274  # Bug in gcc-2.95.x: It bogusly tries to share cpp for all targets.
275  # Rename it to target_alias-cpp
276  if test -f $RPM_BUILD_ROOT%{_prefix}/bin/cpp%{_exeext};
277  then
278    mv $RPM_BUILD_ROOT%{_prefix}/bin/cpp%{_exeext} \
279      $RPM_BUILD_ROOT%{_prefix}/bin/%{gcc_target}-cpp%{_exeext}
280  fi
281%endif
282
283  # gzip info files
284  gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info 2>/dev/null
285%if "%{gcc_version}" < "3.3"
286  # gcc-3.3 ships monolytic *.infos
287  gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info-? 2>/dev/null
288  gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info-?? 2>/dev/null
289%endif
290
291  rm -f dirs ;
292  echo "%defattr(-,root,root)" >> dirs
293  echo "%dir %{_prefix}/lib" >> dirs ;
294  echo "%dir %{_prefix}/lib/gcc-lib" >> dirs ;
295  echo "%dir %{_prefix}/lib/gcc-lib/%{gcc_target}" >> dirs ;
296
297  # Collect multilib subdirectories
298  f=`gcc/xgcc -Bgcc/ --print-multi-lib | sed -e 's,;.*$,,'`
299
300  TGTDIR="%{_prefix}/lib/gcc-lib/%{gcc_target}/%{gcc_version}"
301  for i in $f; do
302    case $i in
303    \.) echo "%dir ${TGTDIR}" >> dirs
304      ;;
305    *)  echo "%dir ${TGTDIR}/$i" >> dirs
306      ;;
307    esac
308  done
309
310  TGTDIR="%{_prefix}/%{gcc_target}/lib"
311  for i in $f; do
312    case $i in
313    \.) echo "%dir ${TGTDIR}" >> dirs
314      ;;
315    *)  echo "%dir ${TGTDIR}/$i" >> dirs
316      ;;
317    esac
318  done
319
320  # Collect files to go into different packages
321  cp dirs files.gcc
322  cp dirs files.g77
323  cp dirs files.objc
324  cp dirs files.gcj
325  cp dirs files.g++
326
327  TGTDIR="%{_prefix}/lib/gcc-lib/%{gcc_target}/%{gcc_version}"
328  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
329  for i in $f; do
330    case $i in
331    *lib*.la) rm ${RPM_BUILD_ROOT}/$i ;; # ignore: gcc produces bogus libtool libs
332    *f771) ;;
333    *cc1obj) ;;
334    *libobjc*) echo "$i" >> files.objc ;;
335    *include/objc*) ;;
336    *include/g++*);;
337    *include/c++*);;
338    *adainclude*);;
339    *adalib*);;
340    *gnat1);;
341    *jc1) ;;
342    *jvgenmain) ;;
343    *cc1plus) ;; # ignore: explicitly put into rpm elsewhere
344    *libstdc++.a) echo "$i" >> files.g++ ;;
345    *libsupc++.a) echo "$i" >> files.g++ ;;
346    *) echo "$i" >> files.gcc ;;
347    esac
348  done
349
350  TGTDIR="%{_prefix}/%{gcc_target}/lib"
351  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
352  for i in $f; do
353    case $i in
354    *lib*.la) rm ${RPM_BUILD_ROOT}/$i;; # ignore - gcc produces bogus libtool libs
355    *libiberty.a) rm ${RPM_BUILD_ROOT}/$i ;; # ignore - GPL'ed
356# all other files belong to gcc
357    *) echo "$i" >> files.gcc ;;
358    esac
359  done
360
Note: See TracBrowser for help on using the repository browser.