source: rtems/contrib/crossrpms/rtems4.8/m68k/rtems-4.8-m68k-rtems4.8-gcc.spec @ 4fec4975

4.104.114.84.9
Last change on this file since 4fec4975 was 4fec4975, checked in by Ralf Corsepius <ralf.corsepius@…>, on Jun 3, 2007 at 3:26:45 PM

GCC_RPMREL = 17.

  • 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:        17%{?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-20070216.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-20070515.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    --with-gnu-as --with-gnu-ld --verbose \
142    --with-newlib \
143    --with-system-zlib \
144    --disable-nls --without-included-gettext \
145    --disable-win32-registry \
146    --enable-version-specific-runtime-libs \
147    --enable-threads \
148    --enable-languages="$languages" $optargs
149
150%if "%_host" != "%_build"
151  # Bug in gcc-3.2.1:
152  # Somehow, gcc doesn't get syslimits.h right for Cdn-Xs
153  mkdir -p gcc/include
154  cp ../gcc-%{gcc_pkgvers}/gcc/gsyslimits.h gcc/include/syslimits.h
155%endif
156
157  make all
158  cd ..
159
160%install
161  export PATH="%{_bindir}:${PATH}"
162  rm -rf $RPM_BUILD_ROOT
163
164  cd build
165
166  make DESTDIR=$RPM_BUILD_ROOT install
167  cd ..
168
169  cd build/m68k-rtems4.8/newlib
170  make DESTDIR=$RPM_BUILD_ROOT install-info
171  cd ../../..
172
173%if "%{gcc_version}" <= "4.1.2"
174# Misplaced header file
175  if test -f $RPM_BUILD_ROOT%{_includedir}/mf-runtime.h; then
176    mv $RPM_BUILD_ROOT%{_includedir}/mf-runtime.h \
177      $RPM_BUILD_ROOT%{gcclib}/m68k-rtems4.8/%{gcc_version}/include/
178  fi
179%endif
180
181  # host library
182  rm -f  ${RPM_BUILD_ROOT}%{_libdir}/libiberty.a
183
184  # We use the version from binutils
185  rm -f $RPM_BUILD_ROOT%{_bindir}/m68k-rtems4.8-c++filt%{_exeext}
186
187
188# Conflict with a native GCC's infos
189  rm -rf $RPM_BUILD_ROOT%{_infodir}
190
191# Conflict with a native GCC's man pages
192  rm -rf $RPM_BUILD_ROOT%{_mandir}/man7
193
194
195%if "%{gcc_version}" >= "3.4"
196  # Bug in gcc-3.4.0pre
197  rm -f $RPM_BUILD_ROOT%{_bindir}/m68k-rtems4.8-m68k-rtems4.8-gcjh%{_exeext}
198%endif
199
200%if "%{gcc_version}" >= "3.3"
201  # Bug in gcc-3.3.x/gcc-3.4.x: Despite we don't need fixincludes, it installs
202  # the fixinclude-install-tools
203  rm -rf ${RPM_BUILD_ROOT}%{gcclib}/m68k-rtems4.8/%{gcc_version}/install-tools
204  rm -rf ${RPM_BUILD_ROOT}%{gccexec}/m68k-rtems4.8/%{gcc_version}/install-tools
205%endif
206
207  # Collect multilib subdirectories
208  f=`build/gcc/xgcc -Bbuild/gcc/ --print-multi-lib | sed -e 's,;.*$,,'`
209
210  echo "%defattr(-,root,root,-)" > build/files.newlib
211  TGTDIR="%{_exec_prefix}/m68k-rtems4.8/lib"
212  for i in $f; do
213    case $i in
214    \.) echo "%dir ${TGTDIR}" >> build/files.newlib
215      ;;
216    *)  echo "%dir ${TGTDIR}/$i" >> build/files.newlib
217      ;;
218    esac
219  done
220
221  rm -f dirs ;
222  echo "%defattr(-,root,root,-)" >> dirs
223  echo "%dir %{_prefix}" >> dirs
224  echo "%dir %{_libdir}" >> dirs
225%if "%{gcc_version}" >= "3.4"
226  echo "%dir %{_libexecdir}" >> dirs
227%endif
228  echo "%dir %{gcclib}" >> dirs
229  echo "%dir %{gcclib}/m68k-rtems4.8" >> dirs
230
231  TGTDIR="%{gcclib}/m68k-rtems4.8/%{gcc_version}"
232  for i in $f; do
233    case $i in
234    \.) echo "%dir ${TGTDIR}" >> dirs
235      ;;
236    *)  echo "%dir ${TGTDIR}/$i" >> dirs
237      ;;
238    esac
239  done
240
241  # Collect files to go into different packages
242  cp dirs build/files.gcc
243  cp dirs build/files.g77
244  cp dirs build/files.gfortran
245  cp dirs build/files.objc
246  cp dirs build/files.gcj
247  cp dirs build/files.g++
248
249  TGTDIR="%{gcclib}/m68k-rtems4.8/%{gcc_version}"
250  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
251  for i in $f; do
252    case $i in
253    *lib*.la) rm ${RPM_BUILD_ROOT}/$i ;; # ignore: gcc produces bogus libtool libs
254    *f771) ;;
255    *f951) ;;
256    *cc1) ;;
257    *cc1obj) ;;
258    *cc1plus) ;; # ignore: explicitly put into rpm elsewhere
259    *collect2) ;;
260    *libobjc*) echo "$i" >> build/files.objc ;;
261    *include/objc*) ;;
262    *include/g++*);;
263    *include/c++*);;
264    *adainclude*);;
265    *adalib*);;
266    *gnat1);;
267    *jc1) ;;
268    *jvgenmain) ;;
269    */libgfortran*.*) echo "$i" >> build/files.gfortran ;;
270    */libstdc++.*) echo "$i" >> build/files.g++ ;;
271    */libsupc++.*) echo "$i" >> build/files.g++ ;;
272    *) echo "$i" >> build/files.gcc ;;
273    esac
274  done
275
276  TGTDIR="%{_exec_prefix}/m68k-rtems4.8/lib"
277  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
278  for i in $f; do
279    case $i in
280    *lib*.la) rm ${RPM_BUILD_ROOT}/$i;; # ignore - gcc produces bogus libtool libs
281    *libiberty.a) rm ${RPM_BUILD_ROOT}/$i ;; # ignore - GPL'ed
282# all other files belong to newlib
283    *) echo "$i" >> build/files.newlib ;;
284    esac
285  done
286# Extract %%__os_install_post into os_install_post~
287cat << \EOF > os_install_post~
288%__os_install_post
289EOF
290
291# Generate customized brp-*scripts
292cat os_install_post~ | while read a x y; do
293case $a in
294# Prevent brp-strip* from trying to handle foreign binaries
295*/brp-strip*)
296  b=$(basename $a)
297  sed -e 's,find $RPM_BUILD_ROOT,find $RPM_BUILD_ROOT%_bindir $RPM_BUILD_ROOT%_libexecdir,' $a > $b
298  chmod a+x $b
299  ;;
300# Fix up brp-compress to handle %%_prefix != /usr
301*/brp-compress*)
302  b=$(basename $a)
303  sed -e 's,\./usr/,.%{_prefix}/,g' < $a > $b
304  chmod a+x $b
305  ;;
306esac
307done
308
309sed -e 's,^[ ]*/usr/lib/rpm.*/brp-strip,./brp-strip,' \
310  -e 's,^[ ]*/usr/lib/rpm.*/brp-compress,./brp-compress,' \
311< os_install_post~ > os_install_post
312%define __os_install_post . ./os_install_post
313
314
315cat << EOF > %{_builddir}/%{name}-%{gcc_rpmvers}/find-provides
316#!/bin/sh
317grep -E -v '^${RPM_BUILD_ROOT}%{_exec_prefix}/m68k-rtems4.8/(lib|include|sys-root)' \
318  | grep -v '^${RPM_BUILD_ROOT}%{gcclib}/m68k-rtems4.8/' | %__find_provides
319EOF
320chmod +x %{_builddir}/%{name}-%{gcc_rpmvers}/find-provides
321%define __find_provides %{_builddir}/%{name}-%{gcc_rpmvers}/find-provides
322
323cat << EOF > %{_builddir}/%{name}-%{gcc_rpmvers}/find-requires
324#!/bin/sh
325grep -E -v '^${RPM_BUILD_ROOT}%{_exec_prefix}/m68k-rtems4.8/(lib|include|sys-root)' \
326  | grep -v '^${RPM_BUILD_ROOT}%{gcclib}/m68k-rtems4.8/' | %__find_requires
327EOF
328chmod +x %{_builddir}/%{name}-%{gcc_rpmvers}/find-requires
329%define __find_requires %{_builddir}/%{name}-%{gcc_rpmvers}/find-requires
330
331%clean
332  rm -rf $RPM_BUILD_ROOT
333
334# ==============================================================
335# rtems-4.8-m68k-rtems4.8-gcc
336# ==============================================================
337# %package -n rtems-4.8-m68k-rtems4.8-gcc
338# Summary:        GNU cc compiler for m68k-rtems4.8
339# Group:          Development/Tools
340# Version:        %{gcc_rpmvers}
341# Requires:       rtems-4.8-m68k-rtems4.8-binutils
342# Requires:       rtems-4.8-m68k-rtems4.8-newlib = %{newlib_version}-%{release}
343# License:      GPL
344
345# %if %build_infos
346# Requires:      rtems-4.8-gcc-common
347# %endif
348
349%description -n rtems-4.8-m68k-rtems4.8-gcc
350GNU cc compiler for m68k-rtems4.8.
351
352%files -n rtems-4.8-m68k-rtems4.8-gcc -f build/files.gcc
353%defattr(-,root,root)
354%dir %{_mandir}
355%dir %{_mandir}/man1
356%{_mandir}/man1/m68k-rtems4.8-gcc.1*
357%if "%{gcc_version}" >= "3.4"
358%{_mandir}/man1/m68k-rtems4.8-cpp.1*
359%{_mandir}/man1/m68k-rtems4.8-gcov.1*
360%endif
361
362%dir %{_bindir}
363%{_bindir}/m68k-rtems4.8-cpp%{_exeext}
364%{_bindir}/m68k-rtems4.8-gcc%{_exeext}
365%if "%{gcc_version}" >= "3.3"
366%{_bindir}/m68k-rtems4.8-gcc-%{gcc_version}%{_exeext}
367%endif
368%{_bindir}/m68k-rtems4.8-gcov%{_exeext}
369%{_bindir}/m68k-rtems4.8-gccbug
370
371%dir %{gcclib}/m68k-rtems4.8/%{gcc_version}/include
372%if "%{gcc_version}" > "4.0.3"
373%if "m68k-rtems4.8" != "bfin-rtems4.7"
374%dir %{gcclib}/m68k-rtems4.8/%{gcc_version}/include/ssp
375%endif
376%endif
377
378%dir %{gccexec}
379%dir %{gccexec}/m68k-rtems4.8
380%dir %{gccexec}/m68k-rtems4.8/%{gcc_version}
381%{gccexec}/m68k-rtems4.8/%{gcc_version}/cc1%{_exeext}
382%{gccexec}/m68k-rtems4.8/%{gcc_version}/collect2%{_exeext}
383
384# ==============================================================
385# rtems-4.8-m68k-rtems4.8-gcc-c++
386# ==============================================================
387%package -n rtems-4.8-m68k-rtems4.8-gcc-c++
388Summary:        GCC c++ compiler for m68k-rtems4.8
389Group:          Development/Tools
390Version:        %{gcc_rpmvers}
391License:        GPL
392
393Provides:       rtems-4.8-m68k-rtems4.8-c++ = %{gcc_rpmvers}-%{release}
394Obsoletes:      rtems-4.8-m68k-rtems4.8-c++ < %{gcc_rpmvers}-%{release}
395
396Requires:       rtems-4.8-m68k-rtems4.8-gcc = %{gcc_rpmvers}-%{release}
397
398%description -n rtems-4.8-m68k-rtems4.8-gcc-c++
399GCC c++ compiler for m68k-rtems4.8.
400
401%files -n rtems-4.8-m68k-rtems4.8-gcc-c++ -f build/files.g++
402%defattr(-,root,root)
403%{_mandir}/man1/m68k-rtems4.8-g++.1*
404
405%{_bindir}/m68k-rtems4.8-c++%{_exeext}
406%{_bindir}/m68k-rtems4.8-g++%{_exeext}
407
408%dir %{gccexec}
409%dir %{gccexec}/m68k-rtems4.8
410%dir %{gccexec}/m68k-rtems4.8/%{gcc_version}
411%{gccexec}/m68k-rtems4.8/%{gcc_version}/cc1plus%{_exeext}
412
413%dir %{gcclib}/m68k-rtems4.8/%{gcc_version}/include
414%if "%{gcc_version}" >= "3.2"
415%{gcclib}/m68k-rtems4.8/%{gcc_version}/include/c++
416%else
417%{gcclib}/m68k-rtems4.8/%{gcc_version}/include/g++
418%endif
419
420
421
422# ==============================================================
423# rtems-4.8-m68k-rtems4.8-newlib
424# ==============================================================
425%package -n rtems-4.8-m68k-rtems4.8-newlib
426Summary:        C Library (newlib) for m68k-rtems4.8
427Group:          Development/Tools
428License:        Distributable
429Version:        %{newlib_version}
430
431Provides:       rtems-4.8-m68k-rtems4.8-libc = %{newlib_version}-%{release}
432Obsoletes:      rtems-4.8-m68k-rtems4.8-libc < %{newlib_version}-%{release}
433
434
435%description -n rtems-4.8-m68k-rtems4.8-newlib
436Newlib C Library for m68k-rtems4.8.
437
438%files -n rtems-4.8-m68k-rtems4.8-newlib -f build/files.newlib
439%defattr(-,root,root)
440%dir %{_prefix}
441%dir %{_exec_prefix}/m68k-rtems4.8
442%{_exec_prefix}/m68k-rtems4.8/include
443
Note: See TracBrowser for help on using the repository browser.