summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2013-07-15 20:21:31 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2013-07-15 20:21:31 +0100
commit24a5aa63959a89285248ae2c55f427c0ebc3cd52 (patch)
tree959bda324e330798d5103db7e8b74fec3cc8ee2f /scripts
parente2158eee5af24b1595d0b755e01e57de3707250b (diff)
downloadresources-24a5aa63959a89285248ae2c55f427c0ebc3cd52.tar.bz2
Update flycheck to support cabal-dev installations so that gitlib playing works
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/ghc-cabal-dev30
1 files changed, 30 insertions, 0 deletions
diff --git a/scripts/ghc-cabal-dev b/scripts/ghc-cabal-dev
new file mode 100755
index 0000000..737a432
--- /dev/null
+++ b/scripts/ghc-cabal-dev
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+TOP="${HOME}"
+INVOKED="$(pwd)"
+FOUNDDEV=0
+GHCVER="$(ghc --version | cut -d, -f2 | awk '{print $2}')"
+while test "$(pwd)" != "${TOP}" && test "$(pwd)" != "/"; do
+ if test -d cabal-dev/packages-${GHCVER}.conf; then
+ if test $FOUNDDEV = 0; then
+ FOUNDDEV=1
+ fi
+ set -- -package-conf "$(pwd)/cabal-dev/packages-${GHCVER}.conf" "$@"
+ fi
+ cd ..
+done
+
+if test $FOUNDDEV = 1; then
+ set -- -no-user-package-conf "$@"
+fi
+cd "${INVOKED}"
+ghc "$@"
+if (echo "$@" | grep -q flycheck) >/dev/null 2>&2; then
+ shift $(($# - 1))
+ DIR=$(dirname "$1")
+ BASE=$(basename "$1" .hs)
+ if "x$BASE" == "x$1"; then
+ BASE=$(basename "$BASE" .lhs)
+ fi
+ rm -f "${DIR}/${BASE}.o" "${DIR}/${BASE}.hi"
+fi