Skip to content

Instantly share code, notes, and snippets.

@korczis
Last active August 29, 2015 14:04
Show Gist options
  • Save korczis/95d7448cc965032c3320 to your computer and use it in GitHub Desktop.
Save korczis/95d7448cc965032c3320 to your computer and use it in GitHub Desktop.
The state of GHC on ARM
#!/bin/bash -e
bindir=`pwd`/bin-tmp
mkdir -p $bindir
export PATH=$bindir:$PATH
function use_ld() {
rm -f $bindir/ld
ln -s $1 $bindir/ld
echo "Using $1 for ld"
}
echo Creating wrapping script
# Wrapper to strip out BFD ld options which ghc 7.6 will attempt to pass to gold
cat > $bindir/ld.gold-fixed << End-of-message
#!/usr/bin/env python
# From http://stackoverflow.com/questions/6952396
import sys
import os
import subprocess
tofilter = [
"--hash-size",
"--reduce-memory-overheads",
]
filtered = [ a for a in sys.argv if not any(a.startswith(p) for p in tofilter) ]
filtered[0] = "/usr/bin/ld.gold"
subprocess.check_call(filtered)
End-of-message
echo Wrapping script created
chmod ugo+rx $bindir/ld.gold-fixed
echo Building phase0
# Build utilities using BFD ld
use_ld /usr/bin/ld.bfd
make $@ -r -f ghc.mk phase=0 phase_0_builds
make $@ -r -f ghc.mk phase=1 utils/hsc2hs/dist/build/tmp/hsc2hs
make $@ -r -f ghc.mk phase=1 utils/ghc-pkg/dist/build/tmp/ghc-pkg
make $@ -r -f ghc.mk phase=1 utils/genapply/dist/build/tmp/genapply
make $@ -r -f ghc.mk phase=1 inplace/lib/bin/ghc-stage1
echo Building phase1 using fixed gold linker
# Build phase 1 using gold
use_ld $bindir/ld.gold-fixed
make $@
make -C ghc $@ 1
$ sudo apt-get install ghc automake build-essential cabal-install
$ cabal update
$ cabal install happy alex
$ git clone git@github.com:ghc/ghc
$ cd ghc
$ git checkout --track origin/ghc-7.8
$ ./sync-all get
$ ./boot
$ ./configure --with-ghc=/usr/bin/ghc
$ wget https://gist.githubusercontent.com/bgamari/9399430/raw/build-ghc-arm.sh
$ chmod ugo+rx build-ghc-arm.sh
$ ./build-ghc-arm.sh -j4
$ make test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment