source: rtems/contrib/crossrpms/rtems4.10/m32c/rtems-4.10-m32c-rtems4.10-gcc.spec @ 5faedff

4.104.11
Last change on this file since 5faedff was 5faedff, checked in by Ralf Corsepius <ralf.corsepius@…>, on Apr 20, 2009 at 9:28:37 AM

Regenerate.

  • Property mode set to 100644
File size: 14.8 KB
Line 
1#
2# Please send bugfixes or comments to
3#       http://www.rtems.org/bugzilla
4#
5
6%define _prefix                 /opt/rtems-4.10
7%define _exec_prefix            %{_prefix}
8%define _bindir                 %{_exec_prefix}/bin
9%define _sbindir                %{_exec_prefix}/sbin
10%define _libexecdir             %{_exec_prefix}/libexec
11%define _datarootdir            %{_prefix}/share
12%define _datadir                %{_datarootdir}
13%define _sysconfdir             %{_prefix}/etc
14%define _sharedstatedir         %{_prefix}/com
15%define _localstatedir          %{_prefix}/var
16%define _includedir             %{_prefix}/include
17%define _libdir                 %{_exec_prefix}/%{_lib}
18%define _mandir                 %{_datarootdir}/man
19%define _infodir                %{_datarootdir}/info
20%define _localedir              %{_datarootdir}/locale
21
22%ifos cygwin cygwin32 mingw mingw32
23%define _exeext .exe
24%define debug_package           %{nil}
25%define _libdir                 %{_exec_prefix}/lib
26%else
27%define _exeext %{nil}
28%endif
29
30%ifos cygwin cygwin32
31%define optflags -O3 -pipe -march=i486 -funroll-loops
32%endif
33
34%ifos mingw mingw32
35%if %{defined _mingw32_cflags}
36%define optflags %{_mingw32_cflags}
37%else
38%define optflags -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -mms-bitfields
39%endif
40%endif
41
42%if "%{_build}" != "%{_host}"
43%define _host_rpmprefix rtems-4.10-%{_host}-
44%else
45%define _host_rpmprefix %{nil}
46%endif
47
48
49%define gcc_pkgvers 4.4.0-RC-20090414
50%define gcc_version 4.4.0
51%define gcc_rpmvers %{expand:%(echo "4.4.0" | tr - _ )}
52
53%define newlib_pkgvers          1.17.0
54%define newlib_version          1.17.0
55
56Name:           rtems-4.10-m32c-rtems4.10-gcc
57Summary:        m32c-rtems4.10 gcc
58
59Group:          Development/Tools
60Version:        %{gcc_rpmvers}
61Release:        3%{?dist}
62License:        GPL
63URL:            http://gcc.gnu.org
64BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
65
66%define _use_internal_dependency_generator 0
67
68BuildRequires:  %{_host_rpmprefix}gcc
69
70%if "%{gcc_version}" >= "4.3.0"
71%define _gmp_minvers            4.1
72%else
73%if "%{gcc_version}" >= "4.2.0"
74%endif
75%endif
76
77%if %{defined _gmp_minvers}
78BuildRequires: gmp-devel >= %{_gmp_minvers}
79%if "%{_build}" != "%{_host}"
80BuildRequires:  %{_host_rpmprefix}gmp-devel >= %{_gmp_minvers}
81%endif
82%endif
83
84
85%if "%{gcc_version}" >= "4.4.0"
86%define _mpfr_minvers   2.3.2
87%define mpfr_version    2.4.1
88%else
89%if "%{gcc_version}" >= "4.3.0"
90%define _mpfr_minvers   2.3.1
91%define mpfr_version    2.3.2
92%else
93%if "%{gcc_version}" >= "4.2.0"
94%endif
95%endif
96%endif
97
98%if %{defined _mpfr_minvers}
99%{?suse10_3:%global mpfr_provided 2.2.1}
100%{?fc9:%global mpfr_provided 2.3.1}
101%{?fc10:%global mpfr_provided 2.3.2}
102%{?fc11:%global mpfr_provided 2.4.1}
103
104%if %{defined mpfr_provided}
105%if "%{mpfr_provided}" < "%{_mpfr_minvers}"
106%define _build_mpfr 1
107%else
108BuildRequires: mpfr-devel >= %{_mpfr_minvers}
109%endif
110%else
111%define _build_mpfr 1
112%endif
113
114%if "%{_build}" != "%{_host}"
115BuildRequires:  %{_host_rpmprefix}mpfr-devel >= %{_mpfr_minvers}
116%endif
117%endif
118
119%if "%{_build}" != "%{_host}"
120BuildRequires:  rtems-4.10-m32c-rtems4.10-gcc = %{gcc_rpmvers}
121%endif
122
123%if "%{gcc_version}" >= "4.2.0"
124BuildRequires:  flex bison
125%endif
126
127
128BuildRequires:  texinfo >= 4.2
129BuildRequires:  rtems-4.10-m32c-rtems4.10-binutils
130
131Requires:       rtems-4.10-m32c-rtems4.10-binutils
132Requires:       rtems-4.10-m32c-rtems4.10-newlib = %{newlib_version}-36%{?dist}
133
134
135%if "%{gcc_version}" >= "3.4"
136%define gcclib %{_libdir}/gcc
137%define gccexec %{_libexecdir}/gcc
138%else
139%define gcclib %{_libdir}/gcc-lib
140%define gccexec %{_libdir}/gcc-lib
141%endif
142
143%if "%{gcc_version}" == "4.3.3"
144Source0:        ftp://ftp.gnu.org/pub/gnu/gcc/%{gcc_pkgvers}/gcc-core-%{gcc_pkgvers}.tar.bz2
145Patch0:         ftp://ftp.rtems.org/pub/rtems/SOURCES/4.10/gcc-core-4.3.3-rtems4.10-20090125.diff
146%endif
147%if "%{gcc_version}" == "4.4.0"
148Source0:        ftp://gcc.gnu.org/pub/gcc/snapshots/%{gcc_pkgvers}/gcc-core-%{gcc_pkgvers}.tar.bz2
149Patch0:         ftp://ftp.rtems.org/pub/rtems/SOURCES/4.10/gcc-core-%{gcc_pkgvers}-rtems4.10-20090415.diff
150%endif
151%{?_without_sources:NoSource:   0}
152
153%if "%{newlib_version}" == "1.17.0"
154Source50:       ftp://sources.redhat.com/pub/newlib/newlib-%{newlib_pkgvers}.tar.gz
155Patch50:        ftp://ftp.rtems.org/pub/rtems/SOURCES/4.10/newlib-1.17.0-rtems4.10-20090311.diff
156%endif
157%{?_without_sources:NoSource:   50}
158
159%if "%{gcc_version}" >= "4.3.0"
160Source60:    http://www.mpfr.org/mpfr-current/mpfr-%{mpfr_version}.tar.bz2
161%endif
162
163%description
164Cross gcc for m32c-rtems4.10.
165
166%prep
167%setup -c -T -n %{name}-%{version}
168
169%setup -q -T -D -n %{name}-%{version} -a0
170%{?PATCH0:%patch0 -p0}
171
172
173
174
175
176
177%setup -q -T -D -n %{name}-%{version} -a50
178cd newlib-%{newlib_version}
179%{?PATCH50:%patch50 -p1}
180cd ..
181  # Copy the C library into gcc's source tree
182  ln -s ../newlib-%{newlib_version}/newlib gcc-%{gcc_pkgvers}
183
184%if 0%{?_build_mpfr}
185%setup -q -T -D -n %{name}-%{version} -a60
186%{?PATCH60:%patch60 -p1}
187  # Build mpfr one-tree style
188  ln -s ../mpfr-%{mpfr_version} gcc-%{gcc_pkgvers}/mpfr
189%endif
190
191%if "%{gcc_version}" < "4.1.0"
192  sed -e 's/\(version_string.* = \"[^\"]*\)/\1 (RTEMS gcc-%{gcc_version}\/newlib-%{newlib_version}-%release)/' \
193  gcc-%{gcc_pkgvers}/gcc/version.c > gcc-%{gcc_pkgvers}/gcc/version.c~
194%else
195  sed -e 's/^#define VERSUFFIX.*$/#define VERSUFFIX \" (RTEMS gcc-%{gcc_version}\/newlib-%{newlib_version}-%{release})\"/' \
196    gcc-%{gcc_pkgvers}/gcc/version.c > gcc-%{gcc_pkgvers}/gcc/version.c~
197%endif
198  mv gcc-%{gcc_pkgvers}/gcc/version.c~ gcc-%{gcc_pkgvers}/gcc/version.c
199
200
201  # Fix timestamps
202  cd gcc-%{gcc_pkgvers}
203  contrib/gcc_update --touch
204  cd ..
205%build
206  mkdir -p build
207
208  cd build
209
210  languages="c"
211  export PATH="%{_bindir}:${PATH}"
212%if "%{_build}" != "%{_host}"
213  CFLAGS_FOR_BUILD="-g -O2 -Wall" \
214  CC="%{_host}-gcc ${RPM_OPT_FLAGS}" \
215%else
216# gcc is not ready to be compiled with -std=gnu99
217  CC=$(echo "%{__cc} ${RPM_OPT_FLAGS}" | sed -e 's,-std=gnu99 ,,') \
218%endif
219  ../gcc-%{gcc_pkgvers}/configure \
220    --prefix=%{_prefix} \
221    --bindir=%{_bindir} \
222    --exec_prefix=%{_exec_prefix} \
223    --includedir=%{_includedir} \
224    --libdir=%{_libdir} \
225    --libexecdir=%{_libexecdir} \
226    --mandir=%{_mandir} \
227    --infodir=%{_infodir} \
228    --datadir=%{_datadir} \
229    --build=%_build --host=%_host \
230    --target=m32c-rtems4.10 \
231    --disable-libstdcxx-pch \
232    --with-gnu-as --with-gnu-ld --verbose \
233    --with-newlib \
234    --with-system-zlib \
235    --disable-nls --without-included-gettext \
236    --disable-win32-registry \
237    --enable-version-specific-runtime-libs \
238    --enable-threads \
239    --enable-newlib-io-c99-formats \
240    --enable-languages="$languages" $optargs
241
242%if "%_host" != "%_build"
243  # Bug in gcc-3.2.1:
244  # Somehow, gcc doesn't get syslimits.h right for Cdn-Xs
245  mkdir -p gcc/include
246  cp ../gcc-%{gcc_pkgvers}/gcc/gsyslimits.h gcc/include/syslimits.h
247%endif
248
249  make %{?_smp_mflags} all
250  cd ..
251
252%install
253  export PATH="%{_bindir}:${PATH}"
254  rm -rf $RPM_BUILD_ROOT
255
256  cd build
257
258  make DESTDIR=$RPM_BUILD_ROOT install
259  cd ..
260
261  cd build/m32c-rtems4.10/newlib
262  make DESTDIR=$RPM_BUILD_ROOT install-info
263  cd ../../..
264
265%if "%{gcc_version}" <= "4.1.2"
266# Misplaced header file
267  if test -f $RPM_BUILD_ROOT%{_includedir}/mf-runtime.h; then
268    mv $RPM_BUILD_ROOT%{_includedir}/mf-runtime.h \
269      $RPM_BUILD_ROOT%{gcclib}/m32c-rtems4.10/%{gcc_version}/include/
270  fi
271%endif
272
273  # host library
274  rm -f  ${RPM_BUILD_ROOT}%{_libdir}/libiberty.a
275
276  # We use the version from binutils
277  rm -f $RPM_BUILD_ROOT%{_bindir}/m32c-rtems4.10-c++filt%{_exeext}
278
279
280# Conflict with a native GCC's infos
281  rm -rf $RPM_BUILD_ROOT%{_infodir}
282
283# Conflict with a native GCC's man pages
284  rm -rf $RPM_BUILD_ROOT%{_mandir}/man7
285
286
287%if "%{gcc_version}" >= "3.4"
288  # Bug in gcc-3.4.0pre
289  rm -f $RPM_BUILD_ROOT%{_bindir}/m32c-rtems4.10-m32c-rtems4.10-gcjh%{_exeext}
290%endif
291
292%if "%{gcc_version}" >= "3.3"
293  # Bug in gcc-3.3.x/gcc-3.4.x: Despite we don't need fixincludes, it installs
294  # the fixinclude-install-tools
295  rm -rf ${RPM_BUILD_ROOT}%{gcclib}/m32c-rtems4.10/%{gcc_version}/install-tools
296  rm -rf ${RPM_BUILD_ROOT}%{gccexec}/m32c-rtems4.10/%{gcc_version}/install-tools
297%endif
298
299  # Bug in gcc > 4.1.0: Installs an unused, empty directory
300  if test -d ${RPM_BUILD_ROOT}%{_prefix}/m32c-rtems4.10/include/bits; then
301    rmdir ${RPM_BUILD_ROOT}%{_prefix}/m32c-rtems4.10/include/bits
302  fi
303
304  # Collect multilib subdirectories
305  f=`build/gcc/xgcc -Bbuild/gcc/ --print-multi-lib | sed -e 's,;.*$,,'`
306
307  echo "%defattr(-,root,root,-)" > build/files.newlib
308  TGTDIR="%{_exec_prefix}/m32c-rtems4.10/lib"
309  for i in $f; do
310    case $i in
311    \.) echo "%dir ${TGTDIR}" >> build/files.newlib
312      ;;
313    *)  echo "%dir ${TGTDIR}/$i" >> build/files.newlib
314      ;;
315    esac
316  done
317
318  rm -f dirs ;
319  echo "%defattr(-,root,root,-)" >> dirs
320  echo "%dir %{_prefix}" >> dirs
321  echo "%dir %{_libdir}" >> dirs
322%if "%{gcc_version}" >= "3.4"
323  echo "%dir %{_libexecdir}" >> dirs
324%endif
325  echo "%dir %{gcclib}" >> dirs
326  echo "%dir %{gcclib}/m32c-rtems4.10" >> dirs
327
328  TGTDIR="%{gcclib}/m32c-rtems4.10/%{gcc_version}"
329  for i in $f; do
330    case $i in
331    \.) echo "%dir ${TGTDIR}" >> dirs
332      ;;
333    *)  echo "%dir ${TGTDIR}/$i" >> dirs
334      ;;
335    esac
336  done
337
338  # Collect files to go into different packages
339  cp dirs build/files.gcc
340  cp dirs build/files.g77
341  cp dirs build/files.gfortran
342  cp dirs build/files.objc
343  cp dirs build/files.gcj
344  cp dirs build/files.g++
345
346  TGTDIR="%{gcclib}/m32c-rtems4.10/%{gcc_version}"
347  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
348  for i in $f; do
349    case $i in
350    *lib*.la) rm ${RPM_BUILD_ROOT}/$i ;; # ignore: gcc produces bogus libtool libs
351    *f771) ;;
352    *f951) ;;
353    *cc1) ;;
354    *cc1obj) ;;
355    *cc1plus) ;; # ignore: explicitly put into rpm elsewhere
356    *collect2) ;;
357    *libobjc*) echo "$i" >> build/files.objc ;;
358    *include/objc*) ;;
359    *include/g++*);;
360    *include/c++*);;
361    *adainclude*);;
362    *adalib*);;
363    *gnat1);;
364    *jc1) ;;
365    *jvgenmain) ;;
366    */libgfortran*.*) echo "$i" >> build/files.gfortran ;;
367    */libstdc++.*) echo "$i" >> build/files.g++ ;;
368    */libsupc++.*) echo "$i" >> build/files.g++ ;;
369    *) echo "$i" >> build/files.gcc ;;
370    esac
371  done
372
373  TGTDIR="%{_exec_prefix}/m32c-rtems4.10/lib"
374  f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
375  for i in $f; do
376    case $i in
377    *lib*.la) rm ${RPM_BUILD_ROOT}/$i;; # ignore - gcc produces bogus libtool libs
378    *libiberty.a) rm ${RPM_BUILD_ROOT}/$i ;; # ignore - GPL'ed
379# all other files belong to newlib
380    *) echo "$i" >> build/files.newlib ;;
381    esac
382  done
383# Extract %%__os_install_post into os_install_post~
384cat << \EOF > os_install_post~
385%__os_install_post
386EOF
387
388# Generate customized brp-*scripts
389cat os_install_post~ | while read a x y; do
390case $a in
391# Prevent brp-strip* from trying to handle foreign binaries
392*/brp-strip*)
393  b=$(basename $a)
394  sed -e 's,find $RPM_BUILD_ROOT,find $RPM_BUILD_ROOT%_bindir $RPM_BUILD_ROOT%_libexecdir,' $a > $b
395  chmod a+x $b
396  ;;
397# Fix up brp-compress to handle %%_prefix != /usr
398*/brp-compress*)
399  b=$(basename $a)
400  sed -e 's,\./usr/,.%{_prefix}/,g' < $a > $b
401  chmod a+x $b
402  ;;
403esac
404done
405
406sed -e 's,^[ ]*/usr/lib/rpm.*/brp-strip,./brp-strip,' \
407  -e 's,^[ ]*/usr/lib/rpm.*/brp-compress,./brp-compress,' \
408< os_install_post~ > os_install_post
409%define __os_install_post . ./os_install_post
410
411
412cat << EOF > %{_builddir}/%{name}-%{gcc_rpmvers}/find-provides
413#!/bin/sh
414grep -E -v '^${RPM_BUILD_ROOT}%{_exec_prefix}/m32c-rtems4.10/(lib|include|sys-root)' \
415  | grep -v '^${RPM_BUILD_ROOT}%{gcclib}/m32c-rtems4.10/' | %__find_provides
416EOF
417chmod +x %{_builddir}/%{name}-%{gcc_rpmvers}/find-provides
418%define __find_provides %{_builddir}/%{name}-%{gcc_rpmvers}/find-provides
419
420cat << EOF > %{_builddir}/%{name}-%{gcc_rpmvers}/find-requires
421#!/bin/sh
422grep -E -v '^${RPM_BUILD_ROOT}%{_exec_prefix}/m32c-rtems4.10/(lib|include|sys-root)' \
423  | grep -v '^${RPM_BUILD_ROOT}%{gcclib}/m32c-rtems4.10/' | %__find_requires
424EOF
425chmod +x %{_builddir}/%{name}-%{gcc_rpmvers}/find-requires
426%define __find_requires %{_builddir}/%{name}-%{gcc_rpmvers}/find-requires
427
428%ifnarch noarch
429# Extract %%__debug_install_post into debug_install_post~
430cat << \EOF > debug_install_post~
431%__debug_install_post
432EOF
433
434# Generate customized debug_install_post script
435cat debug_install_post~ | while read a x y; do
436case $a in
437# Prevent find-debuginfo.sh* from trying to handle foreign binaries
438*/find-debuginfo.sh)
439  b=$(basename $a)
440  sed -e 's,find "$RPM_BUILD_ROOT" !,find "$RPM_BUILD_ROOT"%_bindir "$RPM_BUILD_ROOT"%_libexecdir !,' $a > $b
441  chmod a+x $b
442  ;;
443esac
444done
445
446sed -e 's,^[ ]*/usr/lib/rpm/find-debuginfo.sh,./find-debuginfo.sh,' \
447< debug_install_post~ > debug_install_post
448%define __debug_install_post . ./debug_install_post
449
450%endif
451
452%clean
453  rm -rf $RPM_BUILD_ROOT
454
455# ==============================================================
456# rtems-4.10-m32c-rtems4.10-gcc
457# ==============================================================
458# %package -n rtems-4.10-m32c-rtems4.10-gcc
459# Summary:        GNU cc compiler for m32c-rtems4.10
460# Group:          Development/Tools
461# Version:        %{gcc_rpmvers}
462# Requires:       rtems-4.10-m32c-rtems4.10-binutils
463# Requires:       rtems-4.10-m32c-rtems4.10-newlib = %{newlib_version}-36%{?dist}
464# License:      GPL
465
466# %if %build_infos
467# Requires:      rtems-4.10-gcc-common
468# %endif
469
470%description -n rtems-4.10-m32c-rtems4.10-gcc
471GNU cc compiler for m32c-rtems4.10.
472
473%files -n rtems-4.10-m32c-rtems4.10-gcc -f build/files.gcc
474%defattr(-,root,root)
475%dir %{_mandir}
476%dir %{_mandir}/man1
477%{_mandir}/man1/m32c-rtems4.10-gcc.1*
478%if "%{gcc_version}" >= "3.4"
479%{_mandir}/man1/m32c-rtems4.10-cpp.1*
480%{_mandir}/man1/m32c-rtems4.10-gcov.1*
481%endif
482
483%dir %{_bindir}
484%{_bindir}/m32c-rtems4.10-cpp%{_exeext}
485%{_bindir}/m32c-rtems4.10-gcc%{_exeext}
486%if "%{gcc_version}" >= "3.3"
487%{_bindir}/m32c-rtems4.10-gcc-%{gcc_version}%{_exeext}
488%endif
489%{_bindir}/m32c-rtems4.10-gcov%{_exeext}
490%{_bindir}/m32c-rtems4.10-gccbug
491
492%dir %{gcclib}/m32c-rtems4.10/%{gcc_version}/include
493%if "%{gcc_version}" > "4.0.3"
494%if "m32c-rtems4.10" != "bfin-rtems4.10"
495%if "m32c-rtems4.10" != "avr-rtems4.10"
496%dir %{gcclib}/m32c-rtems4.10/%{gcc_version}/include/ssp
497%endif
498%endif
499%endif
500
501%if "%{gcc_version}" >= "4.3.0"
502%dir %{gcclib}/m32c-rtems4.10/%{gcc_version}/include-fixed
503%endif
504
505%dir %{gccexec}
506%dir %{gccexec}/m32c-rtems4.10
507%dir %{gccexec}/m32c-rtems4.10/%{gcc_version}
508%{gccexec}/m32c-rtems4.10/%{gcc_version}/cc1%{_exeext}
509%{gccexec}/m32c-rtems4.10/%{gcc_version}/collect2%{_exeext}
510
511
512
513
514# ==============================================================
515# rtems-4.10-m32c-rtems4.10-newlib
516# ==============================================================
517%package -n rtems-4.10-m32c-rtems4.10-newlib
518Summary:        C Library (newlib) for m32c-rtems4.10
519Group:          Development/Tools
520License:        Distributable
521Version:        %{newlib_version}
522Release:        36%{?dist}
523
524
525%description -n rtems-4.10-m32c-rtems4.10-newlib
526Newlib C Library for m32c-rtems4.10.
527
528%files -n rtems-4.10-m32c-rtems4.10-newlib -f build/files.newlib
529%defattr(-,root,root)
530%dir %{_prefix}
531%dir %{_exec_prefix}/m32c-rtems4.10
532%{_exec_prefix}/m32c-rtems4.10/include
533
Note: See TracBrowser for help on using the repository browser.