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

4.104.114.84.95
Last change on this file since 3c8fa15 was 3c8fa15, checked in by Ralf Corsepius <ralf.corsepius@…>, on Oct 30, 2003 at 9:29:19 AM

2003-10-30 Ralf Corsepius <corsepiu@…>

  • gcc3newlib/gccnewlib.add: Make not building gnat and gcj the default for gcc-3.3.
  • Property mode set to 100644
File size: 10.2 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# This is what gcc/ada/Makefile.in contains by default,
221# but what we override below
222  GNATLIBCFLAGS="-g -O2"
223# Let gnatlib building find newlib's headers
224  GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/%{gcc_target}/newlib/targ-include"
225  GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/../newlib-%{newlib_version}/newlib/libc/include"
226# Without this xgcc doesn't find the target's binutils.
227  GNATLIBCFLAGS="$GNATLIBCFLAGS -B%{_prefix}/%{gcc_target}/bin/"
228%if "%{gcc_target}" == "mips-rtems@osversion@"
229  GNATLIBCFLAGS="$GNATLIBCFLAGS -G0"
230%endif
231  make -C gcc GNATLIBCFLAGS="${GNATLIBCFLAGS}" gnatlib
232%endif
233
234  make info
235
236%install
237  export PATH="%{_bindir}:${PATH}"
238  cd build
239# Bug in gcc-2.95.1: It doesn't build this installation directory
240# If it doesn't find it, gcc doesn't install %{gcc_target}/bin/gcc
241%if "%{gcc_version}" < "3.0"
242  ../gcc-%{gcc_version}/mkinstalldirs \
243    $RPM_BUILD_ROOT%{_prefix}/%{gcc_target}/bin
244%endif
245
246  make prefix=$RPM_BUILD_ROOT%{_prefix} \
247    bindir=$RPM_BUILD_ROOT%{_bindir} install
248  cd %{gcc_target}/newlib
249  make prefix=$RPM_BUILD_ROOT%{_prefix} \
250    bindir=$RPM_BUILD_ROOT%{_bindir} install-info
251  # cd back to build/
252  cd ../..
253
254%if %build_gnat
255# Install a copy of gcc as gnatgcc
256# Enables us to mix different versions of gnat and gnatgcc
257  rm -f $RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-gnatgcc%{_exeext}
258  ln $RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-gcc%{_exeext} \
259    $RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-gnatgcc%{_exeext}
260%endif
261
262  # Bug in gcc-3.x: It puts the build dirs into *.la files
263
264  # host library
265  rm -f  ${RPM_BUILD_ROOT}%{_prefix}/lib/libiberty.a
266
267  # We use the version from binutils
268  rm -f $RPM_BUILD_ROOT%{_prefix}/bin/%{gcc_target}-c++filt%{_exeext}
269
270%if "%{gcc_version}" >= "3.3"
271  # Bug in gcc-3.3.x: Despite we don't need fixincludes, it installs
272  # the fixinclude-install-tools
273  rm -rf ${RPM_BUILD_ROOT}%{_prefix}/lib/gcc-lib/%{gcc_target}/%{gcc_version}/install-tools
274%endif
275
276%if "%{gcc_version}" < "3.0"
277  # Bug in gcc-2.95.x: It bogusly tries to share cpp for all targets.
278  # Rename it to target_alias-cpp
279  if test -f $RPM_BUILD_ROOT%{_prefix}/bin/cpp%{_exeext};
280  then
281    mv $RPM_BUILD_ROOT%{_prefix}/bin/cpp%{_exeext} \
282      $RPM_BUILD_ROOT%{_prefix}/bin/%{gcc_target}-cpp%{_exeext}
283  fi
284%endif
285
286  # gzip info files
287  gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info 2>/dev/null
288%if "%{gcc_version}" < "3.3"
289  # gcc-3.3 ships monolytic *.infos
290  gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info-? 2>/dev/null
291  gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info-?? 2>/dev/null
292%endif
293
294  rm -f dirs ;
295  echo "%defattr(-,root,root)" >> dirs
296  echo "%dir %{_prefix}/lib" >> dirs ;
297  echo "%dir %{_prefix}/lib/gcc-lib" >> dirs ;
298  echo "%dir %{_prefix}/lib/gcc-lib/%{gcc_target}" >> dirs ;
299
300  # Collect multilib subdirectories
301  f=`gcc/xgcc -Bgcc/ --print-multi-lib | sed -e 's,;.*$,,'`
302
303  TGTDIR="%{_prefix}/lib/gcc-lib/%{gcc_target}/%{gcc_version}"
304  for i in $f; do
305    case $i in
306    \.) echo "%dir ${TGTDIR}" >> dirs
307      ;;
308    *)  echo "%dir ${TGTDIR}/$i" >> dirs
309      ;;
310    esac
311  done
312
313  TGTDIR="%{_prefix}/%{gcc_target}/lib"
314  for i in $f; do
315    case $i in
316    \.) echo "%dir ${TGTDIR}" >> dirs
317      ;;
318    *)  echo "%dir ${TGTDIR}/$i" >> dirs
319      ;;
320    esac
321  done
322
323  # Collect files to go into different packages
324  cp dirs files.gcc
325  cp dirs files.g77
326  cp dirs files.objc
327  cp dirs files.gcj
328  cp dirs files.g++
329
330  TGTDIR="%{_prefix}/lib/gcc-lib/%{gcc_target}/%{gcc_version}"
331  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
332  for i in $f; do
333    case $i in
334    *lib*.la) rm ${RPM_BUILD_ROOT}/$i ;; # ignore: gcc produces bogus libtool libs
335    *f771) ;;
336    *cc1obj) ;;
337    *libobjc*) echo "$i" >> files.objc ;;
338    *include/objc*) ;;
339    *include/g++*);;
340    *include/c++*);;
341    *adainclude*);;
342    *adalib*);;
343    *gnat1);;
344    *jc1) ;;
345    *jvgenmain) ;;
346    *cc1plus) ;; # ignore: explicitly put into rpm elsewhere
347    *libstdc++.a) echo "$i" >> files.g++ ;;
348    *libsupc++.a) echo "$i" >> files.g++ ;;
349    *) echo "$i" >> files.gcc ;;
350    esac
351  done
352
353  TGTDIR="%{_prefix}/%{gcc_target}/lib"
354  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
355  for i in $f; do
356    case $i in
357    *lib*.la) rm ${RPM_BUILD_ROOT}/$i;; # ignore - gcc produces bogus libtool libs
358    *libiberty.a) rm ${RPM_BUILD_ROOT}/$i ;; # ignore - GPL'ed
359# all other files belong to gcc
360    *) echo "$i" >> files.gcc ;;
361    esac
362  done
363
Note: See TracBrowser for help on using the repository browser.