source: rtems/scripts/gcc3newlib/gccnewlib.add @ 087a6c86

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

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

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