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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
#!/bin/sh
set -eu
ghcflags="-rtsopts -threaded -Werror"
testflags="CreateDirectoryIfMissing001.num-repeats=100000 +RTS -N2"
post_configure() {
if [ "${DISABLE_UTIMENSAT+x}" ]; then
sed -i "s/#define HAVE_UTIMENSAT 1//" include/HsDirectoryConfig.h
fi
}
prepare() {
if [ "${STACK+x}" ]; then
stack="$STACK --no-terminal"
mkdir -p _stack
(
cd _stack
case `uname` in
Darwin)
url=https://www.stackage.org/stack/osx-x86_64
curl --retry 3 -fsLS "$url" | tar xzf -
mv */stack .;;
Linux)
url=https://www.stackage.org/stack/linux-x86_64
curl --retry 3 -fsLS "$url" | tar xzf -
mv */stack .;;
MSYS*)
url=https://www.stackage.org/stack/windows-x86_64
curl --retry 3 -fsLSo stack.zip "$url"
7z x stack.zip stack.exe;;
*)
printf >&2 "unknown uname: %s\n" "`uname`"
return 1;;
esac
)
# silence it because it's far too verbose
tools/retry $stack setup >/dev/null
$stack ghc -- --version
$stack --version
$stack init
sed "s/^\(extra-deps:\).*/\1 [${DEPS-}]/" stack.yaml >stack.yaml.tmp
mv stack.yaml.tmp stack.yaml
$stack test --install-ghc --only-dependencies
$stack list-dependencies
else
ghc --version
cabal --version
tools/retry cabal update
cabal install --enable-tests --only-dependencies
fi
if [ -f configure.ac ]; then
autoreconf -i
fi
}
build() {
if [ "${STACK+x}" ]; then
stack="$STACK --no-terminal"
$stack test --haddock --no-haddock-deps \
--ghc-options "$ghcflags" \
--test-arguments "$testflags"
$stack sdist
else
# check if `streaming` is supported (didn't exist until 1.20)
if cabal 2>&1 test --show-details=streaming __dummy |
grep >/dev/null 2>&1 "cabal: --show-details flag expects"; then
streaming=always
else
streaming=streaming
fi
# check if `--run-tests` is supported (didn't exist until 1.20); tests
# must be run prior to install as packages may be broken by install
if cabal 2>&1 install --run-tests __dummy |
grep >/dev/null 2>&1 "cabal: unrecognized option"; then
cabal_install_run_tests() {
tgz=$1
shift
mkdir -p .cabal_install_run_tests.tmp
(
cd .cabal_install_run_tests.tmp
tar xzf -
cd ./*-*
cabal configure --enable-tests
cabal build
cabal test
) <"$tgz"
cabal install "$@" "$tgz"
}
else
cabal_install_run_tests() {
cabal install --run-tests "$@"
}
fi
testflags=`printf " %s" "$testflags" | sed "s/ / --test-option=/g"`
cabal configure -v2 --enable-tests --ghc-options="$ghcflags"
post_configure
cabal build
cabal check
cabal sdist
cabal copy
cabal test --show-details="$streaming" $testflags
cabal_install_run_tests dist/*-*.tar.gz --force-reinstalls
fi
}
"$@"
|