source: rtems/scripts/gcc3newlib/gccnewlib.add @ 491b8b2e

4.104.114.84.95
Last change on this file since 491b8b2e was 491b8b2e, checked in by Ralf Corsepius <ralf.corsepius@…>, on 01/31/03 at 05:21:08

2003-01-31 Ralf Corsepius <corsepiu@…>

  • gcc3newlib/gccnewlib.add: Remove header, broken cdn-X configuration, %clean, Replace @exe_ext@ with %{_exeext}.
  • gcc3newlib/mkspec.in: Remove exe_ext.
  • gcc3newlib/target-c++.add: Replace @exe_ext@ with %{_exeext}.
  • gcc3newlib/target-g77.add: Replace @exe_ext@ with %{_exeext}.
  • gcc3newlib/target-gcc.add: Replace @exe_ext@ with %{_exeext}.
  • gcc3newlib/target-gcj.add: Replace @exe_ext@ with %{_exeext}.
  • gcc3newlib/target-gnat.add: Replace @exe_ext@ with %{_exeext}.
  • gcc3newlib/target-objc.add: Replace @exe_ext@ with %{_exeext}. + gcc3newlib/Makefile.am: Use $(top_builddir)/common/common.add, $(top_builddir)/common/clean.add, header.add.
  • Property mode set to 100644
