-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathmeson-setup.sh
More file actions
executable file
·75 lines (64 loc) · 1.74 KB
/
meson-setup.sh
File metadata and controls
executable file
·75 lines (64 loc) · 1.74 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/sh
# See BUILDING.md for more info.
# This shell script is compatible with dash shell.
set -o nounset -o errexit
if ! type meson >/dev/null; then
echo "Meson must be installed!" 1>&2
exit 1
fi
DRYRUN=""
build_type="release"
while getopts dhb: o; do
case $o in
h)
cat <<EOF
Usage: meson-setup.sh [-h] [-d] [-b release | debug | sanitize] DIR
Helper script to initialize Meson builddir.
Note that the sanitized build style will NOT utilize system-installed
dependencies; instead, they will be fetched and built manually.
-h Print this help message
-d Dry run - print commands that would have been executed
-b Specify build style; set to release when not specified
EOF
exit 0
;;
d)
DRYRUN="echo"
;;
b)
build_type=$OPTARG
;;
*)
echo "Invalid option!" 1>&2
exit 1
;;
esac
done
shift $((OPTIND - 1))
if [ $# -eq 0 ]; then
echo "Build directory must be specified!" 1>&2
exit 1
fi
if [ $# -ge 2 ]; then
printf "Too many arguments specified! If you want to append your own " 1>&2
printf "flags to 'meson setup', invoke it directly. Run this script " 1>&2
printf "with the -d flag to do a dry-run showing the default native " 1>&2
printf "files used (you can then append your own flags to the " 1>&2
printf "'meson setup' invocation).\n" 1>&2
exit 1
fi
case $build_type in
release)
exec $DRYRUN meson setup --native-file meson-native/release.ini "$1"
;;
debug)
exec $DRYRUN meson setup --native-file meson-native/debug.ini "$1"
;;
sanitize)
exec $DRYRUN meson setup --native-file meson-native/sanitize.ini "$1"
;;
*)
echo "Unknown build style $build_type!" 1>&2
exit 1
;;
esac