source: rtems/contrib/crossrpms/rtems4.10/m32c/rtems-4.10-m32c-rtems4.10-gcc.spec @ 556bc15

4.104.115
Last change on this file since 556bc15 was 3521985b, checked in by Ralf Corsepius <ralf.corsepius@…>, on Apr 21, 2009 at 5:24:32 AM

Regenerate.

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