2020-11-06 17:59:19 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
if [[ $# -lt 4 ]]; then
|
|
|
|
echo Usage: $0 [options] [repo-url] [commit] [subdir]
|
|
|
|
echo Options:
|
|
|
|
echo -Dkey=val
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
MESON_OPTIONS=()
|
|
|
|
|
|
|
|
while [[ $1 =~ ^-D ]]; do
|
|
|
|
MESON_OPTIONS+=( "$1" )
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
REPO_URL="$1"
|
|
|
|
COMMIT="$2"
|
|
|
|
SUBDIR="$3"
|
|
|
|
PREPARE="$4"
|
|
|
|
|
|
|
|
REPO_DIR="$(basename ${REPO_URL%.git})"
|
|
|
|
|
|
|
|
git clone --depth 1 "$REPO_URL" -b "$COMMIT"
|
|
|
|
pushd "$REPO_DIR"
|
|
|
|
pushd "$SUBDIR"
|
|
|
|
sh -c "$PREPARE"
|
|
|
|
meson --prefix=/usr _build "${MESON_OPTIONS[@]}"
|
2021-08-05 01:46:53 +00:00
|
|
|
meson install -C _build
|
2020-11-06 17:59:19 +00:00
|
|
|
popd
|
|
|
|
popd
|
|
|
|
rm -rf "$REPO_DIR"
|