diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2019-03-10 17:34:42 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-03-12 09:04:52 -0400 |
commit | 61264556d5c817b55332a199b03fa1f559e92ee2 (patch) | |
tree | 3d192347a3e380aee62b93c806d8513fc4dd3cbd /hadrian | |
parent | b232231065f5e40ae3a6bd515bb42330cf484fcc (diff) | |
download | haskell-61264556d5c817b55332a199b03fa1f559e92ee2.tar.gz |
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.
Diffstat (limited to 'hadrian')
-rw-r--r-- | hadrian/src/Context.hs | 8 | ||||
-rw-r--r-- | hadrian/src/Oracles/Setting.hs | 10 | ||||
-rw-r--r-- | hadrian/src/Rules/BinaryDist.hs | 2 | ||||
-rw-r--r-- | hadrian/src/Rules/Libffi.hs | 2 | ||||
-rw-r--r-- | hadrian/src/Settings/Builders/Ghc.hs | 3 |
5 files changed, 15 insertions, 10 deletions
diff --git a/hadrian/src/Context.hs b/hadrian/src/Context.hs index f8a07d7263..4ecf1012f4 100644 --- a/hadrian/src/Context.hs +++ b/hadrian/src/Context.hs @@ -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.: diff --git a/hadrian/src/Oracles/Setting.hs b/hadrian/src/Oracles/Setting.hs index 02ac42e0c9..4666539f93 100644 --- a/hadrian/src/Oracles/Setting.hs +++ b/hadrian/src/Oracles/Setting.hs @@ -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) diff --git a/hadrian/src/Rules/BinaryDist.hs b/hadrian/src/Rules/BinaryDist.hs index 609766d5ca..610e668ce1 100644 --- a/hadrian/src/Rules/BinaryDist.hs +++ b/hadrian/src/Rules/BinaryDist.hs @@ -98,7 +98,7 @@ bindistRules = do version <- setting ProjectVersion targetPlatform <- setting TargetPlatformFull - distDir <- Context.distDir + distDir <- Context.distDir Stage1 rtsDir <- pkgIdentifier rts windows <- windowsHost diff --git a/hadrian/src/Rules/Libffi.hs b/hadrian/src/Rules/Libffi.hs index 5b25aab5ba..ddc739d735 100644 --- a/hadrian/src/Rules/Libffi.hs +++ b/hadrian/src/Rules/Libffi.hs @@ -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 diff --git a/hadrian/src/Settings/Builders/Ghc.hs b/hadrian/src/Settings/Builders/Ghc.hs index b952a017bc..7fb3082a51 100644 --- a/hadrian/src/Settings/Builders/Ghc.hs +++ b/hadrian/src/Settings/Builders/Ghc.hs @@ -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 |