source: rtems/scripts/gcc3newlib/gccnewlib.add @ 4516274

4.104.114.84.95
Last change on this file since 4516274 was 4516274, checked in by Joel Sherrill <joel.sherrill@…>, on Nov 11, 2002 at 9:37:37 PM

2002-11-11 Joel Sherrill <joel@…>

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