diff options
author | Azat Bahawi <azahi@teknik.io> | 2019-12-02 18:03:13 +0300 |
---|---|---|
committer | Azat Bahawi <azahi@teknik.io> | 2019-12-02 18:03:13 +0300 |
commit | 29a3bfae91ff4843a9ea2cab5b8cd18393fbdbf4 (patch) | |
tree | cc977d45768cd4403b89182bbe26303037a55d41 /build | |
parent | fix build script error and update stack (diff) |
Refactor scripts
Diffstat (limited to '')
-rwxr-xr-x | build | 31 | ||||
-rwxr-xr-x | build-scripts/build-cabal | 18 | ||||
-rwxr-xr-x | build-scripts/build-cabal-sandbox | 22 | ||||
-rwxr-xr-x | build-scripts/build-stack | 15 |
4 files changed, 25 insertions, 61 deletions
diff --git a/build b/build index aa11764..be60f9c 100755 --- a/build +++ b/build @@ -8,11 +8,30 @@ shift cd "$SRC_DIR" || exit 1 -cabal new-configure \ - --enable-optimization \ - --enable-executable-stripping +if command -v cabal >/dev/null 2>&1 +then + #echo ">>> cabal sandbox init <<<" + #cabal sandbox --verbose init || exit 1 -cabal new-build + echo ">>> cabal new-configure <<<" + cabal new-configure \ + --verbose \ + --enable-optimization \ + --enable-executable-stripping || exit 1 -find "$SRC_DIR"/dist-newstyle -type f -executable -name "$EXE_NAME" \ - -exec mv -u '{}' "$OUT" ';' + #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 +else + unset STACK_YAML + + echo ">>> stack build <<<" + stack build --verbose || exit 1 + + ln -f -T "$(stack exec -- which $EXE_NAME)" "$1" || exit 1 +fi diff --git a/build-scripts/build-cabal b/build-scripts/build-cabal deleted file mode 100755 index aa11764..0000000 --- a/build-scripts/build-cabal +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -eu - -SRC_DIR="$HOME/.xmonad" -EXE_NAME="xmonad-ng" -OUT="$1" - -shift - -cd "$SRC_DIR" || exit 1 - -cabal new-configure \ - --enable-optimization \ - --enable-executable-stripping - -cabal new-build - -find "$SRC_DIR"/dist-newstyle -type f -executable -name "$EXE_NAME" \ - -exec mv -u '{}' "$OUT" ';' diff --git a/build-scripts/build-cabal-sandbox b/build-scripts/build-cabal-sandbox deleted file mode 100755 index 435fa43..0000000 --- a/build-scripts/build-cabal-sandbox +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -eu - -SRC_DIR="$HOME/.xmonad" -EXE_NAME="xmonad-ng" -OUT="$1" - -shift - -cd "$SRC_DIR" || exit 1 - -cabal sandbox init - -cabal configure \ - --enable-optimization \ - --enable-executable-stripping - -cabal install --only-dependencies - -cabal build - -find "$SRC_DIR"/dist -type f -executable -name "$EXE_NAME" \ - -exec mv -u '{}' "$OUT" ';' diff --git a/build-scripts/build-stack b/build-scripts/build-stack deleted file mode 100755 index 235b826..0000000 --- a/build-scripts/build-stack +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -eu - -SRC_DIR="$HOME/.xmonad" -EXE_NAME="xmonad-ng" -OUT="$1" - -shift - -unset STACK_YAML - -cd "$SRC_DIR" || exit 1 - -stack build - -ln -f -T "$(stack exec -- which $EXE_NAME)" "$1" |