<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="generator" content="Windows Mail 17.5.9600.20279">
<style><!--
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
}

p.MsoNormal, li.MsoNormal, div.MsoNormal {
margin:0in;
margin-bottom:.0001pt;
}

p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst, p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle, p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
line-height:115%;
}
--></style><style data-externalstyle="true"><!--
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
}
p.MsoNormal, li.MsoNormal, div.MsoNormal {
margin:0in;
margin-bottom:.0001pt;
}
p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst, 
p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle, 
p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
line-height:115%;
}
--></style>
</head>
<body dir="ltr">
<div data-externalstyle="false" dir="ltr" style="font-family: 'Calibri', 'Segoe UI', 'Meiryo', 'Microsoft YaHei UI', 'Microsoft JhengHei UI', 'Malgun Gothic', 'sans-serif';font-size:12pt;">
<div>I am trying to build GHC-HEAD and produce a reliable Dockerfile (see: docker.io) to allow others to use GHC-HEAD and also to make my own build process more reliable. I would like advice/assistance on two things to help this. For reference, I am using the
 stackbrew/ubuntu:13.10 image as my starting point, and bootstrapping GHC to HEAD using the current GHC (7.6.x) in Ubuntu's repositories.<br>
<br>
First issue: I am having issues with constraining the resource consumption during the build and have resorted to a few hacks such as replacing ld with gold (or rather, a script that filters out --hash-size arguments) and a custom build.mk file that uses -fasm
 for stage1. I would also like the final (stage 2?) result to be compiled with llvm, perhaps even without requiring gcc installed at all. How can I continue to push down the resource requirements of a build, and end up with a GHC that represents the bleeding
 edge? (That is what I want to be testing against, finding bugs for, etc.)</div>
<div dir="ltr">
<div style="font-family: "Calibri","Segoe UI","Meiryo","Microsoft YaHei UI","Microsoft JhengHei UI","Malgun Gothic","sans-serif"; font-size: 12pt;" dir="ltr">
<div><br>
</div>
<div>Here is my build.mk:</div>
<div><br>
</div>
<div>################## BUILD.MK</div>
<div><br>
</div>
<div># Default to a very fast build for compilation and stage1:<br>
SRC_HC_OPTS        = -H64m -O0<br>
GhcStage1HcOpts    = -O -fasm</div>
<div><br>
</div>
<div># But then use perf-llvm settings for remaining settings:</div>
<div><br>
</div>
<div>GhcStage2HcOpts = -O2 -fllvm<br>
GhcHcOpts       = -Rghc-timing<br>
GhcLibHcOpts    = -O2 -fllvm -XGenerics<br>
GhcLibWays     += p</div>
<div><br>
</div>
<div>DYNAMIC_BY_DEFAULT   = NO<br>
DYNAMIC_GHC_PROGRAMS = NO</div>
<div><br>
</div>
<div># Disable building all docs</div>
<div><br>
</div>
<div>HADDOCK_DOCS       = NO<br>
BUILD_DOCBOOK_HTML = NO<br>
BUILD_DOCBOOK_PS   = NO<br>
BUILD_DOCBOOK_PDF  = NO</div>
<div><br>
</div>
<div>################## BUILD.MK</div>
<div><br>
</div>
<div>Second issue: These seem to bring memory usage down, but the monolithic “.\make” command is difficult to debug and very time consuming. When building a container image from a Dockerfile, the commands used are cached so that subsequent attempted builds
 use the intermediate results. So, even though my Dockerfile starts out with “apt-get update; apt-get upgrade -y”, I don’t have to do that every time I retry my build.
</div>
<div><br>
</div>
<div>Currently my Dockerfile pulls all the requisite packages from Ubuntu’s repos, downloads and builds the latest cabal-install and builds alex, happy, hscolour and haddock, gets the ghc repo from GitHub, does “perl boot” “.\configure” and then I hit a wall
 with the monstrous amount of work that “.\make” does. I have tried splitting it up by doing “.\make stage=1”, “.\make 1”, and various combinations, but I hit dependency issues. Is there a way to break up the build into multiple commands?</div>
<div><br>
</div>
</div>
</div>
</div>
</body>
</html>