source: rtems/scripts/gcc3newlib/gccnewlib.add @ 4be8e00

4.104.114.84.95
Last change on this file since 4be8e00 was 4be8e00, checked in by Ralf Corsepius <ralf.corsepius@…>, on Oct 22, 2003 at 7:57:43 PM

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

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