source: rtems/contrib/crossrpms/rtems4.9/i386/rtems-4.9-i386-rtems4.9-gcc.spec @ 51aac0e

4.104.114.9
Last change on this file since 51aac0e was 51aac0e, checked in by Ralf Corsepius <ralf.corsepius@…>, on Sep 28, 2007 at 7:38:40 AM

Cleanups.

  • Property mode set to 100644
File size: 15.8 KB
Line 
1#
2# Please send bugfixes or comments to
3#       http://www.rtems.org/bugzilla
4#
5
6%define _prefix                 /opt/rtems-4.9
7%define _infodir                %{_prefix}/info
8%define _mandir                 %{_prefix}/man
9
10%ifos cygwin cygwin32 mingw mingw32
11%define _exeext .exe
12%else
13%define _exeext %{nil}
14%endif
15
16
17%define gcc_pkgvers 4.2.1
18%define gcc_version 4.2.1
19%define gcc_rpmvers %{expand:%(echo "4.2.1" | tr - _ )}
20
21%define newlib_version          1.15.0
22%define gccnewlib_version       gcc%{gcc_version}newlib%{newlib_version}
23
24Name:           rtems-4.9-i386-rtems4.9-gcc
25Summary:        i386-rtems4.9 gcc
26
27Group:          Development/Tools
28Version:        %{gcc_rpmvers}
29Release:        1%{?dist}
30License:        GPL
31URL:            http://gcc.gnu.org
32BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
33
34%define _use_internal_dependency_generator 0
35
36%if "%{gcc_version}" >= "4.2.0"
37BuildRequires:  flex bison
38%endif
39
40BuildRequires:  texinfo >= 4.2
41BuildRequires:  rtems-4.9-i386-rtems4.9-binutils
42
43Requires:       rtems-4.9-gcc-common
44Requires:       rtems-4.9-i386-rtems4.9-binutils
45Requires:       rtems-4.9-i386-rtems4.9-newlib = %{newlib_version}-%{release}
46
47
48%if "%{gcc_version}" >= "3.4"
49%define gcclib %{_libdir}/gcc
50%define gccexec %{_libexecdir}/gcc
51%else
52%define gcclib %{_libdir}/gcc-lib
53%define gccexec %{_libdir}/gcc-lib
54%endif
55
56%if "%{gcc_version}" == "3.4.6"
57Source0:        ftp://ftp.gnu.org/gnu/gcc/gcc-3.4.6/gcc-core-%{gcc_pkgvers}.tar.bz2
58%endif
59%if "%{gcc_version}" == "4.0.3"
60Source0:        ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-core-%{gcc_pkgvers}.tar.bz2
61Patch0:         gcc-core-4.0.3-rtems-20060822.diff
62%endif
63%if "%{gcc_version}" == "4.1.1"
64Source0:        ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-core-%{gcc_pkgvers}.tar.bz2
65Patch0:         gcc-core-4.1.1-rtems4.8-20070201.diff
66%endif
67%if "%{gcc_version}" == "4.1.2"
68Source0:        ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-core-%{gcc_pkgvers}.tar.bz2
69Patch0:         gcc-core-4.1.2-rtems4.8-20070613.diff
70%endif
71%if "%{gcc_version}" == "4.2.0"
72Source0:        ftp://gcc.gnu.org/pub/gcc/%{gcc_pkgvers}/gcc-core-%{gcc_pkgvers}.tar.bz2
73Patch0:         gcc-core-%{gcc_pkgvers}-rtems4.8-20070613.diff
74%endif
75%if "%{gcc_version}" == "4.2.1"
76Source0:        ftp://gcc.gnu.org/pub/gcc/%{gcc_pkgvers}/gcc-core-%{gcc_pkgvers}.tar.bz2
77Patch0:         gcc-core-4.2.1-rtems4.8-20070804.diff
78%endif
79%{?_without_sources:NoSource:   0}
80
81Source1:        ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-g++-%{gcc_pkgvers}.tar.bz2
82%{?_without_sources:NoSource:   1}
83
84Source50:       ftp://sources.redhat.com/pub/newlib/newlib-%{newlib_version}.tar.gz
85%if "%{newlib_version}" == "1.15.0"
86Patch50:        newlib-1.15.0-rtems4.8-20070804.diff
87%endif
88%{?_without_sources:NoSource:   50}
89
90%description
91Cross gcc for i386-rtems4.9.
92
93%prep
94%setup -c -T -n %{name}-%{version}
95
96%setup -q -T -D -n %{name}-%{version} -a0
97%{?PATCH0:%patch0 -p0}
98
99%setup -q -T -D -n %{name}-%{version} -a1
100%{?PATCH1:%patch1 -p0}
101
102
103
104
105
106%setup -q -T -D -n %{name}-%{version} -a50
107cd newlib-%{newlib_version}
108%{?PATCH50:%patch50 -p1}
109cd ..
110  # Copy the C library into gcc's source tree
111  ln -s ../newlib-%{newlib_version}/newlib gcc-%{gcc_pkgvers}
112
113%if "%{gcc_version}" < "4.1.0"
114  sed -e 's/\(version_string.* = \"[^\"]*\)/\1 (RTEMS gcc-%{gcc_version}\/newlib-%{newlib_version}-%release)/' \
115  gcc-%{gcc_pkgvers}/gcc/version.c > gcc-%{gcc_pkgvers}/gcc/version.c~
116%else
117  sed -e 's/^#define VERSUFFIX.*$/#define VERSUFFIX \" (RTEMS gcc-%{gcc_version}\/newlib-%{newlib_version}-%{release})\"/' \
118    gcc-%{gcc_pkgvers}/gcc/version.c > gcc-%{gcc_pkgvers}/gcc/version.c~
119%endif
120  mv gcc-%{gcc_pkgvers}/gcc/version.c~ gcc-%{gcc_pkgvers}/gcc/version.c
121
122
123  # Fix timestamps
124  cd gcc-%{gcc_pkgvers}
125  contrib/gcc_update --touch
126  cd ..
127%build
128  mkdir -p build
129
130  cd build
131
132  languages="c"
133  languages="$languages,c++"
134  export PATH="%{_bindir}:${PATH}"
135
136  CC="%{__cc} ${RPM_OPT_FLAGS}" \
137  ../gcc-%{gcc_pkgvers}/configure \
138    --prefix=%{_prefix} \
139    --bindir=%{_bindir} \
140    --exec_prefix=%{_exec_prefix} \
141    --includedir=%{_includedir} \
142    --libdir=%{_libdir} \
143    --libexecdir=%{_libexecdir} \
144    --mandir=%{_mandir} \
145    --infodir=%{_infodir} \
146    --datadir=%{_datadir} \
147    --build=%_build --host=%_host \
148    --target=i386-rtems4.9 \
149    --disable-libstdcxx-pch \
150    --with-gnu-as --with-gnu-ld --verbose \
151    --with-newlib \
152    --with-system-zlib \
153    --disable-nls --without-included-gettext \
154    --disable-win32-registry \
155    --enable-version-specific-runtime-libs \
156    --enable-threads \
157    --enable-languages="$languages" $optargs
158
159%if "%_host" != "%_build"
160  # Bug in gcc-3.2.1:
161  # Somehow, gcc doesn't get syslimits.h right for Cdn-Xs
162  mkdir -p gcc/include
163  cp ../gcc-%{gcc_pkgvers}/gcc/gsyslimits.h gcc/include/syslimits.h
164%endif
165
166  make all
167  make info
168  cd ..
169
170%install
171  export PATH="%{_bindir}:${PATH}"
172  rm -rf $RPM_BUILD_ROOT
173
174  cd build
175
176  make DESTDIR=$RPM_BUILD_ROOT install
177  cd ..
178
179  cd build/i386-rtems4.9/newlib
180  make DESTDIR=$RPM_BUILD_ROOT install-info
181  cd ../../..
182
183%if "%{gcc_version}" <= "4.1.2"
184# Misplaced header file
185  if test -f $RPM_BUILD_ROOT%{_includedir}/mf-runtime.h; then
186    mv $RPM_BUILD_ROOT%{_includedir}/mf-runtime.h \
187      $RPM_BUILD_ROOT%{gcclib}/i386-rtems4.9/%{gcc_version}/include/
188  fi
189%endif
190
191  # host library
192  rm -f  ${RPM_BUILD_ROOT}%{_libdir}/libiberty.a
193
194  # We use the version from binutils
195  rm -f $RPM_BUILD_ROOT%{_bindir}/i386-rtems4.9-c++filt%{_exeext}
196
197
198  # We don't ship info/dir
199  rm -f $RPM_BUILD_ROOT%{_infodir}/dir
200  touch $RPM_BUILD_ROOT%{_infodir}/dir
201
202
203%if "%{gcc_version}" >= "3.4"
204  # Bug in gcc-3.4.0pre
205  rm -f $RPM_BUILD_ROOT%{_bindir}/i386-rtems4.9-i386-rtems4.9-gcjh%{_exeext}
206%endif
207
208%if "%{gcc_version}" >= "3.3"
209  # Bug in gcc-3.3.x/gcc-3.4.x: Despite we don't need fixincludes, it installs
210  # the fixinclude-install-tools
211  rm -rf ${RPM_BUILD_ROOT}%{gcclib}/i386-rtems4.9/%{gcc_version}/install-tools
212  rm -rf ${RPM_BUILD_ROOT}%{gccexec}/i386-rtems4.9/%{gcc_version}/install-tools
213%endif
214
215  # Collect multilib subdirectories
216  f=`build/gcc/xgcc -Bbuild/gcc/ --print-multi-lib | sed -e 's,;.*$,,'`
217
218  echo "%defattr(-,root,root,-)" > build/files.newlib
219  TGTDIR="%{_exec_prefix}/i386-rtems4.9/lib"
220  for i in $f; do
221    case $i in
222    \.) echo "%dir ${TGTDIR}" >> build/files.newlib
223      ;;
224    *)  echo "%dir ${TGTDIR}/$i" >> build/files.newlib
225      ;;
226    esac
227  done
228
229  rm -f dirs ;
230  echo "%defattr(-,root,root,-)" >> dirs
231  echo "%dir %{_prefix}" >> dirs
232  echo "%dir %{_libdir}" >> dirs
233%if "%{gcc_version}" >= "3.4"
234  echo "%dir %{_libexecdir}" >> dirs
235%endif
236  echo "%dir %{gcclib}" >> dirs
237  echo "%dir %{gcclib}/i386-rtems4.9" >> dirs
238
239  TGTDIR="%{gcclib}/i386-rtems4.9/%{gcc_version}"
240  for i in $f; do
241    case $i in
242    \.) echo "%dir ${TGTDIR}" >> dirs
243      ;;
244    *)  echo "%dir ${TGTDIR}/$i" >> dirs
245      ;;
246    esac
247  done
248
249  # Collect files to go into different packages
250  cp dirs build/files.gcc
251  cp dirs build/files.g77
252  cp dirs build/files.gfortran
253  cp dirs build/files.objc
254  cp dirs build/files.gcj
255  cp dirs build/files.g++
256
257  TGTDIR="%{gcclib}/i386-rtems4.9/%{gcc_version}"
258  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
259  for i in $f; do
260    case $i in
261    *lib*.la) rm ${RPM_BUILD_ROOT}/$i ;; # ignore: gcc produces bogus libtool libs
262    *f771) ;;
263    *f951) ;;
264    *cc1) ;;
265    *cc1obj) ;;
266    *cc1plus) ;; # ignore: explicitly put into rpm elsewhere
267    *collect2) ;;
268    *libobjc*) echo "$i" >> build/files.objc ;;
269    *include/objc*) ;;
270    *include/g++*);;
271    *include/c++*);;
272    *adainclude*);;
273    *adalib*);;
274    *gnat1);;
275    *jc1) ;;
276    *jvgenmain) ;;
277    */libgfortran*.*) echo "$i" >> build/files.gfortran ;;
278    */libstdc++.*) echo "$i" >> build/files.g++ ;;
279    */libsupc++.*) echo "$i" >> build/files.g++ ;;
280    *) echo "$i" >> build/files.gcc ;;
281    esac
282  done
283
284  TGTDIR="%{_exec_prefix}/i386-rtems4.9/lib"
285  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
286  for i in $f; do
287    case $i in
288    *lib*.la) rm ${RPM_BUILD_ROOT}/$i;; # ignore - gcc produces bogus libtool libs
289    *libiberty.a) rm ${RPM_BUILD_ROOT}/$i ;; # ignore - GPL'ed
290# all other files belong to newlib
291    *) echo "$i" >> build/files.newlib ;;
292    esac
293  done
294# Extract %%__os_install_post into os_install_post~
295cat << \EOF > os_install_post~
296%__os_install_post
297EOF
298
299# Generate customized brp-*scripts
300cat os_install_post~ | while read a x y; do
301case $a in
302# Prevent brp-strip* from trying to handle foreign binaries
303*/brp-strip*)
304  b=$(basename $a)
305  sed -e 's,find $RPM_BUILD_ROOT,find $RPM_BUILD_ROOT%_bindir $RPM_BUILD_ROOT%_libexecdir,' $a > $b
306  chmod a+x $b
307  ;;
308# Fix up brp-compress to handle %%_prefix != /usr
309*/brp-compress*)
310  b=$(basename $a)
311  sed -e 's,\./usr/,.%{_prefix}/,g' < $a > $b
312  chmod a+x $b
313  ;;
314esac
315done
316
317sed -e 's,^[ ]*/usr/lib/rpm.*/brp-strip,./brp-strip,' \
318  -e 's,^[ ]*/usr/lib/rpm.*/brp-compress,./brp-compress,' \
319< os_install_post~ > os_install_post
320%define __os_install_post . ./os_install_post
321
322
323cat << EOF > %{_builddir}/%{name}-%{gcc_rpmvers}/find-provides
324#!/bin/sh
325grep -E -v '^${RPM_BUILD_ROOT}%{_exec_prefix}/i386-rtems4.9/(lib|include|sys-root)' \
326  | grep -v '^${RPM_BUILD_ROOT}%{gcclib}/i386-rtems4.9/' | %__find_provides
327EOF
328chmod +x %{_builddir}/%{name}-%{gcc_rpmvers}/find-provides
329%define __find_provides %{_builddir}/%{name}-%{gcc_rpmvers}/find-provides
330
331cat << EOF > %{_builddir}/%{name}-%{gcc_rpmvers}/find-requires
332#!/bin/sh
333grep -E -v '^${RPM_BUILD_ROOT}%{_exec_prefix}/i386-rtems4.9/(lib|include|sys-root)' \
334  | grep -v '^${RPM_BUILD_ROOT}%{gcclib}/i386-rtems4.9/' | %__find_requires
335EOF
336chmod +x %{_builddir}/%{name}-%{gcc_rpmvers}/find-requires
337%define __find_requires %{_builddir}/%{name}-%{gcc_rpmvers}/find-requires
338
339%clean
340  rm -rf $RPM_BUILD_ROOT
341
342# ==============================================================
343# rtems-4.9-i386-rtems4.9-gcc
344# ==============================================================
345# %package -n rtems-4.9-i386-rtems4.9-gcc
346# Summary:        GNU cc compiler for i386-rtems4.9
347# Group:          Development/Tools
348# Version:        %{gcc_rpmvers}
349# Requires:       rtems-4.9-i386-rtems4.9-binutils
350# Requires:       rtems-4.9-i386-rtems4.9-newlib = %{newlib_version}-%{release}
351# License:      GPL
352
353# %if %build_infos
354# Requires:      rtems-4.9-gcc-common
355# %endif
356
357%description -n rtems-4.9-i386-rtems4.9-gcc
358GNU cc compiler for i386-rtems4.9.
359
360%files -n rtems-4.9-i386-rtems4.9-gcc -f build/files.gcc
361%defattr(-,root,root)
362%dir %{_mandir}
363%dir %{_mandir}/man1
364%{_mandir}/man1/i386-rtems4.9-gcc.1*
365%if "%{gcc_version}" >= "3.4"
366%{_mandir}/man1/i386-rtems4.9-cpp.1*
367%{_mandir}/man1/i386-rtems4.9-gcov.1*
368%endif
369
370%dir %{_bindir}
371%{_bindir}/i386-rtems4.9-cpp%{_exeext}
372%{_bindir}/i386-rtems4.9-gcc%{_exeext}
373%if "%{gcc_version}" >= "3.3"
374%{_bindir}/i386-rtems4.9-gcc-%{gcc_version}%{_exeext}
375%endif
376%{_bindir}/i386-rtems4.9-gcov%{_exeext}
377%{_bindir}/i386-rtems4.9-gccbug
378
379%dir %{gcclib}/i386-rtems4.9/%{gcc_version}/include
380%if "%{gcc_version}" > "4.0.3"
381%if "i386-rtems4.9" != "bfin-rtems4.9"
382%dir %{gcclib}/i386-rtems4.9/%{gcc_version}/include/ssp
383%endif
384%endif
385
386%dir %{gccexec}
387%dir %{gccexec}/i386-rtems4.9
388%dir %{gccexec}/i386-rtems4.9/%{gcc_version}
389%{gccexec}/i386-rtems4.9/%{gcc_version}/cc1%{_exeext}
390%{gccexec}/i386-rtems4.9/%{gcc_version}/collect2%{_exeext}
391
392# ==============================================================
393# rtems-4.9-gcc-common
394# ==============================================================
395%package -n rtems-4.9-gcc-common
396Summary:        Base package for rtems gcc and newlib C Library
397Group:          Development/Tools
398Version:        %{gcc_rpmvers}
399License:        GPL
400
401Requires(post):         /sbin/install-info
402Requires(preun):        /sbin/install-info
403
404%description -n rtems-4.9-gcc-common
405
406GCC files that are shared by all targets.
407
408%files -n rtems-4.9-gcc-common
409%defattr(-,root,root)
410%dir %{_infodir}
411%ghost %{_infodir}/dir
412%{_infodir}/cpp.info*
413%{_infodir}/cppinternals.info*
414%{_infodir}/gcc.info*
415%{_infodir}/gccint.info*
416%if "%{gcc_version}" >= "3.4"
417%{_infodir}/gccinstall.info*
418%endif
419
420%dir %{_mandir}
421%if "%{gcc_version}" < "3.4"
422%dir %{_mandir}/man1
423%{_mandir}/man1/cpp.1*
424%{_mandir}/man1/gcov.1*
425%endif
426%dir %{_mandir}/man7
427%{_mandir}/man7/fsf-funding.7*
428%{_mandir}/man7/gfdl.7*
429%{_mandir}/man7/gpl.7*
430
431%post -n rtems-4.9-gcc-common
432  /sbin/install-info --info-dir=%{_infodir} %{_infodir}/cpp.info.gz || :
433  /sbin/install-info --info-dir=%{_infodir} %{_infodir}/cppinternals.info.gz || :
434  /sbin/install-info --info-dir=%{_infodir} %{_infodir}/gcc.info.gz || :
435  /sbin/install-info --info-dir=%{_infodir} %{_infodir}/gccint.info.gz || :
436%if "%{gcc_version}" >= "3.4"
437  /sbin/install-info --info-dir=%{_infodir} %{_infodir}/gccinstall.info.gz || :
438%endif
439
440%preun -n rtems-4.9-gcc-common
441if [ $1 -eq 0 ]; then
442  /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/cpp.info.gz || :
443  /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/cppinternals.info.gz || :
444  /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/gcc.info.gz || :
445  /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/gccint.info.gz || :
446%if "%{gcc_version}" >= "3.4"
447  /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/gccinstall.info.gz || :
448%endif
449fi
450
451# ==============================================================
452# rtems-4.9-i386-rtems4.9-gcc-c++
453# ==============================================================
454%package -n rtems-4.9-i386-rtems4.9-gcc-c++
455Summary:        GCC c++ compiler for i386-rtems4.9
456Group:          Development/Tools
457Version:        %{gcc_rpmvers}
458License:        GPL
459
460Provides:       rtems-4.9-i386-rtems4.9-c++ = %{gcc_rpmvers}-%{release}
461Obsoletes:      rtems-4.9-i386-rtems4.9-c++ < %{gcc_rpmvers}-%{release}
462
463Requires:       rtems-4.9-gcc-common
464Requires:       rtems-4.9-i386-rtems4.9-gcc = %{gcc_rpmvers}-%{release}
465
466%description -n rtems-4.9-i386-rtems4.9-gcc-c++
467GCC c++ compiler for i386-rtems4.9.
468
469%files -n rtems-4.9-i386-rtems4.9-gcc-c++ -f build/files.g++
470%defattr(-,root,root)
471%{_mandir}/man1/i386-rtems4.9-g++.1*
472
473%{_bindir}/i386-rtems4.9-c++%{_exeext}
474%{_bindir}/i386-rtems4.9-g++%{_exeext}
475
476%dir %{gccexec}
477%dir %{gccexec}/i386-rtems4.9
478%dir %{gccexec}/i386-rtems4.9/%{gcc_version}
479%{gccexec}/i386-rtems4.9/%{gcc_version}/cc1plus%{_exeext}
480
481%dir %{gcclib}/i386-rtems4.9/%{gcc_version}/include
482%if "%{gcc_version}" >= "3.2"
483%{gcclib}/i386-rtems4.9/%{gcc_version}/include/c++
484%else
485%{gcclib}/i386-rtems4.9/%{gcc_version}/include/g++
486%endif
487
488
489
490# ==============================================================
491# rtems-4.9-i386-rtems4.9-newlib
492# ==============================================================
493%package -n rtems-4.9-i386-rtems4.9-newlib
494Summary:        C Library (newlib) for i386-rtems4.9
495Group:          Development/Tools
496License:        Distributable
497Version:        %{newlib_version}
498
499Provides:       rtems-4.9-i386-rtems4.9-libc = %{newlib_version}-%{release}
500Obsoletes:      rtems-4.9-i386-rtems4.9-libc < %{newlib_version}-%{release}
501
502Requires:       rtems-4.9-newlib-common
503
504%description -n rtems-4.9-i386-rtems4.9-newlib
505Newlib C Library for i386-rtems4.9.
506
507%files -n rtems-4.9-i386-rtems4.9-newlib -f build/files.newlib
508%defattr(-,root,root)
509%dir %{_prefix}
510%dir %{_exec_prefix}/i386-rtems4.9
511%{_exec_prefix}/i386-rtems4.9/include
512
513# ==============================================================
514# rtems-4.9-newlib-common
515# ==============================================================
516%package -n rtems-4.9-newlib-common
517Summary:        Base package for RTEMS newlib C Library
518Group:          Development/Tools
519Version:        %{newlib_version}
520License:        Distributable
521
522Requires(post):         /sbin/install-info
523Requires(preun):        /sbin/install-info
524
525%description -n rtems-4.9-newlib-common
526newlib files that are shared by all targets.
527
528%files -n rtems-4.9-newlib-common
529%defattr(-,root,root)
530%dir %{_infodir}
531%ghost %{_infodir}/dir
532%{_infodir}/libc.info*
533%{_infodir}/libm.info*
534
535%post -n rtems-4.9-newlib-common
536  /sbin/install-info --info-dir=%{_infodir} %{_infodir}/libc.info.gz || :
537  /sbin/install-info --info-dir=%{_infodir} %{_infodir}/libm.info.gz || :
538
539%preun -n rtems-4.9-newlib-common
540if [ $1 -eq 0 ]; then
541  /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/libc.info.gz || :
542  /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/libm.info.gz || :
543fi
544
Note: See TracBrowser for help on using the repository browser.