Last active
August 29, 2015 13:57
-
-
Save bgamari/9399430 to your computer and use it in GitHub Desktop.
A small helper script for building GHC 7.8 on ARM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 $@ -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 | |
# Build phase 1 using gold | |
use_ld $bindir/ld.gold-fixed | |
make $@ | |
make -C ghc $@ 1 |
@gregnwosu, indeed you were right; there was trailing whitespace in this gist (likely from copying the code from a terminal emulator). I've removed it. Thanks for pointing this out and sorry it took me so long to realize it!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@gregnwosu, could you describe more precisely the behavior you were seeing? I've had no trouble using this script with bash 4.3.30.