aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2024-05-09 12:26:59 +0200
committerKarel Kočí <cynerd@email.cz>2024-05-09 12:26:59 +0200
commitc85986462d408a13f9dc2688547fe1e2c99c2e35 (patch)
treea7b7514f279d81fa8d7cae315daf12cd44edec86
parent4456b47318a9014b8fa2eeec34edb165cb4ca811 (diff)
downloadshellrc-c85986462d408a13f9dc2688547fe1e2c99c2e35.tar.gz
shellrc-c85986462d408a13f9dc2688547fe1e2c99c2e35.tar.bz2
shellrc-c85986462d408a13f9dc2688547fe1e2c99c2e35.zip
dev: allow calling meson setup directly
-rw-r--r--shellrc.d/dev63
1 files changed, 31 insertions, 32 deletions
diff --git a/shellrc.d/dev b/shellrc.d/dev
index 04ce496..5b1963a 100644
--- a/shellrc.d/dev
+++ b/shellrc.d/dev
@@ -1,6 +1,5 @@
# vim: ft=sh:
-
if command -v valgrind >/dev/null; then
alias memcheck="valgrind --track-fds=yes --leak-check=full --track-origins=yes"
@@ -10,48 +9,48 @@ if command -v valgrind >/dev/null; then
fi
-
if command -v meson >/dev/null; then
-_meson_setup() {
- if [ ! -f "build/build.ninja" ]; then
- meson setup -Doptimization=plain build
- fi
-}
+ msetup() {
+ if [[ -f "build/build.ninja" ]]; then
+ [[ $# -eq 0 ]] ||
+ meson configure build "$@"
+ else
+ meson setup "$@" build
+ fi
+ }
-mbuild() {
- _meson_setup \
- && meson compile -C build "$@"
-}
+ mbuild() {
+ msetup &&
+ meson compile -C build "$@"
+ }
-mtest() {
- _meson_setup \
- && meson test -C build "$@"
-}
+ mtest() {
+ msetup &&
+ meson test -C build "$@"
+ }
-mcoverage() {
- _meson_setup \
- && meson configure build -Db_coverage=true \
- && meson test -C build "$@" \
- && ninja -C build coverage-html
-}
+ mcoverage() {
+ msetup -Db_coverage=true &&
+ meson test -C build "$@" &&
+ ninja -C build coverage-html
+ }
-mdist() {
- _meson_setup \
- && meson dist -C build --formats xztar,gztar,zip "$@"
-}
+ mdist() {
+ msetup &&
+ meson dist -C build --formats xztar,gztar,zip "$@"
+ }
-mupdate() {
- meson subprojects update
-}
+ mupdate() {
+ meson subprojects update
+ }
-mpurge() {
- meson subprojects purge
-}
+ mpurge() {
+ meson subprojects purge
+ }
fi
-
if command -v bear >/dev/null; then
bmake() {