source: rtems/contrib/crossrpms/rtems4.9/powerpc/rtems-4.9-powerpc-rtems4.9-gcc.spec @ 8b2620e1

4.104.114.9
Last change on this file since 8b2620e1 was 8b2620e1, checked in by Ralf Corsepius <ralf.corsepius@…>, on Nov 14, 2007 at 3:12:16 AM

Reflect having removed *diffs

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