source: rtems/contrib/crossrpms/rtems4.8/avr/rtems-4.8-avr-rtems4.8-gcc.spec @ 55e9fca

4.104.114.84.95
Last change on this file since 55e9fca was 55e9fca, checked in by Ralf Corsepius <ralf.corsepius@…>, on Jun 18, 2007 at 10:32:03 AM

Preps for next spin.

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