#!/usr/bin/env bash # vim: sw=2 et set -euo pipefail fail() { echo "ERROR: $*" >&2 exit 1 } echo 'BUILD_SPHINX_HTML = NO' > mk/validate.mk echo 'BUILD_SPHINX_PDF = NO' >> mk/validate.mk hackage_index_state="@1511758800" cat > mk/build.mk <> mk/build.mk echo 'WERROR=' >> mk/build.mk # https://circleci.com/docs/2.0/env-vars/#interpolating-environment-variables-to-set-other-environment-variables echo 'export PATH=/opt/ghc/bin:$PATH' >> $BASH_ENV else fail "TARGET=$target not supported" fi else # assuming Ubuntu apt-get install -qy git make automake autoconf gcc perl python3 texinfo xz-utils lbzip2 patch cabal update cabal install --reinstall hscolour --index-state=$hackage_index_state fi ;; Darwin) if [[ -n ${TARGET:-} ]]; then fail "uname=$(uname) not supported for cross-compilation" fi brew install ghc cabal-install python3 ncurses gmp cabal update cabal install --reinstall alex happy haddock hscolour --index-state=$hackage_index_state # put them on the $PATH, don't fail if already installed ln -s $HOME/.cabal/bin/alex /usr/local/bin/alex || true ln -s $HOME/.cabal/bin/happy /usr/local/bin/happy || true ln -s $HOME/.cabal/bin/hscolour /usr/local/bin/hscolour || true ;; *) fail "uname=$(uname) not supported" esac