File size: 8.7 KB
Line 
1Name:         @target_alias@-gcc-newlib
2Summary:      gcc and newlib C Library for @target_alias@.
3Group:        rtems
4Release:      @Release@
5License:      gcc is GPL/LGPL ; newlib no has restrictions on run-time usage
6
7Autoreqprov:    on
8Packager:       corsepiu@faw.uni-ulm.de and joel@OARcorp.com
9
10Version:        gcc@gcc_version@newlib@newlib_version@
11# gcc 3.x and gcc 2.9
12Source0:      ftp://ftp.gnu.org/pub/gnu/gcc/gcc-@gcc_version@.tar.gz
13# Source0:      ftp://ftp.gnu.org/pub/gnu/gcc/gcc-@gcc_version@.tar.bz2
14# gcc 2.95.x
15# Source0:      ftp://ftp.gnu.org/pub/gnu/gcc/gcc-@gcc_version@.tar.bz2
16Source1:        ftp://sources.redhat.com/pub/newlib/newlib-@newlib_version@.tar.gz
17@PATCH1@
18@PATCH3@
19Buildroot:      %{_defaultbuildroot}
20BuildPreReq:    texinfo >= 4.2
21BuildPreReq:    @target_alias@-binutils
22#
23# The original sources are not included in the source RPM.
24# If we included them, then the source RPMs for each target
25# would duplicate MBs of source unnecessarily.  This is
26# a duplication of over 30 MBs of source for each of
27# the more than 10 targets it is possible to build.
28#
29# You can get them yourself from the Internet and copy them to
30# your /usr/src/redhat/SOURCES directory ($RPM_SOURCE_DIR).
31# Or you can try the ftp options of rpm :-)
32#
33NoSource:       0
34NoSource:       1
35
36# Use rpm -ba --define 'gnat [0|1]' xxx.spec to override building gnat for
37# those targets wanting to support ada.
38
39%if "@gcc_version@" >= "3.2"
40# default to building gnat
41%define _gnat   %{?gnat:%gnat}%{!?gnat:1}
42%else
43# default to not building gnat
44%define _gnat   %{?gnat:%gnat}%{!?gnat:0}
45%endif
46
47%define build_cxx       1
48%define build_g77       0
49%define build_objc      0
50%define build_gcj       0
51%define build_gnat      0
52
53%if "@target_alias@" == "arm-rtems"
54%define build_gcj       1
55%endif
56
57%if "@target_alias@" == "c4x-rtems"
58%define build_cxx       0
59%endif
60
61%if "@target_alias@" == "i386-rtems"
62%define build_gnat      %_gnat
63%define build_gcj       1
64%endif
65
66%if "@target_alias@" == "i960-rtems"
67%define build_cxx       0
68%endif
69
70%if "@target_alias@" == "m68k-rtems"
71%define build_gcj       1
72%endif
73
74%if "@target_alias@" == "mips-rtems"
75%define build_gnat      %_gnat
76%define build_gcj       1
77%endif
78
79%if "@target_alias@" == "powerpc-rtems"
80%define build_gnat      %_gnat
81%define build_gcj       1
82%endif
83
84%if "@target_alias@" == "sparc-rtems"
85%define build_gnat      %_gnat
86%define build_gcj       1
87%endif
88
89%if %build_gcj
90# Building gcj requires bison and zlib
91BuildPreReq:    bison
92%if "%_vendor" == "redhat"
93BuildPreReq:    zlib-devel
94%endif
95%endif
96
97%if %build_gnat
98# Building gnat requires gnat
99%if "%_vendor" == "redhat"
100BuildPreReq:    gcc-gnat
101%endif
102%endif
103
104%description
105RTEMS is an open source operating system for embedded systems.
106
107This is gcc's and newlib C Library's sources with patches for RTEMS.
108
109 The original sources are not included in the source RPM.
110 If we included them, then the source RPMs for each target
111 would duplicate MBs of source unnecessarily.  This is
112 a duplication of over 30 MBs of source for each of
113 the more than 10 targets it is possible to build.
114
115 You can get them yourself from the Internet and copy them to
116 your /usr/src/[redhat|packages]/SOURCES directory ($RPM_SOURCE_DIR).
117 Or you can try the ftp options of rpm :-)
118
119%prep
120# untar the sources inside @target_alias@-gcc-newlib
121%setup -c -T -n %{name} -a0 -a1
122
123@PATCH2@
124@PATCH4@
125
126  cd gcc-@gcc_version@
127    sed -e 's/\(version_string = \"[^\"]*\)/\1 (OAR Corporation gcc-@gcc_version@-@gcc_patch_version@\/newlib-@newlib_version@-@newlib_patch_version@ @Release@)/' \
128    gcc/version.c > gcc/version.c~
129    mv gcc/version.c~  gcc/version.c
130
131  # Fix timestamps
132    contrib/gcc_update --touch
133  cd ..
134
135  # Copy the C library into gcc's source tree
136  ln -s ../newlib-@newlib_version@/newlib gcc-@gcc_version@
137  test -d build || mkdir build
138
139%build
140  cd build
141
142#  ALERT: GCJ would be better if we could add this flag and build
143#  it's libraries but this code isn't ready to be embedded.
144#  libgcj_flag="--enable-libgcj"
145
146  languages="c"
147%if %build_cxx
148  languages="$languages,c++"
149%endif
150%if %build_g77
151  languages="$languages,g77"
152%endif
153%if %build_gcj
154  languages="$languages,java"
155%endif
156%if %build_objc
157  languages="$languages,objc"
158%endif
159%if %build_gnat
160  languages="$languages,ada"
161%endif
162  ../gcc-@gcc_version@/configure \
163    --target=@target_alias@ \
164    --with-gnu-as --with-gnu-ld --with-newlib --verbose \
165    --with-system-zlib --disable-nls \
166    --enable-version-specific-runtime-libs \
167    --enable-threads=rtems --prefix=%{_prefix} \
168    --enable-languages=$languages ${libgcj_flag}
169%if %build_gnat
170  cd ../gcc-@gcc_version@/gcc/ada
171  touch treeprs.ads [es]info.h nmake.ad[bs]
172  cd ../../../build
173%endif
174  make all
175%if %build_gnat
176# This gnat configuration is crap :(
177
178# This is what is documented, but it doesn't work for me (RC)
179#  make gnatlib_and_tools
180  make -C gcc cross-gnattools
181  make -C gcc ada.all.cross
182
183# This should work, but doesn't.
184#  make -C gcc gnatlib
185
186# This is what gcc/ada/Makefile.in contains by default,
187# but what we override below
188  GNATLIBCFLAGS="-g -O2"
189# Let gnatlib building find newlib's headers
190  GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/@target_alias@/newlib/targ-include"
191  GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/../newlib-@newlib_version@/newlib/libc/include"
192# Without this xgcc doesn't find the target's binutils.
193  GNATLIBCFLAGS="$GNATLIBCFLAGS -B%{_prefix}/@target_alias@/bin/"
194%if "@target_alias@" == "mips-rtems"
195  GNATLIBCFLAGS="$GNATLIBCFLAGS -G0"
196%endif
197  make -C gcc GNATLIBCFLAGS="${GNATLIBCFLAGS}" gnatlib
198%endif
199  make info
200
201%install
202  cd build
203# Bug in gcc-2.95.1: It doesn't build this installation directory
204# If it doesn't find it, gcc doesn't install @target_alias@/bin/gcc
205%if "@gcc_version@" < "3.0"
206  ../gcc-@gcc_version@/mkinstalldirs \
207    $RPM_BUILD_ROOT%{_prefix}/@target_alias@/bin
208%endif
209
210  make prefix=$RPM_BUILD_ROOT%{_prefix} \
211    bindir=$RPM_BUILD_ROOT%{_bindir} install
212  cd @target_alias@/newlib
213  make prefix=$RPM_BUILD_ROOT%{_prefix} \
214    bindir=$RPM_BUILD_ROOT%{_bindir} install-info
215  # cd back to build/
216  cd ../..
217
218%if %build_gnat
219# Install a copy of gcc as gnatgcc
220# Enables us to mix different versions of gnat and gnatgcc
221  rm -f $RPM_BUILD_ROOT%{_bindir}/@target_alias@-gnatgcc%{_exeext}
222  ln $RPM_BUILD_ROOT%{_bindir}/@target_alias@-gcc%{_exeext} \
223    $RPM_BUILD_ROOT%{_bindir}/@target_alias@-gnatgcc%{_exeext}
224%endif
225
226  # Bug in gcc-3.x: It puts the build dirs into *.la files
227
228  # host library
229  rm -f  ${RPM_BUILD_ROOT}%{_prefix}/lib/libiberty.a
230
231%if "@gcc_version@" < "3.0"
232  # Bug in gcc-2.95.x: It bogusly tries to share cpp for all targets.
233  # Rename it to target_alias-cpp
234  if test -f $RPM_BUILD_ROOT%{_prefix}/bin/cpp%{_exeext};
235  then
236    mv $RPM_BUILD_ROOT%{_prefix}/bin/cpp%{_exeext} \
237      $RPM_BUILD_ROOT%{_prefix}/bin/@target_alias@-cpp%{_exeext}
238  fi
239%endif
240
241  # gzip info files
242  gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info 2>/dev/null
243  gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info-? 2>/dev/null
244  gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info-?? 2>/dev/null
245
246  rm -f dirs ;
247  echo "%defattr(-,root,root)" >> dirs
248  echo "%dir %{_prefix}/lib" >> dirs ;
249  echo "%dir %{_prefix}/lib/gcc-lib" >> dirs ;
250  echo "%dir %{_prefix}/lib/gcc-lib/@target_alias@" >> dirs ;
251
252  # Collect multilib subdirectories
253  f=`gcc/xgcc -Bgcc/ --print-multi-lib | sed -e 's,;.*$,,'`
254
255  TGTDIR="%{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@"
256  for i in $f; do
257    case $i in
258    \.) echo "%dir ${TGTDIR}" >> dirs
259      ;;
260    *)  echo "%dir ${TGTDIR}/$i" >> dirs
261      ;;
262    esac
263  done
264
265  TGTDIR="%{_prefix}/@target_alias@/lib"
266  for i in $f; do
267    case $i in
268    \.) echo "%dir ${TGTDIR}" >> dirs
269      ;;
270    *)  echo "%dir ${TGTDIR}/$i" >> dirs
271      ;;
272    esac
273  done
274
275  # Collect files to go into different packages
276  cp dirs files.gcc
277  cp dirs files.g77
278  cp dirs files.objc
279  cp dirs files.gcj
280  cp dirs files.g++
281
282  TGTDIR="%{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@"
283  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
284  for i in $f; do
285    case $i in
286    *lib*.la) rm ${RPM_BUILD_ROOT}/$i ;; # ignore: gcc produces bogus libtool libs
287    *f771) ;;
288    *cc1obj) ;;
289    *libobjc*) echo "$i" >> files.objc ;;
290    *include/objc*) ;;
291    *include/g++*);;
292    *include/c++*);;
293    *adainclude*);;
294    *adalib*);;
295    *gnat1);;
296    *jc1) ;;
297    *jvgenmain) ;;
298    *cc1plus) ;; # ignore: explicitly put into rpm elsewhere
299    *libstdc++.a) echo "$i" >> files.g++ ;;
300    *libsupc++.a) echo "$i" >> files.g++ ;;
301    *) echo "$i" >> files.gcc ;;
302    esac
303  done
304
305  TGTDIR="%{_prefix}/@target_alias@/lib"
306  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
307  for i in $f; do
308    case $i in
309    *lib*.la) rm ${RPM_BUILD_ROOT}/$i;; # ignore - gcc produces bogus libtool libs
310    *libiberty.a) rm ${RPM_BUILD_ROOT}/$i ;; # ignore - GPL'ed
311# all other files belong to gcc
312    *) echo "$i" >> files.gcc ;;
313    esac
314  done
315
Note: See TracBrowser for help on using the repository browser.