source: rtems/scripts/gcc3newlib/gccnewlib.add @ 54ceffa

4.104.114.84.95
Last change on this file since 54ceffa was 54ceffa, checked in by Ralf Corsepius <ralf.corsepius@…>, on Feb 5, 2003 at 5:01:11 AM

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

  • Apply the 2003-01-31 changes OAR's broken CVS had dropped.
  • 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@
19BuildPreReq:    texinfo >= 4.2
20BuildPreReq:    @target_alias@-binutils
21#
22# The original sources are not included in the source RPM.
23# If we included them, then the source RPMs for each target
24# would duplicate MBs of source unnecessarily.  This is
25# a duplication of over 30 MBs of source for each of
26# the more than 10 targets it is possible to build.
27#
28# You can get them yourself from the Internet and copy them to
29# your /usr/src/redhat/SOURCES directory ($RPM_SOURCE_DIR).
30# Or you can try the ftp options of rpm :-)
31#
32NoSource:       0
33NoSource:       1
34
35# Use rpm -ba --define 'gnat [0|1]' xxx.spec to override building gnat for
36# those targets wanting to support ada.
37
38%if "@gcc_version@" >= "3.2"
39# default to building gnat
40%define _gnat   %{?gnat:%gnat}%{!?gnat:1}
41%else
42# default to not building gnat
43%define _gnat   %{?gnat:%gnat}%{!?gnat:0}
44%endif
45
46%define build_cxx       1
47%define build_g77       0
48%define build_objc      0
49%define build_gcj       0
50%define build_gnat      0
51
52%if "@target_alias@" == "arm-rtems"
53%define build_gcj       1
54%endif
55
56%if "@target_alias@" == "c4x-rtems"
57%define build_cxx       0
58%endif
59
60%if "@target_alias@" == "i386-rtems"
61%define build_gnat      %_gnat
62%define build_gcj       1
63%endif
64
65%if "@target_alias@" == "i960-rtems"
66%define build_cxx       0
67%endif
68
69%if "@target_alias@" == "m68k-rtems"
70%define build_gcj       1
71%endif
72
73%if "@target_alias@" == "mips-rtems"
74%define build_gnat      %_gnat
75%define build_gcj       1
76%endif
77
78%if "@target_alias@" == "powerpc-rtems"
79%define build_gnat      %_gnat
80%define build_gcj       1
81%endif
82
83%if "@target_alias@" == "sparc-rtems"
84%define build_gnat      %_gnat
85%define build_gcj       1
86%endif
87
88%if %build_gcj
89# Building gcj requires bison and zlib
90BuildPreReq:    bison
91%if "%_vendor" == "redhat"
92BuildPreReq:    zlib-devel
93%endif
94%endif
95
96%if %build_gnat
97# Building gnat requires gnat
98%if "%_vendor" == "redhat"
99BuildPreReq:    gcc-gnat
100%endif
101%endif
102
103%description
104RTEMS is an open source operating system for embedded systems.
105
106This is gcc's and newlib C Library's sources with patches for RTEMS.
107
108 The original sources are not included in the source RPM.
109 If we included them, then the source RPMs for each target
110 would duplicate MBs of source unnecessarily.  This is
111 a duplication of over 30 MBs of source for each of
112 the more than 10 targets it is possible to build.
113
114 You can get them yourself from the Internet and copy them to
115 your /usr/src/[redhat|packages]/SOURCES directory ($RPM_SOURCE_DIR).
116 Or you can try the ftp options of rpm :-)
117
118%prep
119# untar the sources inside @target_alias@-gcc-newlib
120%setup -c -T -n %{name} -a0 -a1
121
122@PATCH2@
123@PATCH4@
124
125  cd gcc-@gcc_version@
126    sed -e 's/\(version_string = \"[^\"]*\)/\1 (OAR Corporation gcc-@gcc_version@-@gcc_patch_version@\/newlib-@newlib_version@-@newlib_patch_version@ @Release@)/' \
127    gcc/version.c > gcc/version.c~
128    mv gcc/version.c~  gcc/version.c
129
130  # Fix timestamps
131    contrib/gcc_update --touch
132  cd ..
133
134  # Copy the C library into gcc's source tree
135  ln -s ../newlib-@newlib_version@/newlib gcc-@gcc_version@
136  test -d build || mkdir build
137
138%build
139  cd build
140
141#  ALERT: GCJ would be better if we could add this flag and build
142#  it's libraries but this code isn't ready to be embedded.
143#  libgcj_flag="--enable-libgcj"
144
145  languages="c"
146%if %build_cxx
147  languages="$languages,c++"
148%endif
149%if %build_g77
150  languages="$languages,g77"
151%endif
152%if %build_gcj
153  languages="$languages,java"
154%endif
155%if %build_objc
156  languages="$languages,objc"
157%endif
158%if %build_gnat
159  languages="$languages,ada"
160%endif
161  ../gcc-@gcc_version@/configure \
162    --build=%_build --host=%_host \
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.