blob: 1cffc77353b7fa0911b10d7386bafc65b661f700 (
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
|
#!/bin/sh
# must match "executable" line from xmonad-config.cabal
EXE_NAME=xmonad-config
# xmonad tells us how it want resulting executable to be named
output_file=$1; shift
CFG_DIR="$HOME/.xmonad"
if [ ! -f "$HOME/.cabal/config" ]; then
cabal new-update
fi
# build the config
cd $CFG_DIR
cabal new-configure --enable-optimization --enable-executable-stripping
cabal new-build
if [ "$output_file" != "" ]; then
# move resulting binary where it was requested to reside
res=`find $CFG_DIR/dist-newstyle -type f -perm +111 -name $EXE_NAME`
if [ "$res" == "" ]; then
return 1
fi
# use "mv" to be able to replace a running executable
mv -f "$res" "$output_file"
cp "$output_file" "$res"
fi
|