source: rtems/scripts/gcc3newlib/gccnewlib.add @ 553e297

4.104.114.84.95
Last change on this file since 553e297 was 553e297, checked in by Ralf Corsepius <ralf.corsepius@…>, on 02/07/03 at 05:16:41

2003-02-07 Ralf Corsepius <corsepiu@…>

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