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