2006-10-28 17:13:18 +02:00
|
|
|
#!/bin/sh
|
2006-11-03 06:44:22 +01:00
|
|
|
# Preprocesses cabal file.
|
2006-10-28 17:13:18 +02:00
|
|
|
|
|
|
|
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}"
|
|
|
|
;;
|
2006-10-30 06:40:41 +01:00
|
|
|
6.[5-9]*)
|
2006-10-28 17:13:18 +02:00
|
|
|
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')
|
|
|
|
|
2006-10-30 09:18:00 +01:00
|
|
|
# Handle 'Hs-Source-Dir' option name which was deprecated in Cabal > 1.1.3.
|
2006-10-28 17:13:18 +02:00
|
|
|
HS_SOURCE_DIRS='Hs-Source-Dirs'
|
2006-11-02 04:30:47 +01:00
|
|
|
cabal_version=$(ghc-pkg -l | sed -ne 's/.*[Cc]abal-\([^,]*\).*/\1/p')
|
2006-10-30 09:18:00 +01:00
|
|
|
if printf "$cabal_version\n1.1.3" | sort | tail -n 1 | grep -q '1\.1\.3'; then
|
2006-10-28 17:13:18 +02:00
|
|
|
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"
|