diff options
author | Ryan Prichard <rprichard@google.com> | 2018-01-22 22:22:56 -0800 |
---|---|---|
committer | Ryan Prichard <rprichard@google.com> | 2018-01-24 04:23:22 -0800 |
commit | 11115c6ec648166d47a668cf22917919c3657931 (patch) | |
tree | 0a16d5f160f84f085785a58bb1312c247e052156 | |
parent | abb7ca311e02aa6db74c7303ed5400295a8d1e6b (diff) | |
download | ndk-11115c6ec648166d47a668cf22917919c3657931.tar.gz |
mingw-w64: harmonize triples, use prebuilt MinGW in BH
* BH: Prefer to use the MinGW prebuilt compiler in the Android source
tree.
* BH: Remove code that searches for a MinGW that predates mingw-w64.
* BH: Remove the unusual BH_HOST=amd64-pc-mingw32msvc assignment. The
remaining BH_HOST=x86_64-w64-mingw32 appears to be setting the wrong
variable; BH_HOST_CONFIG is already set to x86_64-w64-mingw32.
* BH: I don't think I've seen a MinGW config where the 64-bit toolchain
was accessed by passing -m64 to the 32-bit driver, so remove that bit.
If we're searching for MinGW in the PATH, prefer the 32-bit driver.
I have seen newer versions of MinGW where passing -m32 to the 64-bit
driver doesn't work. (Missing libraries, IIRC.)
* Replace i586-pc-mingw32 and i586-pc-mingw32msvc with i686-w64-mingw32.
Test: ./checkbuild.py --system=windows
Test: ./checkbuild.py --system=windows64
Change-Id: Ia05f0af3b08d6b34365caffcc3eec7a7b90cc595
-rw-r--r-- | build/tools/common-build-host-funcs.sh | 57 | ||||
-rwxr-xr-x | sources/host-tools/make-3.81/build-make.sh | 2 |
2 files changed, 18 insertions, 41 deletions
diff --git a/build/tools/common-build-host-funcs.sh b/build/tools/common-build-host-funcs.sh index 68bc17f38..65923e88d 100644 --- a/build/tools/common-build-host-funcs.sh +++ b/build/tools/common-build-host-funcs.sh @@ -125,7 +125,7 @@ bh_tag_to_config_triplet () linux-x86_64) RET=x86_64-linux-gnu;; darwin-x86) RET=i686-apple-darwin;; darwin-x86_64) RET=x86_64-apple-darwin;; - windows|windows-x86) RET=i586-pc-mingw32msvc;; + windows|windows-x86) RET=i686-w64-mingw32;; windows-x86_64) RET=x86_64-w64-mingw32;; android-arm) RET=arm-linux-androideabi;; android-arm64) RET=aarch64-linux-android;; @@ -407,6 +407,7 @@ EOF # where $BH_HOST_CONFIG is a GNU configuration name. # # Important: this script might redefine $BH_HOST_CONFIG to a different value! +# (This behavior previously happened with MinGW, but doesn't anymore.) # # $1: NDK system tag (e.g. linux-x86) # @@ -519,42 +520,31 @@ _bh_select_toolchain_for_host () windows|windows-x86) case $BH_BUILD_OS in linux) + # Prefer the prebuilt cross-compiler. + _bh_try_host_fullprefix "$(dirname $ANDROID_NDK_ROOT)/prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8" x86_64-w64-mingw32 -m32 # We favor these because they are more recent, and because # we have a script to rebuild them from scratch. See - # build-mingw64-toolchain.sh. - _bh_try_host_prefix x86_64-w64-mingw32 -m32 + # build-mingw64-toolchain.sh. Typically provided by the + # 'mingw-w64' package on Debian and Ubuntu systems. _bh_try_host_prefix i686-w64-mingw32 - # Typically provided by the 'mingw32' package on Debian - # and Ubuntu systems. - _bh_try_host_prefix i586-mingw32msvc + _bh_try_host_prefix x86_64-w64-mingw32 -m32 # Special note for Fedora: this distribution used # to have a mingw32-gcc package that provided a 32-bit # only cross-toolchain named i686-pc-mingw32. # Later versions of the distro now provide a new package # named mingw-gcc which provides i686-w64-mingw32 and # x86_64-w64-mingw32 instead. - _bh_try_host_prefix i686-pc-mingw32 if [ -z "$HOST_FULLPREFIX" ]; then dump "There is no Windows cross-compiler. Ensure that you" dump "have one of these installed and in your path:" - dump " x86_64-w64-mingw32-gcc (see build-mingw64-toolchain.sh)" dump " i686-w64-mingw32-gcc (see build-mingw64-toolchain.sh)" - dump " i586-mingw32msvc-gcc ('mingw32' Debian/Ubuntu package)" - dump " i686-pc-mingw32 (on Fedora)" + dump " x86_64-w64-mingw32-gcc (see build-mingw64-toolchain.sh)" dump "" exit 1 fi - # Adjust $HOST to match the toolchain to ensure proper builds. - # I.e. chose configuration triplets that are known to work - # with the gmp/mpfr/mpc/binutils/gcc configure scripts. - case $HOST_FULLPREFIX in - *-mingw32msvc-*|i686-pc-mingw32) - BH_HOST_CONFIG=i586-pc-mingw32msvc - ;; - *) - BH_HOST_CONFIG=i686-w64-mingw32msvc - ;; - esac + if [ "$BH_HOST_CONFIG" != i686-w64-mingw32 ]; then + panic "Unexpected value of BH_HOST_CONFIG: $BH_HOST_CONFIG" + fi ;; *) panic "Sorry, this script only supports building windows binaries on Linux." ;; @@ -566,33 +556,20 @@ _bh_select_toolchain_for_host () windows-x86_64) case $BH_BUILD_OS in linux) - # See comments above for windows-x86 + # Prefer the prebuilt cross-compiler. + # See comments above for windows-x86. + _bh_try_host_fullprefix "$(dirname $ANDROID_NDK_ROOT)/prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8" x86_64-w64-mingw32 _bh_try_host_prefix x86_64-w64-mingw32 - _bh_try_host_prefix i686-w64-mingw32 -m64 - # Beware that this package is completely broken on many - # versions of no vinegar Ubuntu (i.e. it fails at building trivial - # programs). - _bh_try_host_prefix amd64-mingw32msvc - # There is no x86_64-pc-mingw32 toolchain on Fedora. if [ -z "$HOST_FULLPREFIX" ]; then dump "There is no Windows cross-compiler in your path. Ensure you" dump "have one of these installed and in your path:" dump " x86_64-w64-mingw32-gcc (see build-mingw64-toolchain.sh)" - dump " i686-w64-mingw32-gcc (see build-mingw64-toolchain.sh)" - dump " amd64-mingw32msvc-gcc (Debian/Ubuntu - broken until Ubuntu 11.10)" dump "" exit 1 fi - # See comment above for windows-x86 - case $HOST_FULLPREFIX in - *-mingw32msvc*) - # Actually, this has never been tested. - BH_HOST=amd64-pc-mingw32msvc - ;; - *) - BH_HOST=x86_64-w64-mingw32 - ;; - esac + if [ "$BH_HOST_CONFIG" != x86_64-w64-mingw32 ]; then + panic "Unexpected value of BH_HOST_CONFIG: $BH_HOST_CONFIG" + fi ;; *) panic "Sorry, this script only supports building windows binaries on Linux." diff --git a/sources/host-tools/make-3.81/build-make.sh b/sources/host-tools/make-3.81/build-make.sh index edee4a5fd..12c8dd415 100755 --- a/sources/host-tools/make-3.81/build-make.sh +++ b/sources/host-tools/make-3.81/build-make.sh @@ -79,7 +79,7 @@ BUILD_DIR=$BUILD_DIR/build CONFIGURE_FLAGS="--disable-nls --disable-rpath" if [ "$MINGW" = "yes" ]; then # Required for a proper mingw cross compile - CONFIGURE_FLAGS=$CONFIGURE_FLAGS" --host=i586-pc-mingw32" + CONFIGURE_FLAGS=$CONFIGURE_FLAGS" --host=i686-w64-mingw32" fi if [ "$DARWIN" = "yes" ]; then |