summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2018-06-26 10:44:59 -0700
committerKonstantin Käfer <mail@kkaefer.com>2018-06-26 10:44:59 -0700
commit168d52a41ea35ae6aa2149d605bef6ba4b17f26d (patch)
treedc8adfa15250e29c17da2f1277c043de20eedf4f
parentbdf2e1f5d4e8dee967b31b08c6c16691caf45243 (diff)
downloadqtlocation-mapboxgl-upstream/vendor-nunicode.tar.gz
[build] add script for vendoring nunicodeupstream/vendor-nunicode
-rw-r--r--scripts/vendor/common.sh30
-rwxr-xr-xscripts/vendor/nunicode.sh15
2 files changed, 45 insertions, 0 deletions
diff --git a/scripts/vendor/common.sh b/scripts/vendor/common.sh
new file mode 100644
index 0000000000..8bcda37c29
--- /dev/null
+++ b/scripts/vendor/common.sh
@@ -0,0 +1,30 @@
+set -eu
+
+VENDOR=$(cd "$(dirname "${BASH_SOURCE[0]}")/../../vendor"; pwd)
+CXX=${CXX:-clang++}
+CC=${CC:-clang}
+
+function download {
+ if [ ! -f "$VENDOR/.cache/$NAME-$VERSION.tar.gz" ]; 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"
+ fi
+}
+
+function init {
+ rm -rf "$VENDOR/$NAME"
+ mkdir -p "$VENDOR/$NAME"
+ echo $VERSION > "$VENDOR/$NAME/version.txt"
+ cd "$VENDOR/$NAME"
+}
+
+function extract {
+ echo ">> Unpacking files..."
+ tar xzf "$VENDOR/.cache/$NAME-$VERSION.tar.gz" --strip-components=${STRIP_COMPONENTS:-1} -C "$VENDOR/$NAME" $@
+}
+
+function file_list {
+ (cd "$VENDOR/$NAME" && find $@ | sort > "$VENDOR/$NAME/files.txt")
+}
diff --git a/scripts/vendor/nunicode.sh b/scripts/vendor/nunicode.sh
new file mode 100755
index 0000000000..caa6c54d55
--- /dev/null
+++ b/scripts/vendor/nunicode.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
+
+NAME=nunicode
+VERSION=1.7.1
+ROOT=alekseyt-nunicode-263219737286
+
+download "https://bitbucket.org/alekseyt/nunicode/get/$VERSION.tar.gz"
+init
+extract "$ROOT/libnu/*.c" "$ROOT/libnu/*.h" "$ROOT/LICENSE"
+mkdir -p include/libnu src/libnu/gen
+find libnu -name "*.c" -exec mv {} src/{} \;
+find libnu -name "*.h" -exec mv {} include/{} \;
+rm -rf libnu
+file_list include src -name "*.h" -o -name "*.c"