Index: kitcreator ================================================================== --- kitcreator +++ kitcreator @@ -62,10 +62,29 @@ if echo " ${CONFIGUREEXTRA} " | grep ' --enable-threads' >/dev/null 2>/dev/null; then KITCREATOR_PKGS="${KITCREATOR_PKGS} thread" fi +# Determine cross-compile status +host_os="$(echo " ${CONFIGUREEXTRA} " sed 's@^.* --host=\([^ ]*\) .*$@\1@ +t x +d +:x')" +build_os="$(echo " ${CONFIGUREEXTRA} " sed 's@^.* --build=\([^ ]*\) .*$@\1@ +t x +d +:x')" + +if [ "${host_os}" != "${build_os}" -a -n "${host_os}" ]; then + KC_CROSSCOMPILE='1' + KC_CROSSCOMPILE_HOST_OS="${host_os}" +else + KC_CROSSCOMPILE='0' + KC_CROSSCOMPILE_HOST_OS='' +fi +export KC_CROSSCOMPILE KC_CROSSCOMPILE_HOST_OS + # Set default target KITTARGET="kitsh" export KITTARGET # Fix up package list Index: tcl/build.sh ================================================================== --- tcl/build.sh +++ tcl/build.sh @@ -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 Index: tcl/patchscripts/fix-crosscompile.sh ================================================================== --- tcl/patchscripts/fix-crosscompile.sh +++ tcl/patchscripts/fix-crosscompile.sh @@ -1,14 +1,10 @@ #! /bin/bash -case "${CC}" in - *-*-*) - ;; - *) - exit 0 - ;; -esac +if [ "${KC_CROSSCOMPILE}" != '1' ]; then + exit 0 +fi mkdir fake-bin cat << \_EOF_ > fake-bin/fake-uname #! /bin/bash @@ -17,19 +13,11 @@ echo "true" exit 0 fi -case "${CC}" in - *-*-*) - ;; - *) - CC='' - ;; -esac - -if [ -z "${CC}" ]; then +if [ -z "${KC_CROSSCOMPILE_HOST_OS}" ]; then # If not cross compiling, revert to system uname while [ "$(uname --fake 2>/dev/null)" == "true" -a -n "${PATH}" ]; do PATH="$(echo "${PATH}" | sed 's@^[^:]*$@@;s@^[^:]*:@@')" export PATH @@ -40,42 +28,40 @@ fi exec uname "$@" fi -CROSS="$(echo "${CC}" | sed -r 's@-[^-]*($| .*$)@@')" - # Determine release information -case "${CROSS}" in +case "${KC_CROSSCOMPILE_HOST_OS}" in *-hpux11*) sysname="HP-UX" - sysrelease="$(echo "${CROSS}" | sed 's@^.*-hpux@@')" + sysrelease="$(echo "${KC_CROSSCOMPILE_HOST_OS}" | sed 's@^.*-hpux@@')" ;; *-solaris2*) sysname="SunOS" - sysrelease="$(echo "${CROSS}" | sed 's@^.*-solaris@@;s@^2@5@')" + sysrelease="$(echo "${KC_CROSSCOMPILE_HOST_OS}" | sed 's@^.*-solaris@@;s@^2@5@')" ;; *-linux*) sysname="Linux" sysrelease="2.6.5" ;; *-netbsd*) sysname="NetBSD" - sysrelease="$(echo "${CROSS}" | sed 's@^.*-netbsd@@;s@$@.0@')" + sysrelease="$(echo "${KC_CROSSCOMPILE_HOST_OS}" | sed 's@^.*-netbsd@@;s@$@.0@')" ;; *-freebsd*) sysname="FreeBSD" - sysrelease="$(echo "${CROSS}" | sed 's@^.*-freebsd@@;s@$@.0-RELEASE@')" + sysrelease="$(echo "${KC_CROSSCOMPILE_HOST_OS}" | sed 's@^.*-freebsd@@;s@$@.0-RELEASE@')" ;; *-aix[0-9].*) sysname="AIX" - sysrelease="$(echo "${CROSS}" | sed 's@.*-aix\([0-9]\..*\)@\1@')" + sysrelease="$(echo "${KC_CROSSCOMPILE_HOST_OS}" | sed 's@.*-aix\([0-9]\..*\)@\1@')" ;; esac # Determine machine information -case "${CROSS}" in +case "${KC_CROSSCOMPILE_HOST_OS}" in hppa64-*-hpux*) sysmachine="9000/859" ;; i386-*-solaris*) sysmachine="i86pc"