[commit: hadrian] master: Preliminary bindist rule (#555) (1579730)

git at git.haskell.org git at git.haskell.org
Wed Apr 25 23:20:36 UTC 2018


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

On branch  : master
Link       : http://git.haskell.org/hadrian.git/commitdiff/15797302751614fba8da15f59de588be7841dd27

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

commit 15797302751614fba8da15f59de588be7841dd27
Author: Alp Mestanogullari <alpmestan at gmail.com>
Date:   Tue Apr 3 18:22:55 2018 +0200

    Preliminary bindist rule (#555)
    
    * Preliminary bindist rule
    
    For now, we only ship `<build root>/{bin, lib}` and the few make build system
    related files that are needed to support a simple
    
    ```
    ./configure [--prefix=PATH] && make install
    ```
    
    workflow. The current binary distributions of GHC support a wider range
    of parameters, but I figured it would be a good thing to start with this
    and enhance it as we all see fit and perhaps using feedback from GHC HQ
    (@bgamari in particular) and bindist users.
    
    * document binary distribution rule in README
    
    * sdist-ghc -> source-dist, Rules.Bindist -> Rules.BinaryDist


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

15797302751614fba8da15f59de588be7841dd27
 README.md               | 13 ++++++++++++-
 cfg/system.config.in    |  1 +
 hadrian.cabal           |  1 +
 src/Builder.hs          |  4 ++++
 src/Builder.hs-boot     |  1 +
 src/Rules.hs            |  6 ++++--
 src/Rules/SourceDist.hs |  2 +-
 7 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index 620d405..2509dae 100644
--- a/README.md
+++ b/README.md
@@ -125,7 +125,18 @@ are currently not supported.
 
 #### Source distribution
 
-To build a GHC source distribution tarball, run `build sdist-ghc`.
+To build a GHC source distribution tarball, run `build source-dist`.
+
+#### Binary distribution
+
+To build a GHC binary distribution, run `build binary-dist`. The resulting
+tarball contains just enough to support the
+
+``` sh
+$ ./configure [--prefix=PATH] && make install
+```
+
+workflow, for now.
 
 #### Testing
 
diff --git a/cfg/system.config.in b/cfg/system.config.in
index c983ae4..72bef12 100644
--- a/cfg/system.config.in
+++ b/cfg/system.config.in
@@ -7,6 +7,7 @@
 
 alex           = @AlexCmd@
 ar             = @ArCmd@
+autoreconf     = autoreconf
 cc             = @CC@
 happy          = @HappyCmd@
 hs-cpp         = @HaskellCPPCmd@
diff --git a/hadrian.cabal b/hadrian.cabal
index 486148f..ca339fb 100644
--- a/hadrian.cabal
+++ b/hadrian.cabal
@@ -51,6 +51,7 @@ executable hadrian
                        , Oracles.Setting
                        , Oracles.ModuleFiles
                        , Rules
+                       , Rules.BinaryDist
                        , Rules.Clean
                        , Rules.Compile
                        , Rules.Configure
diff --git a/src/Builder.hs b/src/Builder.hs
index 5ca6c20..0fb8be5 100644
--- a/src/Builder.hs
+++ b/src/Builder.hs
@@ -89,6 +89,7 @@ instance NFData   HaddockMode
 -- @GhcPkg Stage1@ is the one built in Stage0.
 data Builder = Alex
              | Ar ArMode Stage
+             | Autoreconf FilePath
              | DeriveConstants
              | Cc CcMode Stage
              | Configure FilePath
@@ -174,6 +175,7 @@ instance H.Builder Builder where
 
     runtimeDependencies :: Builder -> Action [FilePath]
     runtimeDependencies = \case
+        Autoreconf dir -> return [dir -/- "configure.ac"]
         Configure dir -> return [dir -/- "configure"]
 
         Ghc _ Stage0 -> return []
@@ -232,6 +234,7 @@ instance H.Builder Builder where
 
                 Ar Unpack _ -> cmd echo [Cwd output] [path] buildArgs
 
+                Autoreconf dir -> cmd echo [Cwd dir] [path] buildArgs
                 Configure dir -> do
                     -- Inject /bin/bash into `libtool`, instead of /bin/sh,
                     -- otherwise Windows breaks. TODO: Figure out why.
@@ -287,6 +290,7 @@ systemBuilderPath builder = case builder of
     Alex            -> fromKey "alex"
     Ar _ Stage0     -> fromKey "system-ar"
     Ar _ _          -> fromKey "ar"
+    Autoreconf _    -> fromKey "autoreconf"
     Cc  _  Stage0   -> fromKey "system-cc"
     Cc  _  _        -> fromKey "cc"
     -- We can't ask configure for the path to configure!
diff --git a/src/Builder.hs-boot b/src/Builder.hs-boot
index bd38891..1d10434 100644
--- a/src/Builder.hs-boot
+++ b/src/Builder.hs-boot
@@ -13,6 +13,7 @@ data HaddockMode = BuildPackage | BuildIndex
 
 data Builder = Alex
              | Ar ArMode Stage
+	     | Autoreconf FilePath
              | DeriveConstants
              | Cc CcMode Stage
              | Configure FilePath
diff --git a/src/Rules.hs b/src/Rules.hs
index 982d249..100720f 100644
--- a/src/Rules.hs
+++ b/src/Rules.hs
@@ -8,15 +8,16 @@ import qualified Hadrian.Oracles.TextFile
 import Expression
 import GHC
 import qualified Oracles.ModuleFiles
+import qualified Rules.BinaryDist
 import qualified Rules.Compile
-import qualified Rules.PackageData
+import qualified Rules.Configure
 import qualified Rules.Dependencies
 import qualified Rules.Documentation
 import qualified Rules.Generate
-import qualified Rules.Configure
 import qualified Rules.Gmp
 import qualified Rules.Libffi
 import qualified Rules.Library
+import qualified Rules.PackageData
 import qualified Rules.Program
 import qualified Rules.Register
 import Settings
@@ -122,6 +123,7 @@ packageRules = do
 
 buildRules :: Rules ()
 buildRules = do
+    Rules.BinaryDist.bindistRules
     Rules.Configure.configureRules
     Rules.Generate.copyRules
     Rules.Generate.generateRules
diff --git a/src/Rules/SourceDist.hs b/src/Rules/SourceDist.hs
index 6ef7929..8bec3f3 100644
--- a/src/Rules/SourceDist.hs
+++ b/src/Rules/SourceDist.hs
@@ -9,7 +9,7 @@ import Rules.Clean
 
 sourceDistRules :: Rules ()
 sourceDistRules = do
-    "sdist-ghc" ~> do
+    "source-dist" ~> do
         -- We clean the source tree first.
         -- See https://github.com/snowleopard/hadrian/issues/384.
         -- TODO: Do we still need to clean the tree?



More information about the ghc-commits mailing list