Commit 61264556 authored by Matthew Pickering's avatar Matthew Pickering Committed by Marge Bot

Hadrian: Make libsuf and distDir stage aware

The version suffix needs to be the version of the stage 0 compiler
when building shared libraries with the stage 0 compiler.
parent b2322310
......@@ -52,9 +52,9 @@ libPath Context {..} = buildRoot <&> (-/- (stageString stage -/- "lib"))
--
-- We preform some renaming to accomodate Cabal's slightly different naming
-- conventions (see 'cabalOsString' and 'cabalArchString').
distDir :: Action FilePath
distDir = do
version <- setting ProjectVersion
distDir :: Stage -> Action FilePath
distDir st = do
version <- ghcVersionStage st
hostOs <- cabalOsString <$> setting BuildOs
hostArch <- cabalArchString <$> setting BuildArch
return $ hostArch ++ "-" ++ hostOs ++ "-ghc-" ++ version
......@@ -85,7 +85,7 @@ pkgHaddockFile Context {..} = do
-- @_build/stage1/libraries/array/build/libHSarray-0.5.1.0.a@.
pkgLibraryFile :: Context -> Action FilePath
pkgLibraryFile context@Context {..} = do
extension <- libsuf way
extension <- libsuf stage way
pkgFile context "libHS" extension
-- | Path to the GHCi library file of a given 'Context', e.g.:
......
......@@ -210,6 +210,10 @@ ghcCanonVersion = do
topDirectory :: Action FilePath
topDirectory = fixAbsolutePathOnWindows =<< setting GhcSourcePath
ghcVersionStage :: Stage -> Action String
ghcVersionStage Stage0 = setting GhcVersion
ghcVersionStage _ = setting ProjectVersion
-- | The file suffix used for libraries of a given build 'Way'. For example,
-- @_p.a@ corresponds to a static profiled library, and @-ghc7.11.20141222.so@
-- is a dynamic vanilly library. Why do we need GHC version number in the
......@@ -219,11 +223,11 @@ topDirectory = fixAbsolutePathOnWindows =<< setting GhcSourcePath
-- live in their own per-package directory and hence do not need a unique
-- filename. We also need to respect the system's dynamic extension, e.g. @.dll@
-- or @.so@.
libsuf :: Way -> Action String
libsuf way
libsuf :: Stage -> Way -> Action String
libsuf st way
| not (wayUnit Dynamic way) = return (waySuffix way ++ ".a") -- e.g., _p.a
| otherwise = do
extension <- setting DynamicExtension -- e.g., .dll or .so
version <- setting ProjectVersion -- e.g., 7.11.20141222
version <- ghcVersionStage st -- e.g. 8.4.4 or 8.9.xxxx
let suffix = waySuffix (removeWayUnit Dynamic way)
return (suffix ++ "-ghc" ++ version ++ extension)
......@@ -98,7 +98,7 @@ bindistRules = do
version <- setting ProjectVersion
targetPlatform <- setting TargetPlatformFull
distDir <- Context.distDir
distDir <- Context.distDir Stage1
rtsDir <- pkgIdentifier rts
windows <- windowsHost
......
......@@ -60,7 +60,7 @@ libffiLibrary = "inst/lib/libffi.a"
rtsLibffiLibrary :: Stage -> Way -> Action FilePath
rtsLibffiLibrary stage way = do
name <- libffiLibraryName
suf <- libsuf way
suf <- libsuf stage way
rtsPath <- rtsBuildPath stage
return $ rtsPath -/- "lib" ++ name ++ suf
......
......@@ -53,7 +53,8 @@ ghcLinkArgs = builder (Ghc LinkHs) ? do
originPath <- dropFileName <$> getOutput
context <- getContext
libPath' <- expr (libPath context)
distDir <- expr Context.distDir
st <- getStage
distDir <- expr (Context.distDir st)
useSystemFfi <- expr (flag UseSystemFfi)
buildPath <- getBuildPath
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment