From 7e8d7b381d4282cfb4c998f93dd03666a68e7fd1 Mon Sep 17 00:00:00 2001 From: Miro Knejp Date: Sat, 20 Apr 2019 02:24:05 +0200 Subject: [PATCH] Run bootstrap-vcpkg.bat when bootstrapped from git-bash (#6142) * Bootstrap for windows when called from within bash for windows When calling `bootstrap-vcpkg.sh` from within a git-bash script it fails with the error message `Unknown uname: MINGW64_NT-10.0`. This change delegates bootstrapping to `bootstrap-vcpkg.bat` by executing it in a `cmd` session when the result of `uname -s` matches the pattern `MINGW*_NT*`. * [vcpkg-bootstrap] Avoid using bash extensions and keep ./bootstrap-vcpkg.sh as a simple forwarder. --- scripts/bootstrap.sh | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index f0bfb9839..99d8dab68 100644 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -1,5 +1,20 @@ #!/bin/sh +# Find .vcpkg-root, which indicates the root of this repo +vcpkgRootDir=$(X= cd -- "$(dirname -- "$0")" && pwd -P) +while [ "$vcpkgRootDir" != "/" ] && ! [ -e "$vcpkgRootDir/.vcpkg-root" ]; do + vcpkgRootDir="$(dirname "$vcpkgRootDir")" +done + +# Enable using this entry point on windows from git bash by redirecting to the .bat file. +unixName=$(uname -s | sed 's/MINGW.*_NT.*/MINGW_NT/') +if [ "$unixName" = "MINGW_NT" ]; then + vcpkgRootDir=$(cygpath -aw "$vcpkgRootDir") + cmd "/C $vcpkgRootDir\\bootstrap-vcpkg.bat" || exit 1 + exit 0 +fi + +# Argument parsing vcpkgDisableMetrics="OFF" vcpkgUseSystem=false vcpkgAllowAppleClang=OFF @@ -26,12 +41,6 @@ do fi done -# Find vcpkg-root -vcpkgRootDir=$(X= cd -- "$(dirname -- "$0")" && pwd -P) -while [ "$vcpkgRootDir" != "/" ] && ! [ -e "$vcpkgRootDir/.vcpkg-root" ]; do - vcpkgRootDir="$(dirname "$vcpkgRootDir")" -done - if [ -z ${VCPKG_DOWNLOADS+x} ]; then downloadsDir="$vcpkgRootDir/downloads" else