Added support for cross compiling packages on x86_64.

Two new options for the configuration file were added:
 * XBPS_CROSS_TARGET
 * XBPS_CROSS_DIR

XBPS_CROSS_TARGET should be set to the target triplet that you build
with the mktoolchain script.

XBPS_CROSS_DIR should point to the cross directory that mktoolchain
created if you've built one.

As proof of concept the glibc32 package has been added for x86_64,
and it works perfectly even in the chroot! with glibc32 in place
that means that I can build a gcc multilib and use -m32 to build
32bit packages! OH YEAH I LOVE THAT SHIT!!!!

--HG--
extra : convert_revision : 6b0008865e084674a1c4b58266f681871e519c66
This commit is contained in:
Juan RP 2008-11-03 07:12:53 +01:00
parent 1ae9019da2
commit d15b7887e7
5 changed files with 174 additions and 4 deletions

38
xbps.sh
View file

@ -32,6 +32,7 @@ trap "echo && exit 1" INT QUIT
: ${progname:=$(basename $0)}
: ${fetch_cmd:=wget}
: ${xbps_machine:=$(uname -m)}
: ${XBPS_CROSS_HOST:=$xbps_machine-pc-linux-gnu}
usage()
{
@ -235,7 +236,7 @@ reset_tmpl_vars()
postinstall_helpers make_install_target version \
tar_override_cmd xml_entries sgml_entries \
build_depends libtool_fixup_la_stage no_fixup_libtool \
disable_parallel_build run_depends \
disable_parallel_build run_depends cross_compiler \
XBPS_EXTRACT_DONE XBPS_CONFIGURE_DONE \
XBPS_BUILD_DONE XBPS_INSTALL_DONE"
@ -685,6 +686,17 @@ configure_src_phase()
# Apply patches if requested by template file
[ ! -f $XBPS_APPLYPATCHES_DONE ] && apply_tmpl_patches
# cross compilation vars.
if [ -n "$cross_compiler" ]; then
. $XBPS_HELPERSDIR/cross-compilation.sh
cross_compile_setvars
else
if [ "$build_style" = "gnu_configure" ]; then
configure_args="$configure_args --host=${xbps_machine}-pc-linux-gnu"
configure_args="$configure_args --build=${xbps_machine}-pc-linux-gnu"
fi
fi
# Run pre_configure helpers.
run_func pre_configure
@ -712,8 +724,6 @@ configure_src_phase()
#
if [ "$build_style" = "gnu_configure" ]; then
${configure_script} \
--host=${xbps_machine}-linux-gnu \
--build=${xbps_machine}-linux-gnu \
--prefix=${_prefix} --sysconfdir=/etc \
--infodir=$XBPS_DESTDIR/$pkgname-$version/usr/share/info \
--mandir=$XBPS_DESTDIR/$pkgname-$version/usr/share/man \
@ -755,6 +765,9 @@ configure_src_phase()
unset eval ${f%=*}
done
# unset cross compiler vars.
[ -n "$cross_compiler" ] && cross_compile_unsetvars
unset_build_vars
touch -f $XBPS_CONFIGURE_DONE
@ -784,6 +797,12 @@ build_src_phase()
cd $wrksrc || exit 1
# cross compilation vars.
if [ -n "$cross_compiler" ]; then
. $XBPS_HELPERSDIR/cross-compilation.sh
cross_compile_setvars
fi
[ -z "$make_cmd" ] && make_cmd=/usr/bin/make
#
@ -821,6 +840,10 @@ build_src_phase()
-o "$libtool_fixup_la_stage" = "postbuild" ]; then
libtool_fixup_la_files
fi
# unset cross compiler vars.
[ -n "$cross_compiler" ] && cross_compile_unsetvars
unset_build_vars
touch -f $XBPS_BUILD_DONE
@ -848,6 +871,12 @@ install_src_phase()
msg_normal "Running install phase for: $pkgname-$version."
# cross compilation vars.
if [ -n "$cross_compiler" ]; then
. $XBPS_HELPERSDIR/cross-compilation.sh
cross_compile_setvars
fi
if [ "$build_style" = "custom-install" ]; then
run_func do_install
else
@ -859,6 +888,9 @@ install_src_phase()
#
run_func post_install
# unset cross compiler vars.
[ -n "$cross_compiler" ] && cross_compile_unsetvars
msg_normal "Installed $pkgname-$version into $XBPS_DESTDIR."
touch -f $XBPS_INSTALL_DONE