summaryrefslogtreecommitdiff
path: root/src/third_party/scripts
diff options
context:
space:
mode:
authorMathew Robinson <chasinglogic@gmail.com>2018-12-07 14:15:08 -0500
committerMathew Robinson <chasinglogic@gmail.com>2019-01-14 14:15:42 -0500
commitcf6e22331a81dac4e3c3800c9b94c0df1b439737 (patch)
tree7aec86eb3f619626266825d5ab55f524414e6f37 /src/third_party/scripts
parent5e1371451b2c2053bfad271cbd8618bb4e209632 (diff)
downloadmongo-cf6e22331a81dac4e3c3800c9b94c0df1b439737.tar.gz
SERVER-28073 Upgrade Snappy to version 1.1.7
Diffstat (limited to 'src/third_party/scripts')
-rw-r--r--src/third_party/scripts/snappy_get_sources.sh86
1 files changed, 62 insertions, 24 deletions
diff --git a/src/third_party/scripts/snappy_get_sources.sh b/src/third_party/scripts/snappy_get_sources.sh
index c3ff32b452b..21a3703cf6a 100644
--- a/src/third_party/scripts/snappy_get_sources.sh
+++ b/src/third_party/scripts/snappy_get_sources.sh
@@ -3,14 +3,34 @@ set -o verbose
set -o errexit
# This script fetches and creates a copy of sources for snappy
-# snappy uses autotools on posix, and nothing on Windows
-# Snappy has the same config.h file on Darwin and Solaris, Linux is unique
-# The difference is byteswap.h
+# snappy uses CMake and this script will invoke CMake to generate a
+# config.h for "posix", Linux, and Windows
+#
# To get the sources for Snappy, run this script as follows:
-# 1. Run on Darwin or Solaris
+#
+# 1. Run on Darwin
# 2. Run on Linux
+# 3. Run on s390x Linux
+# 4. Run on Windows via Cygwin
+#
+# For s390x CMake is already installed on the ZAP dev machines, you'll
+# need to add it to the $PATH before running this script with:
+#
+# export PATH="/opt/cmake/bin:$PATH"
+#
+# For Windows you will need CMake installed. If using an
+# Evergreen spawn host it is not installed by default but, you can
+# easily install it with the following command. (this works in
+# cygwin):
+#
+# choco install cmake
+#
+# You will also need to add it to the $PATH with the following:
+#
+# export PATH="/cygdrive/c/Program Files/CMake/bin/:$PATH"
-VERSION=1.1.3
+
+VERSION=1.1.7
NAME=snappy
TARBALL=$NAME-$VERSION.tar.gz
TARBALL_DIR=$NAME-$VERSION
@@ -19,8 +39,12 @@ TEMP_DIR=/tmp/temp-$NAME-$VERSION
DEST_DIR=`git rev-parse --show-toplevel`/src/third_party/$NAME-$VERSION
UNAME=`uname | tr A-Z a-z`
-if [ $UNAME == "linux" ]; then
+if [ "$UNAME" == "linux" && "$(uname -m)" == "s390x" ]; then
+ TARGET_UNAME=linux_s390x
+elif [ "$UNAME" == "linux" ]
TARGET_UNAME=linux
+elif [[ "$UNAME" == "cygwin"* ]]; then
+ TARGET_UNAME=windows
else
TARGET_UNAME=posix
fi
@@ -29,7 +53,7 @@ echo TARGET_UNAME: $TARGET_UNAME
if [ ! -f $TARBALL ]; then
echo "Get tarball"
- wget https://github.com/google/$NAME/releases/download/$VERSION/$NAME-$VERSION.tar.gz
+ curl -L -o $NAME-$VERSION.tar.gz https://github.com/google/$NAME/archive/$VERSION.tar.gz
fi
echo $TARBALL
@@ -40,23 +64,37 @@ mv $TARBALL_DIR $TEMP_DIR
mkdir $DEST_DIR || true
cd $TEMP_DIR
-if [ $TARGET_UNAME != "windows" ]; then
- # Do a shallow copy, it is all we need
- cp $TEMP_DIR/* $DEST_DIR || true
- rm -f $DEST_DIR/Makefile* $DEST_DIR/config* $DEST_DIR/*sh
- rm -f $DEST_DIR/compile* $DEST_DIR/depcomp $DEST_DIR/libtool
- rm -f $DEST_DIR/test-driver $DEST_DIR/*.m4 $DEST_DIR/missing
-
- echo "Generating Config.h and other files"
- ./configure
-
- # Copy over the platform independent generated files
- cp $TEMP_DIR/snappy-stubs-public.h $DEST_DIR
-
- # Copy over config.h
- mkdir $DEST_DIR/build_$TARGET_UNAME
- cp $TEMP_DIR/config.h $DEST_DIR/build_$TARGET_UNAME
-fi
+cp $TEMP_DIR/* $DEST_DIR || true
+rm -f $DEST_DIR/Makefile* $DEST_DIR/config* $DEST_DIR/*sh
+rm -f $DEST_DIR/compile* $DEST_DIR/depcomp $DEST_DIR/libtool
+rm -f $DEST_DIR/test-driver $DEST_DIR/*.m4 $DEST_DIR/missing
+
+echo "Generating Config.h and other files"
+cmake $TEMP_DIR
+
+# Copy over the platform independent generated files
+cp $TEMP_DIR/snappy-stubs-public.h $DEST_DIR
+# Copy over config.h
+mkdir $DEST_DIR/build_$TARGET_UNAME
+cp $TEMP_DIR/config.h $DEST_DIR/build_$TARGET_UNAME
+
+# Change the snappy-stubs-public.h to use the defined variables
+# instead of hardcoded values generated by CMake
+#
+# Changes lines like:
+#
+# #if !0 // !HAVE_SYS_UIO_H
+# #if 1 // HAVE_STDINT_H
+#
+# To:
+#
+# #if !HAVE_SYS_UIO_H
+# #if HAVE_STDINT_H
+if [ "$TARGET_UNAME" = "posix" ]; then
+ sed -i '' 's/if !\{0,1\}[0-9] \/\/ \(!\{0,1\}HAVE_.*\)/if \1/' snappy-stubs-public.h
+else
+ sed -i 's/if !\{0,1\}[0-9] \/\/ \(!\{0,1\}HAVE_.*\)/if \1/' snappy-stubs-public.h
+fi
echo "Done"