summaryrefslogtreecommitdiff
path: root/hadrian/src/Rules
diff options
context:
space:
mode:
authorAlp Mestanogullari <alp@well-typed.com>2020-05-28 08:07:26 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-05-29 01:42:36 -0400
commitf9a513e064bd8a33ad6f8aa5fb8673931507eca1 (patch)
tree212a36b1dcfd582a8bbd86dba6600e821e64880d /hadrian/src/Rules
parent998450f4c67e8f701455927c9619b8d53f2b733b (diff)
downloadhaskell-f9a513e064bd8a33ad6f8aa5fb8673931507eca1.tar.gz
hadrian: introduce 'install' target
Its logic is very simple. It `need`s the `binary-dist-dir` target and runs suitable `configure` and `make install` commands for the user. A new `--prefix` command line argument is introduced to specify where GHC should be installed.
Diffstat (limited to 'hadrian/src/Rules')
-rw-r--r--hadrian/src/Rules/BinaryDist.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/hadrian/src/Rules/BinaryDist.hs b/hadrian/src/Rules/BinaryDist.hs
index d52e0c847c..6b1bad005c 100644
--- a/hadrian/src/Rules/BinaryDist.hs
+++ b/hadrian/src/Rules/BinaryDist.hs
@@ -2,6 +2,7 @@ module Rules.BinaryDist where
import Hadrian.Haskell.Cabal
+import CommandLine
import Context
import Expression
import Oracles.Setting
@@ -98,6 +99,18 @@ other, the install script:
bindistRules :: Rules ()
bindistRules = do
root <- buildRootRules
+ phony "install" $ do
+ need ["binary-dist-dir"]
+ version <- setting ProjectVersion
+ targetPlatform <- setting TargetPlatformFull
+ let ghcVersionPretty = "ghc-" ++ version ++ "-" ++ targetPlatform
+ bindistFilesDir = root -/- "bindist" -/- ghcVersionPretty
+ prefixErr = "You must specify a path with --prefix when using the"
+ ++ " 'install' rule"
+ installPrefix <- fromMaybe (error prefixErr) <$> cmdPrefix
+ runBuilder (Configure bindistFilesDir) ["--prefix="++installPrefix] [] []
+ runBuilder (Make bindistFilesDir) ["install"] [] []
+
phony "binary-dist-dir" $ do
-- We 'need' all binaries and libraries
targets <- mapM pkgTarget =<< stagePackages Stage1