about summary refs log tree commit diff
path: root/build
blob: b159f443d9d83da048a73187bf5d16c61f6cc418 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/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

Consider giving Nix/NixOS a try! <3