summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2018-08-30 21:38:50 +0300
committerKonstantin Käfer <mail@kkaefer.com>2018-09-05 12:26:15 +0200
commit0e95e8f6b241ee8b30635a986f2c503f21997dd7 (patch)
tree6c79f34ed7a6a5fd06bb3e74ec5a3eb62bd16d72 /scripts
parentc62fabf532aa183d20180cf7e0ff8b471b99b9d6 (diff)
downloadqtlocation-mapboxgl-0e95e8f6b241ee8b30635a986f2c503f21997dd7.tar.gz
[build] add ability to extract zip files
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/vendor/common.sh19
-rwxr-xr-xscripts/vendor/expected.sh2
-rwxr-xr-xscripts/vendor/gtest.sh2
-rwxr-xr-xscripts/vendor/nunicode.sh2
4 files changed, 16 insertions, 9 deletions
diff --git a/scripts/vendor/common.sh b/scripts/vendor/common.sh
index 680211bfcc..c0c7ebf8ea 100755
--- a/scripts/vendor/common.sh
+++ b/scripts/vendor/common.sh
@@ -6,11 +6,11 @@ CXX=${CXX:-clang++}
CC=${CC:-clang}
function download {
- if [ ! -f "$VENDOR/.cache/$NAME-$VERSION.tar.gz" ]; then
+ if [ ! -f "$VENDOR/.cache/$NAME-$VERSION" ]; then
echo ">> Downloading $1..."
mkdir -p "$VENDOR/.cache"
- curl --retry 3 -f -S -L $1 -o "$VENDOR/.cache/$NAME-$VERSION.tar.gz.tmp"
- mv "$VENDOR/.cache/$NAME-$VERSION.tar.gz.tmp" "$VENDOR/.cache/$NAME-$VERSION.tar.gz"
+ curl --retry 3 -f -S -L $1 -o "$VENDOR/.cache/$NAME-$VERSION.tmp"
+ mv "$VENDOR/.cache/$NAME-$VERSION.tmp" "$VENDOR/.cache/$NAME-$VERSION"
fi
}
@@ -21,10 +21,17 @@ function init {
cd "$VENDOR/$NAME"
}
-function extract {
- echo ">> Unpacking files from $VENDOR/.cache/$NAME-$VERSION.tar.gz..."
+function extract_gzip {
+ echo ">> Unpacking files from $VENDOR/.cache/$NAME-$VERSION..."
[ ! -z "$(tar --version | grep "GNU tar")" ] && WC="--wildcards" || WC=""
- tar xzf "$VENDOR/.cache/$NAME-$VERSION.tar.gz" $WC --strip-components=${STRIP_COMPONENTS:-1} -C "$VENDOR/$NAME" $@
+ tar xzf "$VENDOR/.cache/$NAME-$VERSION" $WC --strip-components=${STRIP_COMPONENTS:-1} -C "$VENDOR/$NAME" $@
+}
+
+function extract_zip {
+ echo ">> Unpacking files from $VENDOR/.cache/$NAME-$VERSION..."
+ unzip -qq "$VENDOR/.cache/$NAME-$VERSION" $@ -d "$VENDOR/.cache/staging"
+ mv "$VENDOR/.cache/staging"/*/* "$VENDOR/$NAME"
+ rm -rf "$VENDOR/.cache/staging"
}
function file_list {
diff --git a/scripts/vendor/expected.sh b/scripts/vendor/expected.sh
index 58c98902f6..66951a115b 100755
--- a/scripts/vendor/expected.sh
+++ b/scripts/vendor/expected.sh
@@ -7,7 +7,7 @@ ROOT=expected-lite-$VERSION
download "https://github.com/martinmoene/expected-lite/archive/$VERSION.tar.gz"
init
-extract "$ROOT/include" "$ROOT/LICENSE.txt"
+extract_gzip "$ROOT/include" "$ROOT/LICENSE.txt"
mv include/nonstd/expected.hpp include
rm -rf include/nonstd
file_list include -name "*.hpp"
diff --git a/scripts/vendor/gtest.sh b/scripts/vendor/gtest.sh
index 3bae5266fb..8b9aa67cef 100755
--- a/scripts/vendor/gtest.sh
+++ b/scripts/vendor/gtest.sh
@@ -7,7 +7,7 @@ ROOT=googletest-release-1.8.0/googletest
download "https://github.com/google/googletest/archive/release-$VERSION.tar.gz"
init
-STRIP_COMPONENTS=2 extract --exclude "gtest-all.cc" --exclude "gtest_main.cc" "$ROOT/include/*.h" "$ROOT/src" "$ROOT/LICENSE"
+STRIP_COMPONENTS=2 extract_gzip --exclude "gtest-all.cc" --exclude "gtest_main.cc" "$ROOT/include/*.h" "$ROOT/src" "$ROOT/LICENSE"
for FILE in $(find include src -name "*.h" -o -name "*.cc"); do
sed -e 's/^#include \"src\/\([^\"]\{1,\}\)\"/#include "\1"/' \
diff --git a/scripts/vendor/nunicode.sh b/scripts/vendor/nunicode.sh
index 61a921cadd..79f1c83a3c 100755
--- a/scripts/vendor/nunicode.sh
+++ b/scripts/vendor/nunicode.sh
@@ -7,7 +7,7 @@ ROOT=alekseyt-nunicode-246bb27014ab
download "https://bitbucket.org/alekseyt/nunicode/get/$VERSION.tar.gz"
init
-extract "$ROOT/libnu/*.c" "$ROOT/libnu/*.h" "$ROOT/LICENSE"
+extract_gzip "$ROOT/libnu/*.c" "$ROOT/libnu/*.h" "$ROOT/LICENSE"
# Augment config.h with just the defines we need.
head -n 2 libnu/config.h > config.h