mirror of
https://github.com/brl/mutter.git
synced 2024-12-26 12:52:14 +00:00
a383917b23
Copied from https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/.gitlab-ci/install-meson-project.sh Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3016>
83 lines
1.2 KiB
Bash
Executable File
83 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
usage() {
|
|
cat <<-EOF
|
|
Usage: $(basename $0) [OPTION…] REPO_URL COMMIT
|
|
|
|
Check out and install a meson project
|
|
|
|
Options:
|
|
-Dkey=val Option to pass on to meson
|
|
--subdir Build subdirectory instead of whole project
|
|
--prepare Script to run before build
|
|
|
|
-h, --help Display this help
|
|
|
|
EOF
|
|
}
|
|
|
|
TEMP=$(getopt \
|
|
--name=$(basename $0) \
|
|
--options='D:h' \
|
|
--longoptions='subdir:' \
|
|
--longoptions='prepare:' \
|
|
--longoptions='help' \
|
|
-- "$@")
|
|
|
|
eval set -- "$TEMP"
|
|
unset TEMP
|
|
|
|
MESON_OPTIONS=()
|
|
SUBDIR=.
|
|
PREPARE=:
|
|
|
|
while true; do
|
|
case "$1" in
|
|
-D)
|
|
MESON_OPTIONS+=( -D$2 )
|
|
shift 2
|
|
;;
|
|
|
|
--subdir)
|
|
SUBDIR=$2
|
|
shift 2
|
|
;;
|
|
|
|
--prepare)
|
|
PREPARE=$2
|
|
shift 2
|
|
;;
|
|
|
|
-h|--help)
|
|
usage
|
|
exit 0
|
|
;;
|
|
|
|
--)
|
|
shift
|
|
break
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if [[ $# -lt 2 ]]; then
|
|
usage
|
|
exit 1
|
|
fi
|
|
|
|
REPO_URL="$1"
|
|
COMMIT="$2"
|
|
|
|
CHECKOUT_DIR=$(mktemp --directory)
|
|
trap "rm -rf $CHECKOUT_DIR" EXIT
|
|
|
|
git clone --depth 1 "$REPO_URL" -b "$COMMIT" "$CHECKOUT_DIR"
|
|
|
|
pushd "$CHECKOUT_DIR/$SUBDIR"
|
|
sh -c "$PREPARE"
|
|
meson setup --prefix=/usr _build "${MESON_OPTIONS[@]}"
|
|
meson install -C _build
|
|
popd
|