source: rtems/contrib/crossrpms/rtems4.8/bfin/rtems-4.8-bfin-rtems4.8-gcc.spec @ 4cf3275

4.8
Last change on this file since 4cf3275 was 7d25764, checked in by Ralf Corsepius <ralf.corsepius@…>, on Dec 21, 2007 at 11:31:44 AM

newlib-1.15.0-rtems4.8-20071221.diff

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