|
| 1 | +<div class="hidden-warning"><a href="https://docs.haskellstack.org/"><img src="https://rawgit.com/commercialhaskell/stack/master/doc/img/hidden-warning.svg"></a></div> |
| 2 | + |
| 3 | +# Adding a new GHC version |
| 4 | + |
| 5 | + * Push new tag to our fork: |
| 6 | + |
| 7 | + git clone [email protected]:commercialhaskell/ghc.git |
| 8 | + cd ghc |
| 9 | + git remote add upstream [email protected]:ghc/ghc.git |
| 10 | + git fetch upstream |
| 11 | + git push origin ghc-X.Y.Z-release |
| 12 | + |
| 13 | + * [Publish a new Github release](https://github.com/commercialhaskell/ghc/releases/new) |
| 14 | + with tag `ghc-X.Y.Z-release` and same name. |
| 15 | + |
| 16 | + * Download all the relevant GHC bindists from https://www.haskell.org/ghc/download_ghc_X_Y_Z and upload them to the just-created Github release (see |
| 17 | + [stack-setup-2.yaml](https://github.com/fpco/stackage-content/blob/master/stack/stack-setup-2.yaml) |
| 18 | + for the ones we used in the last GHC release). |
| 19 | + |
| 20 | + In the case of macOS, repackage the `.xz` bindist as a `.bz2`, since macOS does |
| 21 | + not include `xz` by default or provide an easy way to install it. |
| 22 | + |
| 23 | + The script at `etc/scripts/mirror-ghc-bindists-to-github.sh` will help with |
| 24 | + this. See the comments within the script. |
| 25 | + |
| 26 | + * [Edit stack-setup-2.yaml](https://github.com/fpco/stackage-content/edit/master/stack/stack-setup-2.yaml) |
| 27 | + and add the new bindists, pointing to the Github release version. Be sure to |
| 28 | + update the `content-length` and `sha1` values. |
| 29 | + |
| 30 | + |
| 31 | +## Building GHC |
| 32 | + |
| 33 | +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. |
| 34 | + |
| 35 | +On systems with a small `/tmp`, you should set TMP and TEMP to an alternate |
| 36 | +location. |
| 37 | + |
| 38 | +Setup the system based on [these instructions](https://ghc.haskell.org/trac/ghc/wiki/Building/Preparation/Linux). On Ubuntu (`docker run -ti --rm ubuntu:16.04`): |
| 39 | + |
| 40 | + 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 |
| 41 | + |
| 42 | +on Void Linux (`docker run -ti --rm voidlinux/voidlinux bash`): |
| 43 | + |
| 44 | + xbps-install -S curl gcc make xz ghc autoconf git vim automake gmp-devel ncurses-devel python3 cabal-install && \ |
| 45 | + cabal update && \ |
| 46 | + cabal install alex happy |
| 47 | + |
| 48 | +For GHC >= 7.10.2, set the `GHC_VERSION` environment variable to the version to build: |
| 49 | + |
| 50 | + * `export GHC_VERSION=8.2.2` |
| 51 | + * `export GHC_VERSION=8.2.1` |
| 52 | + * `export GHC_VERSION=8.0.2` |
| 53 | + * `export GHC_VERSION=8.0.1` |
| 54 | + * `export GHC_VERSION=7.10.3a` |
| 55 | + * `export GHC_VERSION=7.10.2` |
| 56 | + |
| 57 | +then, run (from [here](https://ghc.haskell.org/trac/ghc/wiki/Newcomers)): |
| 58 | + |
| 59 | + git config --global url."git://github.com/ghc/packages-".insteadOf git://github.com/ghc/packages/ && \ |
| 60 | + git clone -b ghc-${GHC_VERSION}-release --recursive git://github.com/ghc/ghc ghc-${GHC_VERSION} && \ |
| 61 | + cd ghc-${GHC_VERSION}/ && \ |
| 62 | + cp mk/build.mk.sample mk/build.mk && \ |
| 63 | + sed -i 's/^#BuildFlavour *= *perf$/BuildFlavour = perf/' mk/build.mk && \ |
| 64 | + ./boot && \ |
| 65 | + ./configure --enable-tarballs-autodownload && \ |
| 66 | + sed -i 's/^TAR_COMP *= *bzip2$/TAR_COMP = xz/' mk/config.mk && \ |
| 67 | + make -j$(cat /proc/cpuinfo|grep processor|wc -l) && \ |
| 68 | + make binary-dist |
| 69 | + |
| 70 | +GHC 7.8.4 is slightly different: |
| 71 | + |
| 72 | + export GHC_VERSION=7.8.4 && \ |
| 73 | + git config --global url."git://github.com/ghc/packages-".insteadOf git://github.com/ghc/packages/ && \ |
| 74 | + git clone -b ghc-${GHC_VERSION}-release --recursive git://github.com/ghc/ghc ghc-${GHC_VERSION} && \ |
| 75 | + cd ghc-${GHC_VERSION}/ && \ |
| 76 | + ./sync-all --extra --nofib -r git://git.haskell.org get -b ghc-7.8 && \ |
| 77 | + cp mk/build.mk.sample mk/build.mk && \ |
| 78 | + sed -i 's/^#BuildFlavour *= *perf$/BuildFlavour = perf/' mk/build.mk && \ |
| 79 | + perl boot && \ |
| 80 | + ./configure && \ |
| 81 | + sed -i 's/^TAR_COMP *= *bzip2$/TAR_COMP = xz/' mk/config.mk && \ |
| 82 | + make -j$(cat /proc/cpuinfo|grep processor|wc -l) && \ |
| 83 | + make binary-dist |
0 commit comments