summaryrefslogtreecommitdiffhomepage
path: root/examples/build
diff options
context:
space:
mode:
authorChuck <chuck@intelligence.org>2019-09-05 15:08:00 -0700
committerjao <jao@gnu.org>2019-09-06 06:05:14 +0100
commitd1ba32888b402f3841847541ded9cc4349ae2f66 (patch)
treecca58583574dcc1ecbb30e136df3d0121286b2a6 /examples/build
parente4b0a5ed59c168d1802648659e087a8191589c1f (diff)
downloadxmobar-d1ba32888b402f3841847541ded9cc4349ae2f66.tar.gz
xmobar-d1ba32888b402f3841847541ded9cc4349ae2f66.tar.bz2
Example build script for read-only XMOBAR_CONFIG_DIR
Diffstat (limited to 'examples/build')
-rw-r--r--examples/build17
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/build b/examples/build
new file mode 100644
index 0000000..9e9eb72
--- /dev/null
+++ b/examples/build
@@ -0,0 +1,17 @@
+#!/usr/bin/bash
+
+# An example build script that directs ghc to use a temporary directory for its
+# intermediate files instead of writing them into XMOBAR_CONFIG_DIR. This
+# allows using a read-only XMOBAR_CONFIG_DIR. To use this script, place it in
+# XMOBAR_CONFIG_DIR and call it "build".
+
+bin=$1
+object_dir=$(mktemp -d)
+
+default_build_args=(--make xmobar.hs -i -ilib -fforce-recomp -main-is main -v0 -o "$bin" -threaded -rtsopts -with-rtsopts -V0) # From src/Xmobar/App/Compile.hs
+extra_build_args=(-odir "$object_dir" -hidir "$object_dir")
+
+ghc "${default_build_args[@]}" "${extra_build_args[@]}"
+status=$?
+rm -r "$object_dir"
+exit $status