forked from naev/naev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.sh
executable file
·56 lines (49 loc) · 1.49 KB
/
meson.sh
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
#
# This script will download and wrap meson if the current installed version
# is not at least version 0.55.0 (which meson.build currently requires)
# if you have a newer version of meson in PATH, this wrapper isn't needed,
# but it will pass commands through all the same.
#
# Keep in mind that this script does not account for ninja-build being installed (yet)
#
MESONDIR="meson-bin"
grab_meson () {
VERSION="0.55.3"
PACKAGE="meson-$VERSION.tar.gz"
if [ ! -d "$MESONDIR" ]; then
mkdir "$MESONDIR"
fi
if [ ! -f "$MESON" ]; then
echo "grabbing from online"
curl -L "https://github.com/mesonbuild/meson/releases/download/$VERSION/$PACKAGE" -o $PACKAGE
tar -xf $PACKAGE -C "$MESONDIR" --strip 1
rm $PACKAGE
else
echo "using cached version $VERSION"
fi
}
if ! [ -x "$(command -v meson)" ]; then
echo "You don't have Meson in PATH"
MESON="$MESONDIR/meson.py"
grab_meson
else
currentver="$(meson --version)"
requiredver="0.55.0"
if [ "$(printf '%s\n' "$requiredver" "$currentver" | sort -V | head -n1)" = "$requiredver" ]; then
echo "Meson version is greater than or equal to ${requiredver}"
MESON="meson"
else
echo "Meson version is lower than ${requiredver}"
MESON="$MESONDIR/meson.py"
grab_meson
fi
fi
run_meson () {
if [[ "$MESON" = *"$MESONDIR"* ]]; then
./$MESON "$@"
else
$MESON "$@"
fi
}
run_meson "$@"