pandoc/cabalize
roktas 156be8b17a Merge trunk with ghc66-branch.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@28 788f1e2b-df1e-0410-8736-df70ead52e1b
2006-10-28 15:13:18 +00:00

39 lines
936 B
Bash
Executable file

#!/bin/sh
BASE_DEPENDS="base haskell98 parsec"
GHC64_DEPENDS=${GHC64_DEPENDS}
GHC66_DEPENDS=${GHC66_DEPENDS-"regex-compat html"}
HCFLAGS=${HCFLAGS-"-O0"}
set -- $(ghc --version)
while [ -n "$1" ] && [ "$1" != 'version' ]; do
shift
done
shift
ghc_version="$1"
BUILD_DEPENDS="${BASE_DEPENDS}"
case "$ghc_version" in
6.4*)
BUILD_DEPENDS="${BUILD_DEPENDS} ${GHC64_DEPENDS}"
;;
6.[56]*)
BUILD_DEPENDS="${BUILD_DEPENDS} ${GHC66_DEPENDS}"
;;
*)
echo >&2 "WARNING: Unsupported GHC version '$ghc_version'; proceeding anyway"
break
;;
esac
BUILD_DEPENDS=$(echo $BUILD_DEPENDS | sed -e 's# #, #g')
# Handle 'Hs-Source-Dir' option name which was deprecated in Cabal 1.1.4.
HS_SOURCE_DIRS='Hs-Source-Dirs'
if ghc-pkg -l | grep -q '\<[Cc]abal-[0-1]\.[0-1]\.[0-3][^,]*'; then
HS_SOURCE_DIRS='Hs-Source-Dir'
fi
sed -e "s#@HCFLAGS@#$HCFLAGS#g" \
-e "s#@BUILD_DEPENDS@#$BUILD_DEPENDS#g" \
-e "s#@HS_SOURCE_DIRS@#$HS_SOURCE_DIRS#g"