Support Canadian cross builds on FreeBSD (and other hosts).

Set up the rules to manage the separate host and build setting to
allow a Canadian cross to complete.

Update the scripts to move the build directory and host/build
flags into the defaults so they are common for all build
configurations.
This commit is contained in:
Chris Johns
2013-05-15 12:15:14 +10:00
parent 8a1e7a0ab0
commit db65c6aaf1
12 changed files with 126 additions and 72 deletions

View File

@@ -54,15 +54,13 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
cd ..
%build
%{?host_force_32bit:HOST_FORCE_32BIT="-m32"}
if test "%{_build}" != "%{_host}" ; then
build_dir="build-cxc"
else
build_dir="build"
fi
%{build_directory}
mkdir -p ${build_dir}
cd ${build_dir}
CFLAGS="$SB_OPT_FLAGS" \
%{host_build_flags}
../${source_dir_0}/configure \
--build=%{_build} --host=%{_host} \
--target=%{_target} \

View File

@@ -39,6 +39,8 @@ Source0: http://www.jdl.com/software/dtc-v%{dtc_version}.tgz
%build
cd dtc-v%{dtc_version}
%{host_build_flags}
%{__make} PREFIX=%{_prefix}
cd ..

View File

@@ -32,12 +32,8 @@ Source0: http://downloads.sourceforge.net/project/expat/expat/%{expat_version}/e
%build
cd expat-%{expat_version}
if test "%{_build}" != "%{_host}" ; then
CFLAGS_FOR_BUILD="-g -O2 -Wall"
fi
export CFLAGS_FOR_BUILD
%{host_build_flags}
CFLAGS="$SB_OPT_FLAGS" \
./configure \
--build=%{_build} --host=%{_host} \
--verbose \
@@ -48,8 +44,6 @@ Source0: http://downloads.sourceforge.net/project/expat/expat/%{expat_version}/e
%{__make} %{?_smp_mflags} all
unset CFLAGS_FOR_BUILD
cd ..
%install

View File

@@ -110,12 +110,8 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
cd ..
%build
# Build directory support.
if test "%{_build}" != "%{_host}" ; then
build_dir="build-cxc"
else
build_dir="build"
fi
%{build_directory}
mkdir -p ${build_dir}
cd ${build_dir}
@@ -140,18 +136,7 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
languages="$languages,objc"
%endif
# Host flags
if test "%{_build}" != "%{_host}" ; then
CFLAGS_FOR_BUILD="-g -O2 -Wall"
CC="%{_host}-gcc ${SB_OPT_FLAGS}"
CXXFLAGS_FOR_BUILD="-g -O2 -Wall"
CXX="%{_host}-g++ ${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 ,,')
CXX=$(echo "%{__cxx} ${SB_OPT_FLAGS}" | sed -e 's,-std=gnu99 ,,')
fi
export CFLAGS CFLAGS_FOR_BUILD CC CXXFLAGS_FOR_BUILD CXX
%{host_build_flags}
../${source_dir_0}/configure \
--prefix=%{_prefix} \
@@ -190,8 +175,6 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
%{__make} %{?_smp_mflags} all
cd ..
unset CFLAGS CFLAGS_FOR_BUILD CC CXXFLAGS_FOR_BUILD CXX
%install
%{__rmdir} $SB_BUILD_ROOT

View File

@@ -58,19 +58,22 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
cd ..
%build
if test "%{_build}" != "%{_host}" ; then
build_dir="build-cxc"
else
build_dir="build"
fi
%{build_directory}
mkdir -p ${build_dir}
cd ${build_dir}
%{host_build_flags}
if test "%{_build}" != "%{_host}" ; then
CFLAGS_FOR_BUILD="-g -O2 -Wall"
GDB_LIBS_STATIC="-lexpat"
else
GDB_LIBS_STATIC="-lexpat"
GDB_LIBS="%{_forced_static}"
fi
LIBS_STATIC="-lexpat"
CFLAGS="$SB_OPT_FLAGS" \
LIBS="%{_forced_static}" \
LIBS_STATIC=${GDB_LIBS_STATIC} \
LIBS=${GDB_LIBS} \
../${source_dir_0}/configure \
--build=%{_build} --host=%{_host} \
--target=%{_target} \