summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-08-13 17:34:52 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-08-23 13:34:16 -0400
commit27c27f7d8fed00d435f6bcad17fa47e85a442235 (patch)
tree7bd2a2a25fb0414df5964e08112548bab3194a02
parent69fb6f6ad16e9d8ee3de18f27b6503b470e2d805 (diff)
downloadhaskell-27c27f7d8fed00d435f6bcad17fa47e85a442235.tar.gz
hadrian: Include runhaskell in bindist
Fixes #19571 bin folder now containers/ ``` ghc ghc-iserv-dyn-9.3.20210813 hp2ps hsc2hs-0.68.8 unlit ghc-9.3.20210813 ghc-pkg hp2ps-0.1 runghc unlit-0.1 ghc-iserv ghc-pkg-9.3.20210813 hpc runghc-9.3.20210813 ghc-iserv-9.3.20210813 haddock hpc-0.68 runhaskell ghc-iserv-dyn haddock-2.24.0 hsc2hs runhaskell-9.3.20210813 ``` which installed via wrappers looks like ``` lrwxrwxrwx 1 matt users 16 Aug 13 17:32 ghc -> ghc-9.3.20210813 -rwxr-xr-x 1 matt users 446 Aug 13 17:32 ghc-9.3.20210813 lrwxrwxrwx 1 matt users 17 Aug 13 17:32 ghci -> ghci-9.3.20210813 -rwxr-xr-x 1 matt users 480 Aug 13 17:32 ghci-9.3.20210813 lrwxrwxrwx 1 matt users 20 Aug 13 17:32 ghc-pkg -> ghc-pkg-9.3.20210813 -rwxr-xr-x 1 matt users 506 Aug 13 17:32 ghc-pkg-9.3.20210813 lrwxrwxrwx 1 matt users 14 Aug 13 17:32 haddock -> haddock-2.24.0 -rwxr-xr-x 1 matt users 454 Aug 13 17:32 haddock-2.24.0 lrwxrwxrwx 1 matt users 9 Aug 13 17:32 hp2ps -> hp2ps-0.1 -rwxr-xr-x 1 matt users 420 Aug 13 17:32 hp2ps-0.1 lrwxrwxrwx 1 matt users 8 Aug 13 17:32 hpc -> hpc-0.68 -rwxr-xr-x 1 matt users 418 Aug 13 17:32 hpc-0.68 lrwxrwxrwx 1 matt users 13 Aug 13 17:32 hsc2hs -> hsc2hs-0.68.8 -rwxr-xr-x 1 matt users 1.2K Aug 13 17:32 hsc2hs-0.68.8 lrwxrwxrwx 1 matt users 19 Aug 13 17:32 runghc -> runghc-9.3.20210813 -rwxr-xr-x 1 matt users 457 Aug 13 17:32 runghc-9.3.20210813 lrwxrwxrwx 1 matt users 23 Aug 13 17:32 runhaskell -> runhaskell-9.3.20210813 -rwxr-xr-x 1 matt users 465 Aug 13 17:32 runhaskell-9.3.20210813 ```
-rw-r--r--hadrian/src/Rules/BinaryDist.hs27
1 files changed, 25 insertions, 2 deletions
diff --git a/hadrian/src/Rules/BinaryDist.hs b/hadrian/src/Rules/BinaryDist.hs
index 6c6535fcc3..6d812cefad 100644
--- a/hadrian/src/Rules/BinaryDist.hs
+++ b/hadrian/src/Rules/BinaryDist.hs
@@ -148,7 +148,7 @@ bindistRules = do
createDirectory (bindistFilesDir -/- "bin")
createDirectory (bindistFilesDir -/- "lib")
-- Also create wrappers with version suffixes (#20074)
- forM_ (bin_targets ++ iserv_targets) $ \(_pkg, prog_path, ver) -> do
+ forM_ (bin_targets ++ iserv_targets) $ \(pkg, prog_path, ver) -> do
let orig_filename = takeFileName prog_path
(name, ext) = splitExtensions orig_filename
version_prog = name ++ "-" ++ ver ++ ext
@@ -168,6 +168,27 @@ bindistRules = do
-- we need to create a relative symlink.
IO.removeFile unversioned_install_path <|> return ()
IO.createFileLink version_prog unversioned_install_path
+
+ -- If we have runghc, also need runhaskell (#19571)
+ -- Make links for both versioned and unversioned runhaskell to
+ -- normal runghc
+ when (pkg == runGhc) $ do
+ let unversioned_runhaskell_path =
+ bindistFilesDir -/- "bin" -/- "runhaskell" ++ ext
+ versioned_runhaskell_path =
+ bindistFilesDir -/- "bin" -/- "runhaskell" ++ "-" ++ ver ++ ext
+ if windowsHost
+ then do
+ createVersionWrapper version_prog unversioned_runhaskell_path
+ createVersionWrapper version_prog versioned_runhaskell_path
+ else liftIO $ do
+ -- Unversioned
+ IO.removeFile unversioned_runhaskell_path <|> return ()
+ IO.createFileLink version_prog unversioned_runhaskell_path
+ -- Versioned
+ IO.removeFile versioned_runhaskell_path <|> return ()
+ IO.createFileLink version_prog versioned_runhaskell_path
+
copyDirectory (ghcBuildDir -/- "lib") bindistFilesDir
copyDirectory (rtsIncludeDir) bindistFilesDir
@@ -319,9 +340,10 @@ pkgToWrappers :: Package -> Action [String]
pkgToWrappers pkg
-- ghc also has the ghci script wrapper
| pkg == ghc = pure ["ghc", "ghci"]
+ | pkg == runGhc = pure ["runghc", "runhaskell"]
-- These are the packages which we want to expose to the user and hence
-- there are wrappers installed in the bindist.
- | pkg `elem` [hpcBin, haddock, hp2ps, hsc2hs, runGhc, ghc, ghcPkg]
+ | pkg `elem` [hpcBin, haddock, hp2ps, hsc2hs, ghc, ghcPkg]
= (:[]) <$> (programName =<< programContext Stage1 pkg)
| otherwise = pure []
@@ -333,6 +355,7 @@ wrapper "ghci" = ghciScriptWrapper
wrapper "haddock" = haddockWrapper
wrapper "hsc2hs" = hsc2hsWrapper
wrapper "runghc" = runGhcWrapper
+wrapper "runhaskell" = runGhcWrapper
wrapper _ = commonWrapper
-- | Wrapper scripts for different programs. Common is default wrapper.