about summary refs log tree commit diff
path: root/build-scripts/build-cabal
diff options
context:
space:
mode:
authorazahi <azahi@teknik.io>2019-09-29 14:28:37 +0300
committerazahi <azahi@teknik.io>2019-09-29 14:28:37 +0300
commitd46adbbb0b8452ea25ba01d2b34d2bdc8a5a3a6d (patch)
treee2a4aeb19d828cf7f3b555855bb697299d63eaa5 /build-scripts/build-cabal
parentUpdate xmonad-contrib (diff)
Add build scripts
Diffstat (limited to '')
-rwxr-xr-xbuild-scripts/build-cabal18
-rwxr-xr-xbuild-scripts/build-cabal-sandbox22
2 files changed, 40 insertions, 0 deletions
diff --git a/build-scripts/build-cabal b/build-scripts/build-cabal
new file mode 100755
index 0000000..aa11764
--- /dev/null
+++ b/build-scripts/build-cabal
@@ -0,0 +1,18 @@
+#!/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
new file mode 100755
index 0000000..435fa43
--- /dev/null
+++ b/build-scripts/build-cabal-sandbox
@@ -0,0 +1,22 @@
+#!/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" ';'

Consider giving Nix/NixOS a try! <3