summaryrefslogtreecommitdiffhomepage
path: root/examples/build
blob: 9e9eb725b1fd016fd4dbed8b9f18b8384f10328c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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