@@ -19,14 +19,14 @@ PATCHSCRIPTDIR="$(pwd)/patchscripts" PATCHDIR="$(pwd)/patches" export SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHSCRIPTDIR PATCHDIR # Set configure options for this sub-project -LDFLAGS="${KC_TCL_LDFLAGS}" -CFLAGS="${KC_TCL_CFLAGS}" -CPPFLAGS="${KC_TCL_CPPFLAGS}" -LIBS="${KC_TCL_LIBS}" +LDFLAGS="${LDFLAGS} ${KC_TCL_LDFLAGS}" +CFLAGS="${CFLAGS} ${KC_TCL_CFLAGS}" +CPPFLAGS="${CPPFLAGS} ${KC_TCL_CPPFLAGS}" +LIBS="${LIBS} ${KC_TCL_LIBS}" export LDFLAGS CFLAGS CPPFLAGS LIBS rm -rf 'build' 'out' 'inst' mkdir 'build' 'out' 'inst' || exit 1 @@ -199,14 +199,27 @@ ) fi done tryfirstdir='' - if [ "$(uname -s)" = "Darwin" ]; then - tryfirstdir='macosx' - fi - + case "${KC_CROSSCOMPILE_HOST_OS}" in + *-*-darwin*) + # Cross-compiling for Mac OS X -- try to build macosx directory first + tryfirstdir='macosx' + ;; + *-*-*) + # Cross-compiling, do not assume based on build platform + ;; + '') + # Not cross-compiling, assume based on build platform + if [ "$(uname -s)" = "Darwin" ]; then + # Compiling for Mac OS X, build in that directory first + tryfirstdir='macosx' + fi + ;; + esac + for dir in "${tryfirstdir}" unix win macosx __fail__; do if [ -z "${dir}" ]; then continue fi @@ -217,10 +230,11 @@ fi # Remove previous directory's "tclConfig.sh" if found rm -f 'tclConfig.sh' + echo "Working in: $dir" cd "${BUILDDIR}/${dir}" || exit 1 # Remove broken pre-generated Makfiles rm -f GNUmakefile Makefile makefile