source: rtems/contrib/crossrpms/rtems4.8/m68k/rtems-4.8-m68k-rtems4.8-gcc.spec @ 87e21be

4.104.114.84.9
Last change on this file since 87e21be was 87e21be, checked in by Ralf Corsepius <ralf.corsepius@…>, on Jun 3, 2007 at 6:01:55 AM

New.

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