Add download git support.

Add support to use a git cloned repo as the source. Move the download
code out of the build module and into a separate module. Add to this
module support for git.

Update the GCC common configuration to support using a symlinked
git repo.

Add checks for all languages.
This commit is contained in:
Chris Johns
2013-04-16 14:25:34 +10:00
parent b022691026
commit 649a64c0af
5 changed files with 397 additions and 155 deletions

View File

@@ -17,10 +17,44 @@
%define enable_cxx 1
%endif
#
# Default to Ada off.
#
%ifn %{defined enable_ada}
%define enable_ada 0
%endif
#
# Default to Go off.
#
%ifn %{defined enable_go}
%define enable_go 0
%endif
#
# Default to Fortran off.
#
%ifn %{defined enable_fortran}
%define enable_fortran 0
%endif
#
# Default to Java off.
#
%ifn %{defined enable_java}
%define enable_java 0
%endif
#
# Default to ObjC off.
#
%ifn %{defined enable_objc}
%define enable_objc 0
%endif
#
# Hack to get around the ARM EABBI mess.
#
%ifn %{defined enable_obsolete}
%define enable_obsolete 0
%endif

View File

@@ -33,9 +33,10 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
#
%prep
# gcc and optional the g++ core if separate packages
source_dir_0="gcc-%{gcc_version}"
%setup -q -c -n %{name}-%{version}
%{?source1:%setup -q -D -T -n %{name}-%{version} -a1}
cd gcc-%{gcc_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}}
@@ -49,8 +50,9 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
cd ..
# newlib
source_dir_10="newlib-%{newlib_version}"
%setup -q -D -T -n %{name}-%{version} -a10
cd newlib-%{newlib_version}
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}}
@@ -64,40 +66,48 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
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
# MPFR
source_dir_20="mpfr-%{mpfr_version}"
%setup -q -D -T -n %{name}-%{version} -a20
cd mpfr-%{mpfr_version}
cd ${source_dir_20}
%{?patch20:%patch20 -p1}
cd ..
# Build MPFR one-tree style
ln -s ../mpfr-%{mpfr_version} gcc-%{gcc_version}/mpfr
%{__rmfile} ${source_dir_0}/mpfr
%{__ln_s} $PWD/${source_dir_20} ${source_dir_0}/mpfr
# MPC
source_dir_21="mpc-%{mpc_version}"
%setup -q -D -T -n %{name}-%{version} -a21
cd mpc-%{mpc_version}
cd ${source_dir_21}
%{?patch21:%patch21 -p1}
cd ..
# Build MPC one-tree style
ln -s ../mpc-%{mpc_version} gcc-%{gcc_version}/mpc
%{__rmfile} ${source_dir_0}/mpc
%{__ln_s} $PWD/${source_dir_21} ${source_dir_0}/mpc
# GMP
source_dir_22="gmp-%{gmp_version}"
%setup -q -D -T -n %{name}-%{version} -a22
cd gmp-%{gmp_version}
cd ${source_dir_22}
%{?patch22:%patch22 -p1}
cd ..
# Build GMP one-tree style
ln -s ../gmp-%{gmp_version} gcc-%{gcc_version}/gmp
%{__rmfile} ${source_dir_0}/gmp
%{__ln_s} $PWD/${source_dir_22} ${source_dir_0}/gmp
echo "%{gcc_version_message}" > gcc-%{gcc_version}/gcc/DEV-PHASE
echo "%{gcc_version_message}" > ${source_dir_0}/gcc/DEV-PHASE
# Fix timestamps
cd gcc-%{gcc_version}
cd ${source_dir_0}
contrib/gcc_update --touch
cd ..
%build
# Build directory support.
if test "%{_build}" != "%{_host}" ; then
build_dir="build-cxc"
else
@@ -105,10 +115,29 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
fi
mkdir -p ${build_dir}
cd ${build_dir}
# Languages.
languages="c"
%if %{enable_cxx}
languages="$languages,c++"
%endif
%if %{enable_ada}
languages="$languages,ada"
%endif
%if %{enable_go}
languages="$languages,go"
%endif
%if %{enable_fortran}
languages="$languages,fortran"
%endif
%if %{enable_java}
languages="$languages,java"
%endif
%if %{enable_objc}
languages="$languages,objc"
%endif
# Host flags
if test "%{_build}" != "%{_host}" ; then
CFLAGS_FOR_BUILD="-g -O2 -Wall"
CC="%{_host}-gcc ${SB_OPT_FLAGS}"
@@ -120,7 +149,8 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
CXX=$(echo "%{__cxx} ${SB_OPT_FLAGS}" | sed -e 's,-std=gnu99 ,,')
fi
export CFLAGS CFLAGS_FOR_BUILD CC CXXFLAGS_FOR_BUILD CXX
../gcc-%{gcc_version}/configure \
../${source_dir_0}/configure \
--prefix=%{_prefix} \
--bindir=%{_bindir} \
--exec_prefix=%{_exec_prefix} \
@@ -147,18 +177,18 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
%{?enable_obsolete:--enable-obsolete} \
--enable-languages="$languages"
unset CFLAGS CFLAGS_FOR_BUILD CC CXXFLAGS_FOR_BUILD CXX
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 ../gcc-%{gcc_version}/gcc/gsyslimits.h gcc/include/syslimits.h
cp ../${source_dir_0}/gcc/gsyslimits.h gcc/include/syslimits.h
fi
%{__make} %{?_smp_mflags} all
cd ..
unset CFLAGS CFLAGS_FOR_BUILD CC CXXFLAGS_FOR_BUILD CXX
%install
%{__rmdir} $SB_BUILD_ROOT
@@ -179,6 +209,12 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
# Don't want libffi's man-pages
%{__rmfile} $SB_BUILD_ROOT%{_mandir}/man3/*ffi*
# Clean the symlinks away incase the source is a repo
%{__rmfile} ${source_dir_0}/newlib
%{__rmfile} ${source_dir_0}/mpfr
%{__rmfile} ${source_dir_0}/mpc
%{__rmfile} ${source_dir_0}/gmp
%testing
# Add testing here.
export RUNTESTFLAGS=--target_board=%{_target}-run