Adding a new GHC version¶
-
Push new tag to our fork:
git clone git@github.com:commercialhaskell/ghc.git cd ghc git remote add upstream https://gitlab.haskell.org/ghc/ghc.git git fetch upstream git push origin ghc-X.Y.Z-release -
Publish a new Github release with tag
ghc-X.Y.Z-releaseand same name, with description noting where the binidsts are mirrored from. E.g.Unless otherwise indicated, bindists are mirrored from https://downloads.haskell.org/~ghc/ * FreeBSD bindists are mirrored from http://distcache.FreeBSD.org/local-distfiles/arrowd/stack-bindists * musl bindists are mirrored from https://github.com/redneb/ghc-alt-libc/releases -
Download all the relevant GHC bindists from their sources, and upload them to the just-created Github release (see stack-setup-2.yaml for the ones we used in the last GHC release).
In the case of macOS, repackage the
.xzbindist as a.bz2, since macOS does not includexzby default or provide an easy way to install it.The script at
etc/scripts/mirror-ghc-bindists-to-github.shwill help with this. See the comments within the script. -
Edit stack-setup-2.yaml and add the new bindists, pointing to the Github release version. Be sure to update the
content-lengthandsha1values.Before committing, test using a command like:
stack --resolver=ghc-X.Y.Z setup --setup-info-yaml=path/to/stackage-content/stack/stack-setup-2.yaml -
In stackage-content, run
cd stack && ./update-global-hints.hs ghc-X.Y.Zand commit the changes.
Building GHC¶
NOTE: We are no longer building custom GHC bindists. This section remains for future reference, but GHC's build system has changed substantially since it was written.
TODO: look into using https://github.com/bgamari/ghc-utils/blob/master/rel-eng/bin-release.sh, which is the script used to official bindists.
On systems with a small /tmp, you should set TMP and TEMP to an alternate
location.
Setup the system based on these instructions. On Ubuntu (docker run -ti --rm ubuntu:16.04):
apt-get update && apt-get install -y ghc alex happy make autoconf g++ git vim xz-utils automake libtool gcc libgmp-dev ncurses-dev libtinfo-dev python3
on Void Linux (docker run -ti --rm voidlinux/voidlinux bash):
xbps-install -S curl gcc make xz ghc autoconf git vim automake gmp-devel ncurses-devel python3 cabal-install && \
cabal update && \
cabal install alex happy
For GHC >= 7.10.2, set the GHC_VERSION environment variable to the version to build:
export GHC_VERSION=8.2.2export GHC_VERSION=8.2.1export GHC_VERSION=8.0.2export GHC_VERSION=8.0.1export GHC_VERSION=7.10.3aexport GHC_VERSION=7.10.2
then, run (from here):
git config --global url."git://github.com/ghc/packages-".insteadOf git://github.com/ghc/packages/ && \
git clone -b ghc-${GHC_VERSION}-release --recursive https://gitlab.haskell.org/ghc/ghc.git ghc-${GHC_VERSION} && \
cd ghc-${GHC_VERSION}/ && \
cp mk/build.mk.sample mk/build.mk && \
sed -i 's/^#BuildFlavour *= *perf$/BuildFlavour = perf/' mk/build.mk && \
./boot && \
./configure --enable-tarballs-autodownload && \
sed -i 's/^TAR_COMP *= *bzip2$/TAR_COMP = xz/' mk/config.mk && \
make -j$(cat /proc/cpuinfo|grep processor|wc -l) && \
make binary-dist
GHC 7.8.4 is slightly different:
export GHC_VERSION=7.8.4 && \
git config --global url."git://github.com/ghc/packages-".insteadOf git://github.com/ghc/packages/ && \
git clone -b ghc-${GHC_VERSION}-release --recursive https://gitlab.haskell.org/ghc/ghc.git ghc-${GHC_VERSION} && \
cd ghc-${GHC_VERSION}/ && \
./sync-all --extra --nofib -r git://git.haskell.org get -b ghc-7.8 && \
cp mk/build.mk.sample mk/build.mk && \
sed -i 's/^#BuildFlavour *= *perf$/BuildFlavour = perf/' mk/build.mk && \
perl boot && \
./configure && \
sed -i 's/^TAR_COMP *= *bzip2$/TAR_COMP = xz/' mk/config.mk && \
make -j$(cat /proc/cpuinfo|grep processor|wc -l) && \
make binary-dist