source: rtems/contrib/crossrpms/rtems4.8/m68k/rtems-4.8-m68k-rtems4.8-gcc.spec @ 3fac2408

4.104.114.84.9
Last change on this file since 3fac2408 was 3fac2408, checked in by Ralf Corsepius <ralf.corsepius@…>, on Jun 18, 2007 at 9:42:00 AM

Update.

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