source: rtems/scripts/gcc3newlib/gccnewlib.add @ 00b8107

4.104.114.84.95
Last change on this file since 00b8107 was c86d8e7f, checked in by Ralf Corsepius <ralf.corsepius@…>, on 01/29/03 at 14:06:02

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

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