source: rtems/scripts/gcc3newlib/gccnewlib.add @ 36f18e07

4.104.114.84.95
Last change on this file since 36f18e07 was 36f18e07, checked in by Ralf Corsepius <ralf.corsepius@…>, on Jan 31, 2003 at 7:32:21 AM

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

  • gcc3newlib/gccnewlib.add: Remove Buildroot.
  • common/.cvsignore: New.
  • 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    --target=@target_alias@ \
163    --with-gnu-as --with-gnu-ld --with-newlib --verbose \
164    --with-system-zlib --disable-nls \
165    --enable-version-specific-runtime-libs \
166    --enable-threads=rtems --prefix=%{_prefix} \
167    --enable-languages=$languages ${libgcj_flag}
168%if %build_gnat
169  cd ../gcc-@gcc_version@/gcc/ada
170  touch treeprs.ads [es]info.h nmake.ad[bs]
171  cd ../../../build
172%endif
173  make all
174%if %build_gnat
175# This gnat configuration is crap :(
176
177# This is what is documented, but it doesn't work for me (RC)
178#  make gnatlib_and_tools
179  make -C gcc cross-gnattools
180  make -C gcc ada.all.cross
181
182# This should work, but doesn't.
183#  make -C gcc gnatlib
184
185# This is what gcc/ada/Makefile.in contains by default,
186# but what we override below
187  GNATLIBCFLAGS="-g -O2"
188# Let gnatlib building find newlib's headers
189  GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/@target_alias@/newlib/targ-include"
190  GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/../newlib-@newlib_version@/newlib/libc/include"
191# Without this xgcc doesn't find the target's binutils.
192  GNATLIBCFLAGS="$GNATLIBCFLAGS -B%{_prefix}/@target_alias@/bin/"
193%if "@target_alias@" == "mips-rtems"
194  GNATLIBCFLAGS="$GNATLIBCFLAGS -G0"
195%endif
196  make -C gcc GNATLIBCFLAGS="${GNATLIBCFLAGS}" gnatlib
197%endif
198  make info
199
200%install
201  cd build
202# Bug in gcc-2.95.1: It doesn't build this installation directory
203# If it doesn't find it, gcc doesn't install @target_alias@/bin/gcc
204%if "@gcc_version@" < "3.0"
205  ../gcc-@gcc_version@/mkinstalldirs \
206    $RPM_BUILD_ROOT%{_prefix}/@target_alias@/bin
207%endif
208
209  make prefix=$RPM_BUILD_ROOT%{_prefix} \
210    bindir=$RPM_BUILD_ROOT%{_bindir} install
211  cd @target_alias@/newlib
212  make prefix=$RPM_BUILD_ROOT%{_prefix} \
213    bindir=$RPM_BUILD_ROOT%{_bindir} install-info
214  # cd back to build/
215  cd ../..
216
217%if %build_gnat
218# Install a copy of gcc as gnatgcc
219# Enables us to mix different versions of gnat and gnatgcc
220  rm -f $RPM_BUILD_ROOT%{_bindir}/@target_alias@-gnatgcc%{_exeext}
221  ln $RPM_BUILD_ROOT%{_bindir}/@target_alias@-gcc%{_exeext} \
222    $RPM_BUILD_ROOT%{_bindir}/@target_alias@-gnatgcc%{_exeext}
223%endif
224
225  # Bug in gcc-3.x: It puts the build dirs into *.la files
226
227  # host library
228  rm -f  ${RPM_BUILD_ROOT}%{_prefix}/lib/libiberty.a
229
230%if "@gcc_version@" < "3.0"
231  # Bug in gcc-2.95.x: It bogusly tries to share cpp for all targets.
232  # Rename it to target_alias-cpp
233  if test -f $RPM_BUILD_ROOT%{_prefix}/bin/cpp%{_exeext};
234  then
235    mv $RPM_BUILD_ROOT%{_prefix}/bin/cpp%{_exeext} \
236      $RPM_BUILD_ROOT%{_prefix}/bin/@target_alias@-cpp%{_exeext}
237  fi
238%endif
239
240  # gzip info files
241  gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info 2>/dev/null
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
245  rm -f dirs ;
246  echo "%defattr(-,root,root)" >> dirs
247  echo "%dir %{_prefix}/lib" >> dirs ;
248  echo "%dir %{_prefix}/lib/gcc-lib" >> dirs ;
249  echo "%dir %{_prefix}/lib/gcc-lib/@target_alias@" >> dirs ;
250
251  # Collect multilib subdirectories
252  f=`gcc/xgcc -Bgcc/ --print-multi-lib | sed -e 's,;.*$,,'`
253
254  TGTDIR="%{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@"
255  for i in $f; do
256    case $i in
257    \.) echo "%dir ${TGTDIR}" >> dirs
258      ;;
259    *)  echo "%dir ${TGTDIR}/$i" >> dirs
260      ;;
261    esac
262  done
263
264  TGTDIR="%{_prefix}/@target_alias@/lib"
265  for i in $f; do
266    case $i in
267    \.) echo "%dir ${TGTDIR}" >> dirs
268      ;;
269    *)  echo "%dir ${TGTDIR}/$i" >> dirs
270      ;;
271    esac
272  done
273
274  # Collect files to go into different packages
275  cp dirs files.gcc
276  cp dirs files.g77
277  cp dirs files.objc
278  cp dirs files.gcj
279  cp dirs files.g++
280
281  TGTDIR="%{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@"
282  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
283  for i in $f; do
284    case $i in
285    *lib*.la) rm ${RPM_BUILD_ROOT}/$i ;; # ignore: gcc produces bogus libtool libs
286    *f771) ;;
287    *cc1obj) ;;
288    *libobjc*) echo "$i" >> files.objc ;;
289    *include/objc*) ;;
290    *include/g++*);;
291    *include/c++*);;
292    *adainclude*);;
293    *adalib*);;
294    *gnat1);;
295    *jc1) ;;
296    *jvgenmain) ;;
297    *cc1plus) ;; # ignore: explicitly put into rpm elsewhere
298    *libstdc++.a) echo "$i" >> files.g++ ;;
299    *libsupc++.a) echo "$i" >> files.g++ ;;
300    *) echo "$i" >> files.gcc ;;
301    esac
302  done
303
304  TGTDIR="%{_prefix}/@target_alias@/lib"
305  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
306  for i in $f; do
307    case $i in
308    *lib*.la) rm ${RPM_BUILD_ROOT}/$i;; # ignore - gcc produces bogus libtool libs
309    *libiberty.a) rm ${RPM_BUILD_ROOT}/$i ;; # ignore - GPL'ed
310# all other files belong to gcc
311    *) echo "$i" >> files.gcc ;;
312    esac
313  done
314
Note: See TracBrowser for help on using the repository browser.