blob: c0c7ebf8ea69cd829b6836c5955045819d2dcafc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
set -eu
VENDOR=$(cd "$(dirname "${BASH_SOURCE[0]}")/../../vendor"; pwd)
CXX=${CXX:-clang++}
CC=${CC:-clang}
function download {
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.tmp"
mv "$VENDOR/.cache/$NAME-$VERSION.tmp" "$VENDOR/.cache/$NAME-$VERSION"
fi
}
function init {
rm -rf "$VENDOR/$NAME"
mkdir -p "$VENDOR/$NAME"
echo $VERSION > "$VENDOR/$NAME/version.txt"
cd "$VENDOR/$NAME"
}
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" $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 {
(cd "$VENDOR/$NAME" && find $@ | LC_ALL=C sort > "$VENDOR/$NAME/files.txt")
}
|