source: rtems/scripts/gcc3newlib/gccnewlib.add @ 217019f

Last change on this file since 217019f was 217019f, checked in by Joel Sherrill <joel.sherrill@…>, on Apr 18, 2003 at 12:58:24 PM

2003-04-18 Joel Sherrill <joel@…>

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