mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
meson-pgo: improved argument validation
This commit is contained in:
parent
a3b6ecf3b2
commit
ac9b3025d8
1 changed files with 19 additions and 10 deletions
29
meson-pgo.sh
29
meson-pgo.sh
|
|
@ -2,25 +2,34 @@
|
|||
|
||||
set -e
|
||||
|
||||
mode=${1}; shift
|
||||
source_dir=$(realpath "${1}"); shift
|
||||
build_dir=$(realpath ${1}); shift
|
||||
|
||||
if [ -d ${build_dir} ]; then
|
||||
echo "${build_dir}: build directory already exists"
|
||||
usage_and_die() {
|
||||
echo "Usage: ${0} none|partial|full|full-headless-sway|[auto] <source-dir> <build-dir>"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
[ ${#} -ge 3 ] || usage_and_die
|
||||
|
||||
mode=${1}
|
||||
source_dir=$(realpath "${2}")
|
||||
build_dir=$(realpath "${3}")
|
||||
shift 3
|
||||
|
||||
case ${mode} in
|
||||
none|auto|partial|full|full-headless-sway)
|
||||
;;
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "${mode}: invalid PGO mode (must be one of 'auto', 'partial' or 'full')"
|
||||
exit 1
|
||||
usage_and_die
|
||||
;;
|
||||
esac
|
||||
|
||||
# meson will complain if source dir is invalid
|
||||
|
||||
if [ -d "${build_dir}" ]; then
|
||||
echo "${build_dir}: build directory already exists"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
compiler=other
|
||||
do_pgo=no
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue