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.
This commit is contained in:
Miro Knejp 2019-04-20 02:24:05 +02:00 committed by Robert Schumacher
parent 68759e0dfe
commit 7e8d7b381d

View File

@ -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