[commit: ghc] wip/angerman/llvmng: Adds binary-dist support (dfa2ec7)

git at git.haskell.org git at git.haskell.org
Sat Nov 11 13:08:09 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/angerman/llvmng
Link       : http://ghc.haskell.org/trac/ghc/changeset/dfa2ec73bb4b81ea6b1fe300a0b12c84d5382aa0/ghc

>---------------------------------------------------------------

commit dfa2ec73bb4b81ea6b1fe300a0b12c84d5382aa0
Author: Moritz Angermann <moritz.angermann at gmail.com>
Date:   Sat Nov 11 21:07:43 2017 +0800

    Adds binary-dist support


>---------------------------------------------------------------

dfa2ec73bb4b81ea6b1fe300a0b12c84d5382aa0
 hadrian/src/Builder.hs |  2 +-
 hadrian/src/Rules.hs   | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/hadrian/src/Builder.hs b/hadrian/src/Builder.hs
index 103ec98..7f5ac9d 100644
--- a/hadrian/src/Builder.hs
+++ b/hadrian/src/Builder.hs
@@ -235,7 +235,7 @@ instance H.Builder Builder where
                     Stdout pkgDesc <- cmd [path] ["--expand-pkgroot", "--no-user-package-db", "describe", input ]
                     cmd (Stdin pkgDesc) [path] (buildArgs ++ ["-"])
 
-                _  -> cmd echo [path] buildArgs
+                _  -> cmd echo [path] buildOptions buildArgs
 
 -- TODO: Some builders are required only on certain platforms. For example,
 -- 'Objdump' is only required on OpenBSD and AIX. Add support for platform
diff --git a/hadrian/src/Rules.hs b/hadrian/src/Rules.hs
index e7b2ae6..5fc03d8 100644
--- a/hadrian/src/Rules.hs
+++ b/hadrian/src/Rules.hs
@@ -22,6 +22,9 @@ import Settings
 import Target
 import Utilities
 
+import System.Directory (getCurrentDirectory)
+
+import Oracles.Setting
 
 allStages :: [Stage]
 allStages = [minBound .. maxBound]
@@ -30,6 +33,22 @@ allStages = [minBound .. maxBound]
 -- 'Stage1Only' flag.
 topLevelTargets :: Rules ()
 topLevelTargets = do
+    phony "binary-dist" $ do
+      -- This is kind of incorrect.  We should not "need" a phony rule.
+      -- Instead we should *need* the libraries and bianries we want to
+      -- put into the bianry distribution.  For now we will just *need*
+      -- stage2 and package up bin and lib.
+      need ["stage2"]
+      version <- setting ProjectVersion
+      cwd <- liftIO $ getCurrentDirectory
+      binDistDir <- getEnvWithDefault cwd "BINARY_DIST_DIR"
+      baseDir <- buildRoot <&> (-/- stageString Stage1)
+      buildWithCmdOptions [Cwd baseDir] $
+        -- ghc is a fake packge here.
+        target (vanillaContext Stage1 ghc) (Tar Create)
+               ["bin", "lib"]
+               [binDistDir -/- "ghc-" ++ version ++ ".tar.xz"]
+
     phony "stage2" $ do
       putNormal "Building stage2"
       need =<< mapM (f Stage1) =<< stagePackages Stage1



More information about the ghc-commits mailing list