source: rtems/scripts/gccnewlib/gccnewlib.add @ c8dcc881

4.104.114.84.95
Last change on this file since c8dcc881 was c8dcc881, checked in by Ralf Corsepius <ralf.corsepius@…>, on 05/03/05 at 13:55:29

2005-05-03 Ralf Corsepius <ralf.corsepius@…>

  • gccnewlib/gccnewlib.add: Suppress building tools not supported by avr, h8300 and mips.
  • Property mode set to 100644
File size: 9.9 KB
Line 
1
2%define gcc_version     @gcc_version@
3%define newlib_version  @newlib_version@
4
5%define gcc_target      @target_alias@
6
7Name:           %{rpmprefix}%{gcc_target}-gcc-newlib
8Summary:        gcc and newlib C Library for %{gcc_target}.
9Group:          %{rpmgroup}
10Release:        @Release@
11Epoch:          0
12License:        gcc is GPL/LGPL ; newlib no has restrictions on run-time usage
13
14Packager:       ralf.corsepius@rtems.org and joel@OARcorp.com
15
16Version:        gcc%{gcc_version}newlib%{newlib_version}
17
18Source0:        ftp://ftp.gnu.org/pub/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}@gcc_suffix@
19Source1:        ftp://sources.redhat.com/pub/newlib/newlib-%{newlib_version}@newlib_suffix@
20@PATCH1@
21@PATCH3@
22BuildRequires:  texinfo >= 4.2
23BuildRequires:  %{rpmprefix}%{gcc_target}-binutils
24
25#
26# The original sources are not included in the source RPM.
27# If we included them, then the source RPMs for each target
28# would duplicate MBs of source unnecessarily.  This is
29# a duplication of over 30 MBs of source for each of
30# the more than 10 targets it is possible to build.
31#
32# You can get them yourself from the Internet and copy them to
33# your /usr/src/redhat/SOURCES directory ($RPM_SOURCE_DIR).
34# Or you can try the ftp options of rpm :-)
35#
36%{?!_with_sources:NoSource:     0}
37%{?!_with_sources:NoSource:     1}
38
39# Use rpm -ba --define 'gnat [0|1]' xxx.spec to override building gnat for
40# those targets wanting to support ada.
41
42# default to not building gnat
43%define _gnat   %{?gnat:%gnat}%{!?gnat:0}
44
45# Use rpm -ba --define 'gcj [0|1]' xxx.spec to override building gcj for
46# those targets wanting to support gcj.
47
48# default to not building gcj
49%define _gcj    %{?gcj:%gcj}%{!?gcj:0}
50
51%define build_cxx       %{?cxx:%cxx}%{!?cxx:1}
52%if "%{gcc_version}" >= "4.0.0"
53%define build_f95       %{?f95:%f95}%{!?f95:0}
54%define build_g77       0
55%else
56%define build_f95       0
57%define build_g77       %{?g77:%g77}%{!?g77:0}
58%endif
59%define build_objc      %{?objc:%objc}%{!?objc:0}
60%define build_gcj       %_gcj
61%define build_gnat      %_gnat
62
63%if "%{gcc_target}" == "avr-rtems@osversion@"
64%define build_cxx       0
65%define build_f95       0
66%define build_gcj       0
67%define build_gnat      0
68%endif
69
70%if "%{gcc_target}" == "h8300-rtems@osversion@"
71%define build_f95       0
72%define build_gcj       0
73%define build_gnat      0
74%endif
75
76%if "%{gcc_target}" == "tic4x-rtems@osversion@"
77%define build_cxx       0
78%endif
79
80%if "%{gcc_target}" == "i386-rtems@osversion@"
81%define build_gnat      %_gnat
82%define build_gcj       %_gcj
83%endif
84
85%if "%{gcc_target}" == "m68k-rtems@osversion@"
86%define build_gcj       %_gcj
87%endif
88
89%if "%{gcc_target}" == "mips-rtems@osversion@"
90%define build_gcj      %_gcj
91%endif
92
93%if "%{gcc_target}" == "powerpc-rtems@osversion@"
94%define build_gnat      %_gnat
95%define build_gcj       %_gcj
96%endif
97
98%if "%{gcc_target}" == "sparc-rtems@osversion@"
99%define build_gnat      %_gnat
100%define build_gcj       %_gcj
101%endif
102
103%if %build_gcj
104# Building gcj requires bison and zlib
105BuildRequires:  bison
106%endif
107
108%if "%_vendor" == "redhat"
109%if %build_gcj
110BuildRequires:  zlib-devel
111%endif
112%if %build_gnat
113# Building gnat requires gnat
114# This really isn't available until RedHat 8.0.  How to conditionalize this?
115BuildRequires:  gcc-gnat
116%endif
117%if %build_f95
118BuildRequires: gmp-devel
119%endif
120%endif
121
122%if "%{gcc_version}" >= "3.4"
123%define gcclib %{_libdir}/gcc
124%define gccexec %{_libexecdir}/gcc
125%else
126%define gcclib %{_libdir}/gcc-lib
127%define gccexec %{_libdir}/gcc-lib
128%endif
129
130%description
131RTEMS is an open source operating system for embedded systems.
132
133This is gcc's and newlib C Library's sources with patches for RTEMS.
134
135 The original sources are not included in the source RPM.
136 If we included them, then the source RPMs for each target
137 would duplicate MBs of source unnecessarily.  This is
138 a duplication of over 30 MBs of source for each of
139 the more than 10 targets it is possible to build.
140
141 You can get them yourself from the Internet and copy them to
142 your /usr/src/[redhat|packages]/SOURCES directory ($RPM_SOURCE_DIR).
143 Or you can try the ftp options of rpm :-)
144
145%prep
146# untar the sources inside %{gcc_target}-gcc-newlib
147%setup -c -T -n %{name}-%{version} -a0 -a1
148
149cd gcc-%{gcc_version}
150%{?PATCH0:%patch0 -p1}
151cd ..
152cd newlib-%{newlib_version}
153%{?PATCH1:%patch1 -p1}
154cd ..
155
156  cd gcc-%{gcc_version}
157    sed -e 's/\(version_string.* = \"[^\"]*\)/\1 (RTEMS gcc-%{gcc_version}-@gcc_patch_version@\/newlib-%{newlib_version}-@newlib_patch_version@-@Release@)/' \
158    gcc/version.c > gcc/version.c~
159    mv gcc/version.c~  gcc/version.c
160
161  # Fix timestamps
162    contrib/gcc_update --touch
163  cd ..
164
165  # Copy the C library into gcc's source tree
166  ln -s ../newlib-%{newlib_version}/newlib gcc-%{gcc_version}
167  test -d build || mkdir build
168
169%build
170  cd build
171
172  languages="c"
173%if %build_cxx
174  languages="$languages,c++"
175%endif
176%if %build_g77
177  languages="$languages,g77"
178%endif
179%if %build_f95
180  languages="$languages,f95"
181%endif
182%if %build_gcj
183  languages="$languages,java"
184%endif
185%if %build_objc
186  languages="$languages,objc"
187%endif
188%if %build_gnat
189  languages="$languages,ada"
190%endif
191
192  export PATH="%{_bindir}:${PATH}"
193  ../gcc-%{gcc_version}/configure \
194    --prefix=%{_prefix} \
195    --bindir=%{_bindir} \
196    --includedir=%{_includedir} \
197    --libdir=%{_libdir} \
198    --mandir=%{_mandir} \
199    --infodir=%{_infodir} \
200    --build=%_build --host=%_host \
201    --target=%{gcc_target} \
202    --with-gnu-as --with-gnu-ld --with-newlib --verbose \
203    --with-system-zlib --disable-nls \
204    --enable-version-specific-runtime-libs \
205    --enable-threads=rtems \
206    --enable-languages=$languages ${libgcj_flag}
207
208%if "%_host" != "%_build"
209  # Bug in gcc-3.2.1:
210  # Somehow, gcc doesn't get syslimits.h right for Cdn-Xs
211  test -d gcc/include || mkdir -p gcc/include
212  cp ../gcc-%{gcc_version}/gcc/gsyslimits.h gcc/include/syslimits.h
213%endif
214
215  make all
216  make info
217
218%install
219  export PATH="%{_bindir}:${PATH}"
220  rm -rf $RPM_BUILD_ROOT
221
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 %{gcc_target}/bin/gcc
225%if "%{gcc_version}" < "3.0"
226  mkdir -p $RPM_BUILD_ROOT%{_prefix}/%{gcc_target}/bin
227%endif
228
229  make prefix=$RPM_BUILD_ROOT%{_prefix} \
230    bindir=$RPM_BUILD_ROOT%{_bindir} \
231    libdir=$RPM_BUILD_ROOT%{_libdir} \
232    includedir=$RPM_BUILD_ROOT%{_includedir} \
233    mandir=$RPM_BUILD_ROOT%{_mandir} \
234    infodir=$RPM_BUILD_ROOT%{_infodir} \
235    install
236  cd %{gcc_target}/newlib
237  make prefix=$RPM_BUILD_ROOT%{_prefix} \
238    bindir=$RPM_BUILD_ROOT%{_bindir} \
239    libdir=$RPM_BUILD_ROOT%{_libdir} \
240    includedir=$RPM_BUILD_ROOT%{_includedir} \
241    mandir=$RPM_BUILD_ROOT%{_mandir} \
242    infodir=$RPM_BUILD_ROOT%{_infodir} \
243    install-info
244  # cd back to build/
245  cd ../..
246
247  # Bug in gcc-3.x: It puts the build dirs into *.la files
248
249  # host library
250  rm -f  ${RPM_BUILD_ROOT}%{_prefix}/lib/libiberty.a
251
252  # We use the version from binutils
253  rm -f $RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-c++filt%{_exeext}
254
255  # We don't ship info/dir
256  rm -f $RPM_BUILD_ROOT%{_infodir}/dir
257  touch $RPM_BUILD_ROOT%{_infodir}/dir
258
259%if %build_f95
260#  # Bug in gcc-4.0.0pre
261#  mv $RPM_BUILD_ROOT%{_bindir}/gfortran $RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-gfortran
262%endif
263
264%if "%{gcc_version}" >= "3.4"
265  # Bug in gcc-3.4.0pre
266  rm -f $RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-%{gcc_target}-gcjh%{_exeext}
267%endif
268
269%if "%{gcc_version}" >= "3.3"
270  # Bug in gcc-3.3.x/gcc-3.4.x: Despite we don't need fixincludes, it installs
271  # the fixinclude-install-tools
272  rm -rf ${RPM_BUILD_ROOT}%{gcclib}/%{gcc_target}/%{gcc_version}/install-tools
273  rm -rf ${RPM_BUILD_ROOT}%{gccexec}/%{gcc_target}/%{gcc_version}/install-tools
274%endif
275
276%if "%{gcc_version}" < "3.0"
277  # Bug in gcc-2.95.x: It bogusly tries to share cpp for all targets.
278  # Rename it to target_alias-cpp
279  if test -f $RPM_BUILD_ROOT%{_bindir}/cpp%{_exeext};
280  then
281    mv $RPM_BUILD_ROOT%{_bindir}/cpp%{_exeext} \
282      $RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-cpp%{_exeext}
283  fi
284%endif
285
286  # gzip info files
287  ls $RPM_BUILD_ROOT%{_infodir}/*.info \
288    $RPM_BUILD_ROOT%{_infodir}/*.info-? \
289    $RPM_BUILD_ROOT%{_infodir}/*.info-?? \
290  | while read a; do \
291    gzip -9qf $a 2>/dev/null; \
292  done
293
294  # gzip man pages
295  gzip -9qf $RPM_BUILD_ROOT%{_mandir}/man?/*.? 2>/dev/null
296
297  rm -f dirs ;
298  echo "%defattr(-,root,root)" >> dirs
299  echo "%dir %{_prefix}/lib" >> dirs ;
300  echo "%dir %{gcclib}" >> dirs ;
301  echo "%dir %{gcclib}/%{gcc_target}" >> dirs ;
302
303  # Collect multilib subdirectories
304  f=`gcc/xgcc -Bgcc/ --print-multi-lib | sed -e 's,;.*$,,'`
305
306  TGTDIR="%{gcclib}/%{gcc_target}/%{gcc_version}"
307  for i in $f; do
308    case $i in
309    \.) echo "%dir ${TGTDIR}" >> dirs
310      ;;
311    *)  echo "%dir ${TGTDIR}/$i" >> dirs
312      ;;
313    esac
314  done
315
316  TGTDIR="%{_prefix}/%{gcc_target}/lib"
317  for i in $f; do
318    case $i in
319    \.) echo "%dir ${TGTDIR}" >> dirs
320      ;;
321    *)  echo "%dir ${TGTDIR}/$i" >> dirs
322      ;;
323    esac
324  done
325
326  # Collect files to go into different packages
327  cp dirs files.gcc
328  cp dirs files.g77
329  cp dirs files.gfortran
330  cp dirs files.objc
331  cp dirs files.gcj
332  cp dirs files.g++
333
334  TGTDIR="%{gcclib}/%{gcc_target}/%{gcc_version}"
335  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
336  for i in $f; do
337    case $i in
338    *lib*.la) rm ${RPM_BUILD_ROOT}/$i ;; # ignore: gcc produces bogus libtool libs
339    *f771) ;;
340    *f951) ;;
341    *cc1) ;;
342    *cc1obj) ;;
343    *cc1plus) ;; # ignore: explicitly put into rpm elsewhere
344    *collect2) ;;
345    *libobjc*) echo "$i" >> files.objc ;;
346    *include/objc*) ;;
347    *include/g++*);;
348    *include/c++*);;
349    *adainclude*);;
350    *adalib*);;
351    *gnat1);;
352    *jc1) ;;
353    *jvgenmain) ;;
354    *libgfortran*.a) echo "$i" >> files.gfortran ;;
355    *libstdc++.a) echo "$i" >> files.g++ ;;
356    *libsupc++.a) echo "$i" >> files.g++ ;;
357    *) echo "$i" >> files.gcc ;;
358    esac
359  done
360
361  TGTDIR="%{_prefix}/%{gcc_target}/lib"
362  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
363  for i in $f; do
364    case $i in
365    *lib*.la) rm ${RPM_BUILD_ROOT}/$i;; # ignore - gcc produces bogus libtool libs
366    *libiberty.a) rm ${RPM_BUILD_ROOT}/$i ;; # ignore - GPL'ed
367# all other files belong to gcc
368    *) echo "$i" >> files.gcc ;;
369    esac
370  done
371
Note: See TracBrowser for help on using the repository browser.