source: rtems/contrib/crossrpms/rtems4.9/tic4x/rtems-4.9-tic4x-rtems4.9-gcc.spec @ dfc0dc23

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