mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-05 15:15:44 +00:00
434 lines
12 KiB
Plaintext
434 lines
12 KiB
Plaintext
|
|
%define gcc_version @gcc_version@
|
|
%define newlib_version @newlib_version@
|
|
|
|
%define gcc_target @target_alias@
|
|
|
|
Name: %{rpmprefix}%{gcc_target}-gcc-newlib
|
|
Summary: gcc and newlib C Library for %{gcc_target}.
|
|
Group: %{rpmgroup}
|
|
Release: @Release@
|
|
Epoch: 0
|
|
License: gcc is GPL/LGPL ; newlib no has restrictions on run-time usage
|
|
|
|
Packager: ralf.corsepius@rtems.org and joel@OARcorp.com
|
|
|
|
Version: gcc%{gcc_version}newlib%{newlib_version}
|
|
|
|
%if "%{gcc_version}" >= "3.2.2"
|
|
Source0: ftp://ftp.gnu.org/pub/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}@gcc_suffix@
|
|
%else
|
|
%if "%{gcc_version}" >= "3.0"
|
|
Source0: ftp://ftp.gnu.org/pub/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}.tar.gz
|
|
%else
|
|
Source0: ftp://ftp.gnu.org/pub/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}-everything.tar.gz
|
|
%endif
|
|
%endif
|
|
Source1: ftp://sources.redhat.com/pub/newlib/newlib-%{newlib_version}@newlib_suffix@
|
|
@PATCH1@
|
|
@PATCH3@
|
|
BuildPreReq: texinfo >= 4.2
|
|
BuildPreReq: %{rpmprefix}%{gcc_target}-binutils
|
|
#
|
|
# The original sources are not included in the source RPM.
|
|
# If we included them, then the source RPMs for each target
|
|
# would duplicate MBs of source unnecessarily. This is
|
|
# a duplication of over 30 MBs of source for each of
|
|
# the more than 10 targets it is possible to build.
|
|
#
|
|
# You can get them yourself from the Internet and copy them to
|
|
# your /usr/src/redhat/SOURCES directory ($RPM_SOURCE_DIR).
|
|
# Or you can try the ftp options of rpm :-)
|
|
#
|
|
%{?!_with_sources:NoSource: 0}
|
|
%{?!_with_sources:NoSource: 1}
|
|
|
|
# Use rpm -ba --define 'gnat [0|1]' xxx.spec to override building gnat for
|
|
# those targets wanting to support ada.
|
|
|
|
# default to not building gnat
|
|
%define _gnat %{?gnat:%gnat}%{!?gnat:0}
|
|
|
|
# Use rpm -ba --define 'gcj [0|1]' xxx.spec to override building gcj for
|
|
# those targets wanting to support gcj.
|
|
|
|
# default to not building gcj
|
|
%define _gcj %{?gcj:%gcj}%{!?gcj:0}
|
|
|
|
%define build_cxx %{?cxx:%cxx}%{!?cxx:1}
|
|
%if "%{gcc_version}" >= "4.0.0"
|
|
%define build_f95 %{?f95:%f95}%{!?f95:0}
|
|
%define build_g77 0
|
|
%else
|
|
%define build_f95 0
|
|
%define build_g77 %{?g77:%g77}%{!?g77:0}
|
|
%endif
|
|
%define build_objc %{?objc:%objc}%{!?objc:0}
|
|
%define build_gcj 0
|
|
%define build_gnat 0
|
|
|
|
%if "%{gcc_target}" == "arm-rtems@osversion@"
|
|
%define build_gcj %_gcj
|
|
%endif
|
|
|
|
%if "%{gcc_target}" == "avr-rtems@osversion@"
|
|
%define build_cxx 0
|
|
%endif
|
|
|
|
%if "%{gcc_target}" == "tic4x-rtems@osversion@"
|
|
%define build_cxx 0
|
|
%endif
|
|
|
|
# OBSOLETE: use tic4x instead
|
|
%if "%{gcc_target}" == "c4x-rtems@osversion@"
|
|
%define build_cxx 0
|
|
%endif
|
|
|
|
# OBSOLETE: use tic4x instead
|
|
%if "%{gcc_target}" == "c4x-rtems@osversion@"
|
|
%define build_cxx 0
|
|
%endif
|
|
|
|
%if "%{gcc_target}" == "i386-rtems@osversion@"
|
|
%define build_gnat %_gnat
|
|
%define build_gcj %_gcj
|
|
%endif
|
|
|
|
%if "%{gcc_target}" == "m68k-rtems@osversion@"
|
|
%define build_gcj %_gcj
|
|
%endif
|
|
|
|
%if "%{gcc_target}" == "mips-rtems@osversion@"
|
|
%define build_gnat %_gnat
|
|
%define build_gcj %_gcj
|
|
%endif
|
|
|
|
%if "%{gcc_target}" == "powerpc-rtems@osversion@"
|
|
%define build_gnat %_gnat
|
|
%define build_gcj %_gcj
|
|
%endif
|
|
|
|
# gcc 3.4.0 is broken for embedded sparc and gnat trips it.
|
|
%if "%{gcc_target}" == "sparc-rtems@osversion@"
|
|
%if "%{gcc_version}" >= "3.4"
|
|
%define build_gnat 0
|
|
%else
|
|
%define build_gnat %_gnat
|
|
%endif
|
|
%define build_gcj %_gcj
|
|
%endif
|
|
|
|
%if %build_gcj
|
|
# Building gcj requires bison and zlib
|
|
BuildRequires: bison
|
|
%endif
|
|
|
|
%if "%_vendor" == "redhat"
|
|
%if %build_gcj
|
|
BuildRequires: zlib-devel
|
|
%endif
|
|
%if %build_gnat
|
|
# Building gnat requires gnat
|
|
# This really isn't available until RedHat 8.0. How to conditionalize this?
|
|
BuildRequires: gcc-gnat
|
|
%endif
|
|
%if %build_f95
|
|
BuildRequires: gmp-devel
|
|
%endif
|
|
%endif
|
|
|
|
%if "%{gcc_version}" >= "3.4"
|
|
%define gcclib %{_libdir}/gcc
|
|
%define gccexec %{_libexecdir}/gcc
|
|
%else
|
|
%define gcclib %{_libdir}/gcc-lib
|
|
%define gccexec %{_libdir}/gcc-lib
|
|
%endif
|
|
|
|
%description
|
|
RTEMS is an open source operating system for embedded systems.
|
|
|
|
This is gcc's and newlib C Library's sources with patches for RTEMS.
|
|
|
|
The original sources are not included in the source RPM.
|
|
If we included them, then the source RPMs for each target
|
|
would duplicate MBs of source unnecessarily. This is
|
|
a duplication of over 30 MBs of source for each of
|
|
the more than 10 targets it is possible to build.
|
|
|
|
You can get them yourself from the Internet and copy them to
|
|
your /usr/src/[redhat|packages]/SOURCES directory ($RPM_SOURCE_DIR).
|
|
Or you can try the ftp options of rpm :-)
|
|
|
|
%prep
|
|
# untar the sources inside %{gcc_target}-gcc-newlib
|
|
%setup -c -T -n %{name}-%{version} -a0 -a1
|
|
|
|
cd gcc-%{gcc_version}
|
|
%{?PATCH0:%patch0 -p1}
|
|
cd ..
|
|
cd newlib-%{newlib_version}
|
|
%{?PATCH1:%patch1 -p1}
|
|
cd ..
|
|
|
|
cd gcc-%{gcc_version}
|
|
sed -e 's/\(version_string.* = \"[^\"]*\)/\1 (RTEMS gcc-%{gcc_version}-@gcc_patch_version@\/newlib-%{newlib_version}-@newlib_patch_version@-@Release@)/' \
|
|
gcc/version.c > gcc/version.c~
|
|
mv gcc/version.c~ gcc/version.c
|
|
|
|
# Fix timestamps
|
|
contrib/gcc_update --touch
|
|
cd ..
|
|
|
|
# Copy the C library into gcc's source tree
|
|
ln -s ../newlib-%{newlib_version}/newlib gcc-%{gcc_version}
|
|
test -d build || mkdir build
|
|
|
|
%build
|
|
cd build
|
|
|
|
languages="c"
|
|
%if %build_cxx
|
|
languages="$languages,c++"
|
|
%endif
|
|
%if %build_g77
|
|
languages="$languages,g77"
|
|
%endif
|
|
%if %build_f95
|
|
languages="$languages,f95"
|
|
%endif
|
|
%if %build_gcj
|
|
languages="$languages,java"
|
|
%endif
|
|
%if %build_objc
|
|
languages="$languages,objc"
|
|
%endif
|
|
%if %build_gnat
|
|
languages="$languages,ada"
|
|
%endif
|
|
|
|
export PATH="%{_bindir}:${PATH}"
|
|
../gcc-%{gcc_version}/configure \
|
|
--prefix=%{_prefix} \
|
|
--bindir=%{_bindir} \
|
|
--includedir=%{_includedir} \
|
|
--libdir=%{_libdir} \
|
|
--mandir=%{_mandir} \
|
|
--infodir=%{_infodir} \
|
|
--build=%_build --host=%_host \
|
|
--target=%{gcc_target} \
|
|
--with-gnu-as --with-gnu-ld --with-newlib --verbose \
|
|
--with-system-zlib --disable-nls \
|
|
--enable-version-specific-runtime-libs \
|
|
--enable-threads=rtems \
|
|
--enable-languages=$languages ${libgcj_flag}
|
|
|
|
%if "%_host" != "%_build"
|
|
# Bug in gcc-3.2.1:
|
|
# Somehow, gcc doesn't get syslimits.h right for Cdn-Xs
|
|
test -d gcc/include || mkdir -p gcc/include
|
|
cp ../gcc-%{gcc_version}/gcc/gsyslimits.h gcc/include/syslimits.h
|
|
%endif
|
|
|
|
%if %build_gnat
|
|
%if "%{gcc_version}" < "3.4"
|
|
cd ../gcc-%{gcc_version}/gcc/ada
|
|
touch treeprs.ads [es]info.h nmake.ad[bs]
|
|
cd ../../../build
|
|
%endif
|
|
%endif
|
|
|
|
make all
|
|
%if %build_gnat
|
|
# This gnat configuration is crap :(
|
|
|
|
%if "%{gcc_version}" >= "3.4"
|
|
# This is what is documented - Of cause it doesn't work.
|
|
make -C gcc gnatlib
|
|
make -C gcc cross-gnattools
|
|
make -C gcc ada.all.cross
|
|
%endif
|
|
|
|
%if "%{gcc_version}" < "3.4"
|
|
# This is what had worked for some versions of gcc.
|
|
make -C gcc cross-gnattools
|
|
make -C gcc ada.all.cross
|
|
# This is what gcc/ada/Makefile.in contains by default,
|
|
# but what we override below
|
|
GNATLIBCFLAGS="-g -O2"
|
|
# Let gnatlib building find newlib's headers
|
|
GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/%{gcc_target}/newlib/targ-include"
|
|
GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/../newlib-%{newlib_version}/newlib/libc/include"
|
|
GNATLIBCFLAGS="$GNATLIBCFLAGS -isystem `pwd`/../gcc-%{gcc_version}/include"
|
|
# Without this xgcc doesn't find the target's binutils.
|
|
GNATLIBCFLAGS="$GNATLIBCFLAGS -B%{_prefix}/%{gcc_target}/bin/"
|
|
%if "%{gcc_target}" == "mips-rtems@osversion@"
|
|
GNATLIBCFLAGS="$GNATLIBCFLAGS -G0"
|
|
%endif
|
|
make -C gcc GNATLIBCFLAGS="${GNATLIBCFLAGS}" gnatlib
|
|
%endif
|
|
%endif
|
|
make info
|
|
|
|
%install
|
|
export PATH="%{_bindir}:${PATH}"
|
|
rm -rf $RPM_BUILD_ROOT
|
|
|
|
cd build
|
|
# Bug in gcc-2.95.1: It doesn't build this installation directory
|
|
# If it doesn't find it, gcc doesn't install %{gcc_target}/bin/gcc
|
|
%if "%{gcc_version}" < "3.0"
|
|
mkdir -p $RPM_BUILD_ROOT%{_prefix}/%{gcc_target}/bin
|
|
%endif
|
|
|
|
make prefix=$RPM_BUILD_ROOT%{_prefix} \
|
|
bindir=$RPM_BUILD_ROOT%{_bindir} \
|
|
libdir=$RPM_BUILD_ROOT%{_libdir} \
|
|
includedir=$RPM_BUILD_ROOT%{_includedir} \
|
|
mandir=$RPM_BUILD_ROOT%{_mandir} \
|
|
infodir=$RPM_BUILD_ROOT%{_infodir} \
|
|
install
|
|
cd %{gcc_target}/newlib
|
|
make prefix=$RPM_BUILD_ROOT%{_prefix} \
|
|
bindir=$RPM_BUILD_ROOT%{_bindir} \
|
|
libdir=$RPM_BUILD_ROOT%{_libdir} \
|
|
includedir=$RPM_BUILD_ROOT%{_includedir} \
|
|
mandir=$RPM_BUILD_ROOT%{_mandir} \
|
|
infodir=$RPM_BUILD_ROOT%{_infodir} \
|
|
install-info
|
|
# cd back to build/
|
|
cd ../..
|
|
|
|
%if %build_gnat
|
|
# Install a copy of gcc as gnatgcc
|
|
# Enables us to mix different versions of gnat and gnatgcc
|
|
rm -f $RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-gnatgcc%{_exeext}
|
|
ln $RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-gcc%{_exeext} \
|
|
$RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-gnatgcc%{_exeext}
|
|
%endif
|
|
|
|
# Bug in gcc-3.x: It puts the build dirs into *.la files
|
|
|
|
# host library
|
|
rm -f ${RPM_BUILD_ROOT}%{_prefix}/lib/libiberty.a
|
|
|
|
# We use the version from binutils
|
|
rm -f $RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-c++filt%{_exeext}
|
|
|
|
# We don't ship info/dir
|
|
rm -f $RPM_BUILD_ROOT%{_infodir}/dir
|
|
|
|
%if %build_f95
|
|
# # Bug in gcc-4.0.0pre
|
|
# mv $RPM_BUILD_ROOT%{_bindir}/gfortran $RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-gfortran
|
|
%endif
|
|
|
|
%if "%{gcc_version}" >= "3.4"
|
|
# Bug in gcc-3.4.0pre
|
|
rm -f $RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-%{gcc_target}-gcjh%{_exeext}
|
|
%endif
|
|
|
|
%if "%{gcc_version}" >= "3.3"
|
|
# Bug in gcc-3.3.x/gcc-3.4.x: Despite we don't need fixincludes, it installs
|
|
# the fixinclude-install-tools
|
|
rm -rf ${RPM_BUILD_ROOT}%{gcclib}/%{gcc_target}/%{gcc_version}/install-tools
|
|
rm -rf ${RPM_BUILD_ROOT}%{gccexec}/%{gcc_target}/%{gcc_version}/install-tools
|
|
%endif
|
|
|
|
%if "%{gcc_version}" < "3.0"
|
|
# Bug in gcc-2.95.x: It bogusly tries to share cpp for all targets.
|
|
# Rename it to target_alias-cpp
|
|
if test -f $RPM_BUILD_ROOT%{_bindir}/cpp%{_exeext};
|
|
then
|
|
mv $RPM_BUILD_ROOT%{_bindir}/cpp%{_exeext} \
|
|
$RPM_BUILD_ROOT%{_bindir}/%{gcc_target}-cpp%{_exeext}
|
|
fi
|
|
%endif
|
|
|
|
# gzip info files
|
|
ls $RPM_BUILD_ROOT%{_infodir}/*.info \
|
|
$RPM_BUILD_ROOT%{_infodir}/*.info-? \
|
|
$RPM_BUILD_ROOT%{_infodir}/*.info-?? \
|
|
| while read a; do \
|
|
gzip -9qf $a 2>/dev/null; \
|
|
done
|
|
|
|
# gzip man pages
|
|
gzip -9qf $RPM_BUILD_ROOT%{_mandir}/man?/*.? 2>/dev/null
|
|
|
|
rm -f dirs ;
|
|
echo "%defattr(-,root,root)" >> dirs
|
|
echo "%dir %{_prefix}/lib" >> dirs ;
|
|
echo "%dir %{gcclib}" >> dirs ;
|
|
echo "%dir %{gcclib}/%{gcc_target}" >> dirs ;
|
|
|
|
# Collect multilib subdirectories
|
|
f=`gcc/xgcc -Bgcc/ --print-multi-lib | sed -e 's,;.*$,,'`
|
|
|
|
TGTDIR="%{gcclib}/%{gcc_target}/%{gcc_version}"
|
|
for i in $f; do
|
|
case $i in
|
|
\.) echo "%dir ${TGTDIR}" >> dirs
|
|
;;
|
|
*) echo "%dir ${TGTDIR}/$i" >> dirs
|
|
;;
|
|
esac
|
|
done
|
|
|
|
TGTDIR="%{_prefix}/%{gcc_target}/lib"
|
|
for i in $f; do
|
|
case $i in
|
|
\.) echo "%dir ${TGTDIR}" >> dirs
|
|
;;
|
|
*) echo "%dir ${TGTDIR}/$i" >> dirs
|
|
;;
|
|
esac
|
|
done
|
|
|
|
# Collect files to go into different packages
|
|
cp dirs files.gcc
|
|
cp dirs files.g77
|
|
cp dirs files.gfortran
|
|
cp dirs files.objc
|
|
cp dirs files.gcj
|
|
cp dirs files.g++
|
|
|
|
TGTDIR="%{gcclib}/%{gcc_target}/%{gcc_version}"
|
|
f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
|
|
for i in $f; do
|
|
case $i in
|
|
*lib*.la) rm ${RPM_BUILD_ROOT}/$i ;; # ignore: gcc produces bogus libtool libs
|
|
*f771) ;;
|
|
*f951) ;;
|
|
*cc1) ;;
|
|
*cc1obj) ;;
|
|
*cc1plus) ;; # ignore: explicitly put into rpm elsewhere
|
|
*collect2) ;;
|
|
*libobjc*) echo "$i" >> files.objc ;;
|
|
*include/objc*) ;;
|
|
*include/g++*);;
|
|
*include/c++*);;
|
|
*adainclude*);;
|
|
*adalib*);;
|
|
*gnat1);;
|
|
*jc1) ;;
|
|
*jvgenmain) ;;
|
|
*libgfortran*.a) echo "$i" >> files.gfortran ;;
|
|
*libstdc++.a) echo "$i" >> files.g++ ;;
|
|
*libsupc++.a) echo "$i" >> files.g++ ;;
|
|
*) echo "$i" >> files.gcc ;;
|
|
esac
|
|
done
|
|
|
|
TGTDIR="%{_prefix}/%{gcc_target}/lib"
|
|
f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
|
|
for i in $f; do
|
|
case $i in
|
|
*lib*.la) rm ${RPM_BUILD_ROOT}/$i;; # ignore - gcc produces bogus libtool libs
|
|
*libiberty.a) rm ${RPM_BUILD_ROOT}/$i ;; # ignore - GPL'ed
|
|
# all other files belong to gcc
|
|
*) echo "$i" >> files.gcc ;;
|
|
esac
|
|
done
|
|
|