diff options
Diffstat (limited to 'shellrc.d/dev')
-rw-r--r-- | shellrc.d/dev | 90 |
1 files changed, 54 insertions, 36 deletions
diff --git a/shellrc.d/dev b/shellrc.d/dev index e66369c..c394a8a 100644 --- a/shellrc.d/dev +++ b/shellrc.d/dev @@ -1,57 +1,59 @@ # vim: ft=sh: - if command -v valgrind >/dev/null; then - alias memcheck="valgrind --track-fds=yes --leak-check=full --track-origins=yes" - alias massif="valgrind --tool=massif" - alias drd="valgrind --tool=drd" - alias helgrind="valgrind --tool=helgrind" + alias memcheck="valgrind --error-exitcode=118 --track-fds=yes --leak-check=full --track-origins=yes" + alias callgrind="valgrind --error-exitcode=118 --tool=callgrind" + alias massif="valgrind --error-exitcode=118 --tool=massif" + alias drd="valgrind --error-exitcode=118 --tool=drd" + alias helgrind="valgrind --error-exitcode=118 --tool=helgrind" + alias dhat="valgrind --error-exitcode=118 --tool=dhat" fi - if command -v meson >/dev/null; then -_meson_setup() { - if [ ! -f "build/build.ninja" ]; then - meson setup -Doptimization=plain build - fi -} + msetup() { + set -- "-Doptimization=plain" "$@" + 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() { @@ -59,6 +61,11 @@ if command -v bear >/dev/null; then bear --output build/compile_commands.json --append -- make "$@" } + bmmake() { + mkdir -p build + bear --output build/compile_commands.json --append -- make "-j$(($(nproc) * 2))" "-l$(nproc)" "$@" + } + alias mbmake='bmake -j$(($(nproc) * 2)) -l$(nproc)' fi @@ -70,3 +77,14 @@ glv() { nvim_config() ( cd ~/.config/nvim && nvim init.vim ) + +if command -v nix 2>/dev/null >&2; then + nrun() { + nix run .?submodules=1# -- "$@" + } + nrun_() { + local package="$1" + shift + nix run ".?submodules=1#$package" -- "$@" + } +fi |