Revert "Remove host tag from path in prebuilt/."
Works on my machine. Looking at the log, I see that the host tag isn't
being included in the python package name. IIRC I saw this in testing
and it went away after I nuked /tmp/ndk-$USER >:(
Going to revert for now and sort it out later.
This reverts commit 6924c7357174e2f647581ad8d86dd3d15549f18f.
Change-Id: Ia051f246b900b509061da62a734e65e3c0a243d9
diff --git a/build/core/init.mk b/build/core/init.mk
index 8130d81..d67160c 100644
--- a/build/core/init.mk
+++ b/build/core/init.mk
@@ -302,7 +302,7 @@
$(call ndk_log,HOST_TAG set to $(HOST_TAG))
# Check for NDK-specific versions of our host tools
-HOST_PREBUILT_ROOT := $(NDK_ROOT)/prebuilt
+HOST_PREBUILT_ROOT := $(NDK_ROOT)/prebuilt/$(HOST_TAG64)
HOST_PREBUILT := $(strip $(wildcard $(HOST_PREBUILT_ROOT)/bin))
HOST_AWK := $(strip $(NDK_HOST_AWK))
HOST_MAKE := $(strip $(NDK_HOST_MAKE))
diff --git a/build/tools/common-build-host-funcs.sh b/build/tools/common-build-host-funcs.sh
index 10515bd..eafe644 100644
--- a/build/tools/common-build-host-funcs.sh
+++ b/build/tools/common-build-host-funcs.sh
@@ -795,6 +795,21 @@
fail_panic
}
+# Return host tag with only translation that windows-x86 -> windows
+#
+# $1: host system tag
+install_dir_from_host_tag ()
+{
+ case $1 in
+ windows-x86)
+ echo "windows"
+ ;;
+ *)
+ echo "$1"
+ ;;
+ esac
+}
+
# Return the build install directory of a given Python version
#
# $1: host system tag
@@ -805,7 +820,7 @@
# python_ndk_install_dir with nothing.
python_build_install_dir ()
{
- echo "$BH_BUILD_DIR/install/prebuilt"
+ echo "$BH_BUILD_DIR/install/prebuilt/$(install_dir_from_host_tag $1)"
}
# Same as python_build_install_dir, but for the final NDK installation
@@ -814,5 +829,5 @@
# $1: host system tag
python_ndk_install_dir ()
{
- echo "prebuilt"
+ echo "prebuilt/$(install_dir_from_host_tag $1)"
}
diff --git a/build/tools/package-release.sh b/build/tools/package-release.sh
index f8912ae..747fc3a 100755
--- a/build/tools/package-release.sh
+++ b/build/tools/package-release.sh
@@ -484,15 +484,15 @@
find "$DSTDIR/toolchains" -name a.out.h | grep include-fixed/ | xargs rm
# Remove redundant pretty-printers/libstdcxx
- rm -rf $DSTDIR/prebuilt/share/pretty-printers/libstdcxx/gcc-l*
- rm -rf $DSTDIR/prebuilt/share/pretty-printers/libstdcxx/gcc-4.9-*
+ rm -rf $DSTDIR/prebuilt/*/share/pretty-printers/libstdcxx/gcc-l*
+ rm -rf $DSTDIR/prebuilt/*/share/pretty-printers/libstdcxx/gcc-4.9-*
# Remove python tests
- find $DSTDIR/prebuilt/lib/python* -name test -exec rm -rf {} \;
+ find $DSTDIR/prebuilt/*/lib/python* -name test -exec rm -rf {} \;
# Remove python *.pyc and *.pyo files
- find $DSTDIR/prebuilt/lib/python* -name "*.pyc" -exec rm -rf {} \;
- find $DSTDIR/prebuilt/lib/python* -name "*.pyo" -exec rm -rf {} \;
+ find $DSTDIR/prebuilt/*/lib/python* -name "*.pyc" -exec rm -rf {} \;
+ find $DSTDIR/prebuilt/*/lib/python* -name "*.pyo" -exec rm -rf {} \;
# Remove .git*
find $DSTDIR -name ".git*" -exec rm -rf {} \;
diff --git a/build/tools/prebuilt-common.sh b/build/tools/prebuilt-common.sh
index 69c5c98..ef6c03c 100644
--- a/build/tools/prebuilt-common.sh
+++ b/build/tools/prebuilt-common.sh
@@ -1424,22 +1424,27 @@
# Return the relative install prefix for prebuilt host
# executables (relative to the NDK top directory).
+# NOTE: This deals with MINGW==yes or DARWIN==yes appropriately
#
+# $1: optional, system name
# Out: relative path to prebuilt install prefix
get_prebuilt_install_prefix ()
{
- echo "prebuilt"
+ local TAG=${1:-$(get_prebuilt_host_tag)}
+ echo "prebuilt/$TAG"
}
# Return the relative path of an installed prebuilt host
-# executable.
+# executable
+# NOTE: This deals with MINGW==yes or DARWIN==yes appropriately.
#
# $1: executable name
+# $2: optional, host system name
# Out: path to prebuilt host executable, relative
get_prebuilt_host_exec ()
{
local PREFIX EXE
- PREFIX=$(get_prebuilt_install_prefix)
+ PREFIX=$(get_prebuilt_install_prefix $2)
EXE=$(get_prebuilt_host_exe_ext)
echo "$PREFIX/bin/$1$EXE"
}
diff --git a/find-win-host.cmd b/find-win-host.cmd
new file mode 100755
index 0000000..83fa7a0
--- /dev/null
+++ b/find-win-host.cmd
@@ -0,0 +1,31 @@
+@echo off
+rem This is a Windows cmd.exe script used to find windows host name.
+rem %1 is the env. var to set to the windows host name.
+
+setlocal
+set NDK_ROOT=%~dp0
+
+rem Check if %NDK_ROOT% contains any spaces
+goto :L
+:FOO
+ if "%2"=="" goto:EOF
+ echo ERROR: NDK path cannot contain any spaces!
+ exit /b 1
+
+:L
+call :FOO %NDK_ROOT%
+if ERRORLEVEL 1 exit /b 1
+
+set TEMP=windows-x86_64
+
+rem Check if NDK_HOST_32BIT is not set to 1/true, Windows is 64-bit, and 64-bit make exists
+if not exist "%NDK_ROOT%prebuilt\%TEMP%" set TEMP=
+if "%ProgramW6432%"=="" if "%ProgramFiles(x86)%"=="" set TEMP=
+
+rem Otherwise fall back to 32-bit make
+if "%TEMP%"=="" set TEMP=windows
+
+rem Uses "endlocal &&" hack to allow env. vars to survive setlocal/endlocal
+endlocal && set "%1=%TEMP%"
+
+exit /b 0
diff --git a/ndk-build.cmd b/ndk-build.cmd
index 788a42d..9812279 100755
--- a/ndk-build.cmd
+++ b/ndk-build.cmd
@@ -1,3 +1,6 @@
@echo off
+rem This is a Windows cmd.exe script used to invoke the NDK-specific GNU Make executable
+call "%~dp0find-win-host.cmd" NDK_WIN_HOST
+if ERRORLEVEL 1 (exit /b 1)
set NDK_ROOT=%~dp0
-"%NDK_ROOT%prebuilt/bin/make.exe" -f "%NDK_ROOT%build/core/build-local.mk" SHELL=cmd %*
+"%NDK_ROOT%prebuilt/%NDK_WIN_HOST%/bin/make.exe" -f "%NDK_ROOT%build/core/build-local.mk" SHELL=cmd %*
diff --git a/ndk-gdb-py.cmd b/ndk-gdb-py.cmd
index 4c5d851..265ca55 100755
--- a/ndk-gdb-py.cmd
+++ b/ndk-gdb-py.cmd
@@ -1,6 +1,9 @@
@echo off
+rem This is a Windows cmd.exe script used to invoke the NDK-specific Python executable
+call "%~dp0find-win-host.cmd" NDK_WIN_HOST
+if ERRORLEVEL 1 (exit /b 1)
setlocal
set NDK_ROOT=%~dp0
set SHELL=cmd
-"%NDK_ROOT%prebuilt/bin/python.exe" -u "%~dp0ndk-gdb.py" %*
+"%NDK_ROOT%prebuilt/%NDK_WIN_HOST%/bin/python.exe" -u "%~dp0ndk-gdb.py" %*
endlocal