From 4746def4a207eb6eea58e8f39d434f46340cc293 Mon Sep 17 00:00:00 2001 From: David Michael Date: Sat, 23 Feb 2019 10:36:23 -0500 Subject: [PATCH] Implement a pseudo-toolset for cross-compiling (#196) When running build.sh with the cross-cc toolset, it uses the native compiler settings found in the BUILD_CC, BUILD_CFLAGS, and BUILD_LDFLAGS environment variables to create executables to run on the build system. It then sets the toolset to cc so that the cross-compilers given as CC etc. are propagated to subprocesses. This ensures both that the build system can build and execute its required programs and that final executables are cross-compiled for the target architecture. --- src/engine/build.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/engine/build.sh b/src/engine/build.sh index 7e46e387e..005e4d9ba 100755 --- a/src/engine/build.sh +++ b/src/engine/build.sh @@ -40,6 +40,12 @@ error_exit () echo "### detected. The 'cc' toolset will use the CC, CFLAGS, and LIBS" echo "### environment variables, if present." echo "###" + echo "### Similarly, the cross-cc toolset is available for cross-compiling" + echo "### by using the BUILD_CC, BUILD_CFLAGS, and BUILD_LDFLAGS environment" + echo "### variables to compile binaries that will be executed on the build" + echo "### system. This allows CC etc. to be set for cross-compilers to be" + echo "### propagated to subprocesses." + echo "###" exit 1 } @@ -268,6 +274,15 @@ case $BOOST_JAM_TOOLSET in BOOST_JAM_OPT_YYACC="$BOOST_JAM_OPT_YYACC $CFLAGS $LIBS" ;; + cross-cc) + if test -z "$BUILD_CC" ; then BUILD_CC=cc ; fi + BOOST_JAM_CC=$BUILD_CC + BOOST_JAM_OPT_JAM="$BOOST_JAM_OPT_JAM $BUILD_CFLAGS $BUILD_LDFLAGS" + BOOST_JAM_OPT_MKJAMBASE="$BOOST_JAM_OPT_MKJAMBASE $BUILD_CFLAGS $BUILD_LDFLAGS" + BOOST_JAM_OPT_YYACC="$BOOST_JAM_OPT_YYACC $BUILD_CFLAGS $BUILD_LDFLAGS" + BOOST_JAM_TOOLSET=cc + ;; + qcc) BOOST_JAM_CC=qcc ;;