source: rtems/contrib/crossrpms/rtems4.9/bfin/rtems-4.9-bfin-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: 14.3 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-bfin-rtems4.9-gcc
25Summary:        bfin-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-bfin-rtems4.9-binutils
42
43Requires:       rtems-4.9-gcc-common
44Requires:       rtems-4.9-bfin-rtems4.9-binutils
45Requires:       rtems-4.9-bfin-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
78Source50:       ftp://sources.redhat.com/pub/newlib/newlib-%{newlib_version}.tar.gz
79%if "%{newlib_version}" == "1.15.0"
80Patch50:        newlib-1.15.0-rtems4.8-20070804.diff
81%endif
82%{?_without_sources:NoSource:   50}
83
84%description
85Cross gcc for bfin-rtems4.9.
86
87%prep
88%setup -c -T -n %{name}-%{version}
89
90%setup -q -T -D -n %{name}-%{version} -a0
91%{?PATCH0:%patch0 -p0}
92
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  export PATH="%{_bindir}:${PATH}"
126
127  CC="%{__cc} ${RPM_OPT_FLAGS}" \
128  ../gcc-%{gcc_pkgvers}/configure \
129    --prefix=%{_prefix} \
130    --bindir=%{_bindir} \
131    --exec_prefix=%{_exec_prefix} \
132    --includedir=%{_includedir} \
133    --libdir=%{_libdir} \
134    --libexecdir=%{_libexecdir} \
135    --mandir=%{_mandir} \
136    --infodir=%{_infodir} \
137    --datadir=%{_datadir} \
138    --build=%_build --host=%_host \
139    --target=bfin-rtems4.9 \
140    --disable-libstdcxx-pch \
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  make info
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/bfin-rtems4.9/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}/bfin-rtems4.9/%{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}/bfin-rtems4.9-c++filt%{_exeext}
187
188
189  # We don't ship info/dir
190  rm -f $RPM_BUILD_ROOT%{_infodir}/dir
191  touch $RPM_BUILD_ROOT%{_infodir}/dir
192
193
194%if "%{gcc_version}" >= "3.4"
195  # Bug in gcc-3.4.0pre
196  rm -f $RPM_BUILD_ROOT%{_bindir}/bfin-rtems4.9-bfin-rtems4.9-gcjh%{_exeext}
197%endif
198
199%if "%{gcc_version}" >= "3.3"
200  # Bug in gcc-3.3.x/gcc-3.4.x: Despite we don't need fixincludes, it installs
201  # the fixinclude-install-tools
202  rm -rf ${RPM_BUILD_ROOT}%{gcclib}/bfin-rtems4.9/%{gcc_version}/install-tools
203  rm -rf ${RPM_BUILD_ROOT}%{gccexec}/bfin-rtems4.9/%{gcc_version}/install-tools
204%endif
205
206  # Collect multilib subdirectories
207  f=`build/gcc/xgcc -Bbuild/gcc/ --print-multi-lib | sed -e 's,;.*$,,'`
208
209  echo "%defattr(-,root,root,-)" > build/files.newlib
210  TGTDIR="%{_exec_prefix}/bfin-rtems4.9/lib"
211  for i in $f; do
212    case $i in
213    \.) echo "%dir ${TGTDIR}" >> build/files.newlib
214      ;;
215    *)  echo "%dir ${TGTDIR}/$i" >> build/files.newlib
216      ;;
217    esac
218  done
219
220  rm -f dirs ;
221  echo "%defattr(-,root,root,-)" >> dirs
222  echo "%dir %{_prefix}" >> dirs
223  echo "%dir %{_libdir}" >> dirs
224%if "%{gcc_version}" >= "3.4"
225  echo "%dir %{_libexecdir}" >> dirs
226%endif
227  echo "%dir %{gcclib}" >> dirs
228  echo "%dir %{gcclib}/bfin-rtems4.9" >> dirs
229
230  TGTDIR="%{gcclib}/bfin-rtems4.9/%{gcc_version}"
231  for i in $f; do
232    case $i in
233    \.) echo "%dir ${TGTDIR}" >> dirs
234      ;;
235    *)  echo "%dir ${TGTDIR}/$i" >> dirs
236      ;;
237    esac
238  done
239
240  # Collect files to go into different packages
241  cp dirs build/files.gcc
242  cp dirs build/files.g77
243  cp dirs build/files.gfortran
244  cp dirs build/files.objc
245  cp dirs build/files.gcj
246  cp dirs build/files.g++
247
248  TGTDIR="%{gcclib}/bfin-rtems4.9/%{gcc_version}"
249  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
250  for i in $f; do
251    case $i in
252    *lib*.la) rm ${RPM_BUILD_ROOT}/$i ;; # ignore: gcc produces bogus libtool libs
253    *f771) ;;
254    *f951) ;;
255    *cc1) ;;
256    *cc1obj) ;;
257    *cc1plus) ;; # ignore: explicitly put into rpm elsewhere
258    *collect2) ;;
259    *libobjc*) echo "$i" >> build/files.objc ;;
260    *include/objc*) ;;
261    *include/g++*);;
262    *include/c++*);;
263    *adainclude*);;
264    *adalib*);;
265    *gnat1);;
266    *jc1) ;;
267    *jvgenmain) ;;
268    */libgfortran*.*) echo "$i" >> build/files.gfortran ;;
269    */libstdc++.*) echo "$i" >> build/files.g++ ;;
270    */libsupc++.*) echo "$i" >> build/files.g++ ;;
271    *) echo "$i" >> build/files.gcc ;;
272    esac
273  done
274
275  TGTDIR="%{_exec_prefix}/bfin-rtems4.9/lib"
276  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
277  for i in $f; do
278    case $i in
279    *lib*.la) rm ${RPM_BUILD_ROOT}/$i;; # ignore - gcc produces bogus libtool libs
280    *libiberty.a) rm ${RPM_BUILD_ROOT}/$i ;; # ignore - GPL'ed
281# all other files belong to newlib
282    *) echo "$i" >> build/files.newlib ;;
283    esac
284  done
285# Extract %%__os_install_post into os_install_post~
286cat << \EOF > os_install_post~
287%__os_install_post
288EOF
289
290# Generate customized brp-*scripts
291cat os_install_post~ | while read a x y; do
292case $a in
293# Prevent brp-strip* from trying to handle foreign binaries
294*/brp-strip*)
295  b=$(basename $a)
296  sed -e 's,find $RPM_BUILD_ROOT,find $RPM_BUILD_ROOT%_bindir $RPM_BUILD_ROOT%_libexecdir,' $a > $b
297  chmod a+x $b
298  ;;
299# Fix up brp-compress to handle %%_prefix != /usr
300*/brp-compress*)
301  b=$(basename $a)
302  sed -e 's,\./usr/,.%{_prefix}/,g' < $a > $b
303  chmod a+x $b
304  ;;
305esac
306done
307
308sed -e 's,^[ ]*/usr/lib/rpm.*/brp-strip,./brp-strip,' \
309  -e 's,^[ ]*/usr/lib/rpm.*/brp-compress,./brp-compress,' \
310< os_install_post~ > os_install_post
311%define __os_install_post . ./os_install_post
312
313
314cat << EOF > %{_builddir}/%{name}-%{gcc_rpmvers}/find-provides
315#!/bin/sh
316grep -E -v '^${RPM_BUILD_ROOT}%{_exec_prefix}/bfin-rtems4.9/(lib|include|sys-root)' \
317  | grep -v '^${RPM_BUILD_ROOT}%{gcclib}/bfin-rtems4.9/' | %__find_provides
318EOF
319chmod +x %{_builddir}/%{name}-%{gcc_rpmvers}/find-provides
320%define __find_provides %{_builddir}/%{name}-%{gcc_rpmvers}/find-provides
321
322cat << EOF > %{_builddir}/%{name}-%{gcc_rpmvers}/find-requires
323#!/bin/sh
324grep -E -v '^${RPM_BUILD_ROOT}%{_exec_prefix}/bfin-rtems4.9/(lib|include|sys-root)' \
325  | grep -v '^${RPM_BUILD_ROOT}%{gcclib}/bfin-rtems4.9/' | %__find_requires
326EOF
327chmod +x %{_builddir}/%{name}-%{gcc_rpmvers}/find-requires
328%define __find_requires %{_builddir}/%{name}-%{gcc_rpmvers}/find-requires
329
330%clean
331  rm -rf $RPM_BUILD_ROOT
332
333# ==============================================================
334# rtems-4.9-bfin-rtems4.9-gcc
335# ==============================================================
336# %package -n rtems-4.9-bfin-rtems4.9-gcc
337# Summary:        GNU cc compiler for bfin-rtems4.9
338# Group:          Development/Tools
339# Version:        %{gcc_rpmvers}
340# Requires:       rtems-4.9-bfin-rtems4.9-binutils
341# Requires:       rtems-4.9-bfin-rtems4.9-newlib = %{newlib_version}-%{release}
342# License:      GPL
343
344# %if %build_infos
345# Requires:      rtems-4.9-gcc-common
346# %endif
347
348%description -n rtems-4.9-bfin-rtems4.9-gcc
349GNU cc compiler for bfin-rtems4.9.
350
351%files -n rtems-4.9-bfin-rtems4.9-gcc -f build/files.gcc
352%defattr(-,root,root)
353%dir %{_mandir}
354%dir %{_mandir}/man1
355%{_mandir}/man1/bfin-rtems4.9-gcc.1*
356%if "%{gcc_version}" >= "3.4"
357%{_mandir}/man1/bfin-rtems4.9-cpp.1*
358%{_mandir}/man1/bfin-rtems4.9-gcov.1*
359%endif
360
361%dir %{_bindir}
362%{_bindir}/bfin-rtems4.9-cpp%{_exeext}
363%{_bindir}/bfin-rtems4.9-gcc%{_exeext}
364%if "%{gcc_version}" >= "3.3"
365%{_bindir}/bfin-rtems4.9-gcc-%{gcc_version}%{_exeext}
366%endif
367%{_bindir}/bfin-rtems4.9-gcov%{_exeext}
368%{_bindir}/bfin-rtems4.9-gccbug
369
370%dir %{gcclib}/bfin-rtems4.9/%{gcc_version}/include
371%if "%{gcc_version}" > "4.0.3"
372%if "bfin-rtems4.9" != "bfin-rtems4.9"
373%dir %{gcclib}/bfin-rtems4.9/%{gcc_version}/include/ssp
374%endif
375%endif
376
377%dir %{gccexec}
378%dir %{gccexec}/bfin-rtems4.9
379%dir %{gccexec}/bfin-rtems4.9/%{gcc_version}
380%{gccexec}/bfin-rtems4.9/%{gcc_version}/cc1%{_exeext}
381%{gccexec}/bfin-rtems4.9/%{gcc_version}/collect2%{_exeext}
382
383# ==============================================================
384# rtems-4.9-gcc-common
385# ==============================================================
386%package -n rtems-4.9-gcc-common
387Summary:        Base package for rtems gcc and newlib C Library
388Group:          Development/Tools
389Version:        %{gcc_rpmvers}
390License:        GPL
391
392Requires(post):         /sbin/install-info
393Requires(preun):        /sbin/install-info
394
395%description -n rtems-4.9-gcc-common
396
397GCC files that are shared by all targets.
398
399%files -n rtems-4.9-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.9-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.9-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
444
445# ==============================================================
446# rtems-4.9-bfin-rtems4.9-newlib
447# ==============================================================
448%package -n rtems-4.9-bfin-rtems4.9-newlib
449Summary:        C Library (newlib) for bfin-rtems4.9
450Group:          Development/Tools
451License:        Distributable
452Version:        %{newlib_version}
453
454Provides:       rtems-4.9-bfin-rtems4.9-libc = %{newlib_version}-%{release}
455Obsoletes:      rtems-4.9-bfin-rtems4.9-libc < %{newlib_version}-%{release}
456
457Requires:       rtems-4.9-newlib-common
458
459%description -n rtems-4.9-bfin-rtems4.9-newlib
460Newlib C Library for bfin-rtems4.9.
461
462%files -n rtems-4.9-bfin-rtems4.9-newlib -f build/files.newlib
463%defattr(-,root,root)
464%dir %{_prefix}
465%dir %{_exec_prefix}/bfin-rtems4.9
466%{_exec_prefix}/bfin-rtems4.9/include
467
468# ==============================================================
469# rtems-4.9-newlib-common
470# ==============================================================
471%package -n rtems-4.9-newlib-common
472Summary:        Base package for RTEMS newlib C Library
473Group:          Development/Tools
474Version:        %{newlib_version}
475License:        Distributable
476
477Requires(post):         /sbin/install-info
478Requires(preun):        /sbin/install-info
479
480%description -n rtems-4.9-newlib-common
481newlib files that are shared by all targets.
482
483%files -n rtems-4.9-newlib-common
484%defattr(-,root,root)
485%dir %{_infodir}
486%ghost %{_infodir}/dir
487%{_infodir}/libc.info*
488%{_infodir}/libm.info*
489
490%post -n rtems-4.9-newlib-common
491  /sbin/install-info --info-dir=%{_infodir} %{_infodir}/libc.info.gz || :
492  /sbin/install-info --info-dir=%{_infodir} %{_infodir}/libm.info.gz || :
493
494%preun -n rtems-4.9-newlib-common
495if [ $1 -eq 0 ]; then
496  /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/libc.info.gz || :
497  /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/libm.info.gz || :
498fi
499
Note: See TracBrowser for help on using the repository browser.