Update the NIOS tools to support Cxc.

This commit is contained in:
Chris Johns 2013-06-19 14:37:48 +10:00
parent 80d5fde1ba
commit 9e0f6afe57

View File

@ -30,6 +30,11 @@ Release: %{release}
URL: http://gcc.gnu.org/
BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
#
# Supports Candian Cross (Cxc).
#
%define allow_cxc
#
# Source
#
@ -52,45 +57,63 @@ Source10: ftp://sourceware.org/pub/newlib/newlib-%{newlib_version}.tar.gz
# Prepare the source code.
#
%prep
%setup -q -c -T -n %{name}-%{version}
# gcc
%setup -q -T -D -n %{name}-%{version} -a0
cd gcc-%{gcc_version}
%{?patch0:%patch0 -p1}
source_dir_0="gcc-%{gcc_version}"
%setup -q -c -n %{name}-%{version}
cd ${source_dir_0}
%{?patch0:%patch0 %{?patch0_opts:%{patch0_opts}}%{!?patch0_opts:-p1}}
%{?patch1:%patch1 %{?patch1_opts:%{patch1_opts}}%{!?patch1_opts:-p1}}
%{?patch2:%patch2 %{?patch2_opts:%{patch2_opts}}%{!?patch2_opts:-p1}}
%{?patch3:%patch3 %{?patch3_opts:%{patch3_opts}}%{!?patch3_opts:-p1}}
%{?patch4:%patch4 %{?patch4_opts:%{patch4_opts}}%{!?patch4_opts:-p1}}
%{?patch5:%patch5 %{?patch5_opts:%{patch5_opts}}%{!?patch5_opts:-p1}}
%{?patch6:%patch6 %{?patch6_opts:%{patch6_opts}}%{!?patch6_opts:-p1}}
%{?patch7:%patch7 %{?patch7_opts:%{patch7_opts}}%{!?patch7_opts:-p1}}
%{?patch8:%patch8 %{?patch8_opts:%{patch8_opts}}%{!?patch8_opts:-p1}}
%{?patch9:%patch9 %{?patch9_opts:%{patch9_opts}}%{!?patch9_opts:-p1}}
cd ..
# newlib
%setup -q -T -D -n %{name}-%{version} -a10
cd newlib-%{newlib_version}
%{?patch10:%patch10 -p1}
source_dir_10="newlib-%{newlib_version}"
%setup -q -D -T -n %{name}-%{version} -a10
cd ${source_dir_10}
%{?patch10:%patch10 %{?patch10_opts:%{patch10_opts}}%{!?patch10_opts:-p1}}
%{?patch11:%patch11 %{?patch11_opts:%{patch11_opts}}%{!?patch11_opts:-p1}}
%{?patch12:%patch12 %{?patch12_opts:%{patch12_opts}}%{!?patch12_opts:-p1}}
%{?patch13:%patch13 %{?patch13_opts:%{patch13_opts}}%{!?patch13_opts:-p1}}
%{?patch14:%patch14 %{?patch14_opts:%{patch14_opts}}%{!?patch14_opts:-p1}}
%{?patch15:%patch15 %{?patch15_opts:%{patch15_opts}}%{!?patch15_opts:-p1}}
%{?patch16:%patch16 %{?patch16_opts:%{patch16_opts}}%{!?patch16_opts:-p1}}
%{?patch17:%patch17 %{?patch17_opts:%{patch17_opts}}%{!?patch17_opts:-p1}}
%{?patch18:%patch18 %{?patch18_opts:%{patch18_opts}}%{!?patch18_opts:-p1}}
%{?patch19:%patch19 %{?patch19_opts:%{patch19_opts}}%{!?patch19_opts:-p1}}
cd ..
# Link newlib into the gcc source tree
ln -s ../newlib-%{newlib_version}/newlib gcc-%{gcc_version}
%{__rmfile} ${source_dir_0}/newlib
%{__ln_s} $PWD/${source_dir_10}/newlib ${source_dir_0}/newlib
echo "%{gcc_version_message}" > gcc-%{gcc_version}/gcc/DEV-PHASE
# Fix timestamps
cd gcc-%{gcc_version}
cd ${source_dir_0}
contrib/gcc_update --touch
cd ..
%build
export PATH="%{_bindir}:${PATH}"
mkdir -p build
cd build
%{build_directory}
mkdir -p ${build_dir}
cd ${build_dir}
languages="c"
%if %{enable_cxx}
languages="$languages,c++"
%endif
%if "%{_build}" != "%{_host}"
CFLAGS_FOR_BUILD="-g -O2 -Wall" \
CC="%{_host}-gcc ${SB_OPT_FLAGS}" \
%else
# gcc is not ready to be compiled with -std=gnu99
CC=$(echo "%{__cc} ${SB_OPT_FLAGS}" | sed -e 's,-std=gnu99 ,,') \
%endif
../gcc-%{gcc_version}/configure \
%{host_build_flags}
../${source_dir_0}/configure \
--prefix=%{_prefix} \
--bindir=%{_bindir} \
--exec_prefix=%{_exec_prefix} \
@ -115,22 +138,21 @@ Source10: ftp://sourceware.org/pub/newlib/newlib-%{newlib_version}.tar.gz
%{?enable_obsolete:--enable-obsolete} \
--enable-languages="$languages"
%if "%_host" != "%_build"
# Bug in gcc-3.2.1:
# Somehow, gcc doesn't get syslimits.h right for Cdn-Xs
mkdir -p gcc/include
cp ../gcc-%{gcc_version}/gcc/gsyslimits.h gcc/include/syslimits.h
%endif
if test "%_host" != "%_build" ; then
# Bug in gcc-3.2.1:
# Somehow, gcc doesn't get syslimits.h right for Cdn-Xs
mkdir -p gcc/include
cp ../${source_dir_0}/gcc/gsyslimits.h gcc/include/syslimits.h
fi
# jobs > 1 is broken with this version of gcc
%{__make} -w N2GNU_BUILD_NEWLIB="%{newlib_cfg}" all
cd ..
%install
export PATH="%{_bindir}:${PATH}"
rm -rf $SB_BUILD_ROOT
%{__rmdir} $SB_BUILD_ROOT
cd build
cd ${build_dir}
#
# Filter the doc stuff we do not want so it builds without error on
@ -155,13 +177,16 @@ Source10: ftp://sourceware.org/pub/newlib/newlib-%{newlib_version}.tar.gz
# libiberty doesn't honor --libdir, but always installs to a
# magically guessed _libdir
rm -f ${SB_BUILD_ROOT}%{_libdir}/libiberty.a
%{__rmfile} ${SB_BUILD_ROOT}%{_libdir}/libiberty.a
# We use the version from binutils
rm -f $SB_BUILD_ROOT%{_bindir}/%{_target}-c++filt%{_exeext}
%{__rmfile} $SB_BUILD_ROOT%{_bindir}/%{_target}-c++filt%{_exeext}
# We don't ship info/dir
rm -f $SB_BUILD_ROOT%{_infodir}/dir
%{__rmfile} $SB_BUILD_ROOT%{_infodir}/dir
# Don't want libffi's man-pages
rm -f $SB_BUILD_ROOT%{_mandir}/man3/*ffi*
%{__rmfile} $SB_BUILD_ROOT%{_mandir}/man3/*ffi*
# Clean the symlinks away incase the source is a repo
%{__rmfile} ${source_dir_0}/newlib