#!/bin/sh -eu SRC_DIR="$HOME/.xmonad" EXE_NAME="xmonad-ng" OUT="$1" shift cd "$SRC_DIR" || exit 1 if command -v stack >/dev/null 2>&1 then unset STACK_YAML echo ">>> stack build <<<" stack build --verbose || exit 1 ln -f -T "$(stack exec -- which $EXE_NAME)" "$OUT" || exit 1 else #echo ">>> cabal sandbox init <<<" #cabal sandbox --verbose init || exit 1 echo ">>> cabal new-configure <<<" cabal new-configure \ --verbose \ --enable-optimization \ --enable-executable-stripping || exit 1 #echo ">>> cabal install <<<" #cabal install --verbose --only-dependencies || exit 1 echo ">>> cabal new-build <<<" cabal new-build --verbose || exit 1 find "$SRC_DIR"/dist-newstyle -type f -executable -name "$EXE_NAME" \ -exec mv -u '{}' "$OUT" ';' || exit 1 fi