source: rtems/scripts/gccnewlib/gccnewlib.add @ 4c4ab7d

4.104.114.84.95
Last change on this file since 4c4ab7d was 4c4ab7d, checked in by Ralf Corsepius <ralf.corsepius@…>, on 05/03/05 at 13:28:23

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

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