Skip to content

Instantly share code, notes, and snippets.

@jhickner
Forked from bgamari/build-ghc-arm.sh
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhickner/df0e5d438165e5335887 to your computer and use it in GitHub Desktop.
Save jhickner/df0e5d438165e5335887 to your computer and use it in GitHub Desktop.
updated for rpi 2
#!/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"
}
# Wrapper to strip out BFD ld options which ghc 7.6 will attempt to pass to gold
cat >$bindir/ld.gold-fixed <<EOF
#!/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)
EOF
chmod ugo+rx $bindir/ld.gold-fixed
# Build utilities using BFD ld
use_ld /usr/bin/ld.bfd
make $@ -j 5 -r -f ghc.mk phase=0 phase_0_builds
make $@ -j 5 -r -f ghc.mk phase=1 utils/hsc2hs/dist/build/tmp/hsc2hs
make $@ -j 5 -r -f ghc.mk phase=1 utils/ghc-pkg/dist/build/tmp/ghc-pkg
make $@ -j 5 -r -f ghc.mk phase=1 utils/genapply/dist/build/tmp/genapply
make $@ -j 5 -r -f ghc.mk phase=1 inplace/lib/bin/ghc-stage1
# Build phase 1 using gold
use_ld $bindir/ld.gold-fixed
make $@ -j 5
make -j 5 -C ghc $@ 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment