source: rtems/scripts/gcc3newlib/gccnewlib.add @ 9b0bb5a4

4.104.114.84.95
Last change on this file since 9b0bb5a4 was 9b0bb5a4, checked in by Ralf Corsepius <ralf.corsepius@…>, on 01/28/03 at 15:39:35

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

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