Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Ridiculous refactoring of compileHaskell.sh to properly quote import …

…paths and input files
  • Loading branch information...
commit 7ec2086c434e69bc3281304951fa89dbe7f27efe 1 parent 70290e2
@jspahrsummers authored
Showing with 13 additions and 14 deletions.
  1. +13 −14 Configuration/compileHaskell.sh
View
27 Configuration/compileHaskell.sh
@@ -3,35 +3,34 @@
# Script for compiling *.hs files in an Xcode project, meant to be used with
# a build rule.
-IMPORTS="-i$PWD"
+declare -a imports
# Use Objective-C header search paths to locate Haskell modules too
-for DIR in $HEADER_SEARCH_PATHS
+for dir in $HEADER_SEARCH_PATHS
do
# Because Haskell module names should be qualified, we need to move one
# folder up (which will usually be from the target folder to the project
# folder)
- DIR=`dirname "$DIR"`
+ dir=`dirname "$dir"`
- IMPORTS="$IMPORTS -i$DIR"
+ imports=( "${imports[@]}" "-i$dir" )
done
-cd "$INPUT_FILE_DIR"
-LOCKFILE=./ghc.lock
+lockfile="$INPUT_FILE_DIR/ghc.lock"
-lockfile -r 0 -l 60 -s 1 "$LOCKFILE"
+lockfile -r 0 -l 60 -s 1 "$lockfile"
if [ $? -eq 0 ]
then
- /usr/local/bin/ghc \
+ find "$INPUT_FILE_DIR" -name '*.hs' -print0 | \
+ xargs -0 /usr/local/bin/ghc \
-XForeignFunctionInterface -XTemplateHaskell \
-Werror -fwarn-incomplete-patterns -fwarn-dodgy-imports -fwarn-dodgy-exports -fwarn-unused-binds -fwarn-hi-shadowing -fwarn-identities -fwarn-monomorphism-restriction \
- -framework Foundation $IMPORTS \
+ -framework Foundation ${imports[@]} \
-c -O -threaded --make \
- "$@" \
- ./*.hs
+ "$@"
- STATUS=$?
- rm -f "$LOCKFILE"
+ st=$?
+ rm -f "$lockfile"
- exit $STATUS
+ exit $st
fi
Please sign in to comment.
Something went wrong with that request. Please try again.