source: rtems/scripts/gcc3newlib/gccnewlib.add @ 513afacb

4.104.114.84.95
Last change on this file since 513afacb was 513afacb, checked in by Ralf Corsepius <ralf.corsepius@…>, on 08/13/02 at 14:01:03

2002-08-13 Ralf Corsepius <corsepiu@…>

  • gcc3newlib/base-gnat.add: Don't use %{%prefix}/bin/gnat*.
  • gcc3newlib/Makefile.am: Use mkspec for c4x.
  • gcc3newlib/gccnewlib.add: Rework processing of %if %build_XXX. Rework handing Ada. Don't put adalib and adainclude into files.gcc.
  • gcc3newlib/target-gnat.add: Add adalib. Add adainclude.
  • Property mode set to 100644
File size: 6.8 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
24# Source0:      ftp://ftp.gnu.org/pub/gnu/gcc/gcc-@gcc_version@.tar.bz2
25# gcc 2.95.x
26Source0:        ftp://ftp.gnu.org/pub/gnu/gcc/gcc-@gcc_version@.tar.bz2
27Source1:        ftp://sources.redhat.com/pub/newlib/newlib-@newlib_version@.tar.gz
28@PATCH1@
29@PATCH3@
30Buildroot:      %{_tmppath}/%{name}
31
32#
33# The original sources are not included in the source RPM.
34# If we included them, then the source RPMs for each target
35# would duplicate MBs of source unnecessarily.  This is
36# a duplication of over 30 MBs of source for each of
37# the more than 10 targets it is possible to build.
38#
39# You can get them yourself from the Internet and copy them to
40# your /usr/src/redhat/SOURCES directory ($RPM_SOURCE_DIR).
41# Or you can try the ftp options of rpm :-)
42#
43NoSource:       0
44NoSource:       1
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@"     == "c4x-rtems"
53%define build_cxx       0
54%endif
55
56%if "@target_alias@" == "i386-rtems"
57%define build_gnat      1
58%endif
59
60%if "@target_alias@" == "i960-rtems"
61%define build_cxx       0
62%endif
63
64%if "@target_alias@" == "powerpc-rtems"
65%define build_gnat      1
66%endif
67
68%if "@target_alias@" == "sparc-rtems"
69%define build_gnat      1
70%endif
71
72%description
73RTEMS is an open source operating system for embedded systems.
74
75This is gcc's and newlib C Library's sources with patches for RTEMS.
76
77 The original sources are not included in the source RPM.
78 If we included them, then the source RPMs for each target
79 would duplicate MBs of source unnecessarily.  This is
80 a duplication of over 30 MBs of source for each of
81 the more than 10 targets it is possible to build.
82
83 You can get them yourself from the Internet and copy them to
84 your /usr/src/[redhat|packages]/SOURCES directory ($RPM_SOURCE_DIR).
85 Or you can try the ftp options of rpm :-)
86
87%prep
88# untar the sources inside @target_alias@-gcc-newlib
89%setup -c -T -n %{name} -a0 -a1
90
91@PATCH2@
92@PATCH4@
93
94  # Fix timestamps
95  cd gcc-@gcc_version@
96    contrib/gcc_update --touch
97  cd ..
98
99  # Copy the C library into gcc's source tree
100  ln -s ../newlib-@newlib_version@/newlib gcc-@gcc_version@
101  test -d build || mkdir build
102
103%build
104  cd build
105
106# HACK: This should be %{target} != %{build}, but SuSE's rpm screws it.
107# %if "%{_target_os}" != "%{_build_os}"
108#    CONFIGURE_ARGS="--build=%{_build} --host=%{_target}"
109# %endif
110
111  languages="c"
112%if %build_cxx
113  languages="$languages,c++"
114%endif
115%if %build_g77
116  languages="$languages,g77"
117%endif
118%if %build_gcj
119  languages="$languages,gcj"
120%endif
121%if %build_objc
122  languages="$languages,objc"
123%endif
124%if %build_gnat
125  languages="$languages,ada"
126%endif
127  ../gcc-@gcc_version@/configure $CONFIGURE_ARGS --target=@target_alias@ \
128    --with-gnu-as --with-gnu-ld --with-newlib --verbose \
129    --with-system-zlib --disable-nls \
130    --enable-version-specific-runtime-libs \
131    --enable-threads=rtems --prefix=%{_prefix} \
132    --enable-languages=$languages
133%if %build_gnat
134  cd ../gcc-@gcc_version@/gcc/ada
135  touch treeprs.ads [es]info.h nmake.ad[bs]
136  cd ../../../build
137%endif
138  make all
139%if %build_gnat
140# This is what is documented, but it doesn't work for me (RC)
141#  make gnatlib_and_tools
142  make -C gcc cross-gnattools
143  make -C gcc ada.all.cross
144  make -C gcc gnatlib
145%endif
146  make info
147
148%install
149  cd build
150#  # Bug in gcc-2.95.1: It doesn't build this installation directory
151#  # If it doesn't find it, gcc doesn't install @target_alias@/bin/gcc
152#  ../gcc-@gcc_version@/mkinstalldirs \
153#    $RPM_BUILD_ROOT%{_prefix}/@target_alias@/bin
154#
155
156  make prefix=$RPM_BUILD_ROOT%{_prefix} \
157    bindir=$RPM_BUILD_ROOT%{_bindir} install
158  cd @target_alias@/newlib
159  make prefix=$RPM_BUILD_ROOT%{_prefix} \
160    bindir=$RPM_BUILD_ROOT%{_bindir} install-info
161  # cd back to build/
162  cd ../..
163
164  # Bug in gcc-3.0.x: It puts the build dirs into *.la files
165  files=`find ${RPM_BUILD_ROOT}%{_prefix}/@target_alias@/lib -name '*.la'`
166  test -n "$files" && for i in $files; do
167    rm -f $i
168  done
169
170  # Bug in gcc-2.95.x: It bogusly tries to share cpp for all targets.
171  # Rename it to target_alias-cpp
172#  if test -f $RPM_BUILD_ROOT%{_prefix}/bin/cpp@exe_ext@;
173#  then
174#    mv $RPM_BUILD_ROOT%{_prefix}/bin/cpp@exe_ext@ \
175#      $RPM_BUILD_ROOT%{_prefix}/bin/@target_alias@-cpp@exe_ext@
176#  fi
177
178  # gzip info files
179  gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info 2>/dev/null
180  gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info-? 2>/dev/null
181  gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info-?? 2>/dev/null
182
183  rm -f dirs ;
184  echo "%dir %{_prefix}/lib" >> dirs ;
185  echo "%dir %{_prefix}/lib/gcc-lib" >> dirs ;
186  echo "%dir %{_prefix}/lib/gcc-lib/@target_alias@" >> dirs ;
187
188  # Collect multilib subdirectories
189  f=`gcc/xgcc -Bgcc/ --print-multi-lib | sed -e 's,;.*$,,'`
190
191  TGTDIR="%{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@"
192  for i in $f; do
193    case $i in
194    \.) echo "%dir ${TGTDIR}" >> dirs
195      ;;
196    *)  echo "%dir ${TGTDIR}/$i" >> dirs
197      ;;
198    esac
199  done
200
201  TGTDIR="%{_prefix}/@target_alias@/lib"
202  for i in $f; do
203    case $i in
204    \.) echo "%dir ${TGTDIR}" >> dirs
205      ;;
206    *)  echo "%dir ${TGTDIR}/$i" >> dirs
207      ;;
208    esac
209  done
210
211  # Collect files to go into different packages
212  cp dirs files.gcc
213  cp dirs files.g77
214  cp dirs files.objc
215  cp dirs files.gcj
216  cp dirs files.g++
217
218  TGTDIR="%{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@"
219  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
220  for i in $f; do
221    case $i in
222    *lib*.la);; # ignore: gcc produces bogus libtool libs
223    *f771) ;;
224    *cc1obj) ;;
225    *libobjc*) echo "$i" >> files.objc ;;
226    *include/objc*) ;;
227    *include/g++*);;
228    *adainclude*);;
229    *adalib*);;
230    *gnat1);;
231    *jc1) ;;
232    *jvgenmain) ;;
233    *cc1plus) ;; # ignore: explicitly put into rpm elsewhere
234    *libstdc++.a) echo "$i" >> files.g++ ;;
235    *libsupc++.a) echo "$i" >> files.g++ ;;
236    *) echo "$i" >> files.gcc ;;
237    esac
238  done
239
240  TGTDIR="%{_prefix}/@target_alias@/lib"
241  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
242  for i in $f; do
243    case $i in
244    *lib*.la);; # ignore - gcc produces bogus libtool libs
245    *libiberty.a) ;; # ignore - GPL'ed
246# all other files belong to gcc
247    *) echo "$i" >> files.gcc ;;
248    esac
249  done
250
251%clean
252# let rpm --clean remove BuildRoot iif using the default BuildRoot
253  test "$RPM_BUILD_ROOT" = "%{_tmppath}/%{name}" && \
254    rm -rf $RPM_BUILD_ROOT
Note: See TracBrowser for help on using the repository browser.