summaryrefslogtreecommitdiff
path: root/src/third_party/scripts
diff options
context:
space:
mode:
authorHenrik Edin <henrik.edin@mongodb.com>2018-12-06 13:38:31 -0500
committerHenrik Edin <henrik.edin@mongodb.com>2018-12-18 10:17:49 -0500
commitb4df4609aa6951c503b2729f4e35d4a4d737cb0b (patch)
tree4b070ebab3f10e6fab4a5a5769d983b3cdc27523 /src/third_party/scripts
parent97fb988efa341f0a3e7bb9e250776352b4344c74 (diff)
downloadmongo-b4df4609aa6951c503b2729f4e35d4a4d737cb0b.tar.gz
SERVER-37994 Upgrade google benchmark to v1.4.1
Diffstat (limited to 'src/third_party/scripts')
-rwxr-xr-xsrc/third_party/scripts/benchmark_get_sources.sh39
1 files changed, 30 insertions, 9 deletions
diff --git a/src/third_party/scripts/benchmark_get_sources.sh b/src/third_party/scripts/benchmark_get_sources.sh
index 6a3ef4e73d5..c185669e979 100755
--- a/src/third_party/scripts/benchmark_get_sources.sh
+++ b/src/third_party/scripts/benchmark_get_sources.sh
@@ -1,6 +1,6 @@
#!/bin/bash
# This script downloads and imports Google Benchmark.
-# It can be run on Linux or Mac OS X.
+# It can be run on Linux, Mac OS X or Windows WSL.
# Actual integration into the build system is not done by this script.
#
# Turn on strict error checking, like perl use 'strict'
@@ -12,20 +12,41 @@ if [ "$#" -ne 0 ]; then
exit 1
fi
-VERSION=1.3.0
+GIT_EXE=git
+if grep -q Microsoft /proc/version; then
+ GIT_EXE=git.exe
+fi
+
NAME=benchmark
-SRC_ROOT=$(mktemp -d /tmp/benchmark.XXXXXX)
-#trap "rm -rf $SRC_ROOT" EXIT
+VERSION=1.4.1
+if grep -q Microsoft /proc/version; then
+ SRC_ROOT=$(wslpath -u $(powershell.exe -Command "Get-ChildItem Env:TEMP | Get-Content | Write-Host"))
+ SRC_ROOT+="$(mktemp -u /benchmark.XXXXXX)"
+ mkdir -p $SRC_ROOT
+else
+ SRC_ROOT=$(mktemp -d /tmp/benchmark.XXXXXX)
+fi
+
SRC=${SRC_ROOT}/${NAME}-${VERSION}
-DEST_DIR=$(git rev-parse --show-toplevel)/src/third_party/$NAME-$VERSION
-PATCH_DIR=$(git rev-parse --show-toplevel)/src/third_party/$NAME-$VERSION/patches
+CLONE_DEST=$SRC
+if grep -q Microsoft /proc/version; then
+ CLONE_DEST=$(wslpath -m $SRC)
+fi
+DEST_DIR=$($GIT_EXE rev-parse --show-toplevel)/src/third_party/$NAME-$VERSION
+PATCH_DIR=$($GIT_EXE rev-parse --show-toplevel)/src/third_party/$NAME-$VERSION/patches
+if grep -q Microsoft /proc/version; then
+ DEST_DIR=$(wslpath -u "$DEST_DIR")
+ PATCH_DIR=$(wslpath -w $(wslpath -u "$PATCH_DIR"))
+fi
+
+echo "dest: $DEST_DIR"
+echo "patch: $PATCH_DIR"
if [ ! -d $SRC ]; then
- git clone git@github.com:google/benchmark.git $SRC
+ $GIT_EXE clone git@github.com:google/benchmark.git $CLONE_DEST
pushd $SRC
- git checkout v$VERSION
- git am $PATCH_DIR/*.patch
+ $GIT_EXE checkout v$VERSION
popd
fi