source: rtems/contrib/crossrpms/rtems4.9/avr/rtems-4.9-avr-rtems4.9-gcc.spec @ c89a4e4e

4.104.114.9
Last change on this file since c89a4e4e was c89a4e4e, checked in by Ralf Corsepius <ralf.corsepius@…>, on Nov 14, 2007 at 3:15:31 AM

gcc-core-4.2.2-rtems4.9-20071114.diff.

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