diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2021-08-31 19:07:03 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2021-09-12 08:39:43 +0000 |
| commit | ac9b3025d87f85b06ebe85aba610dfe1e3424801 (patch) | |
| tree | 02e592dc03e62f0f0529213ed0c73a9765cb9be2 | |
| parent | meson-pgo: add mode=none (diff) | |
meson-pgo: improved argument validation
| -rwxr-xr-x | meson-pgo.sh | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/meson-pgo.sh b/meson-pgo.sh index ca542351..6a366f79 100755 --- a/meson-pgo.sh +++ b/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 |
