[commit: ghc] master: Hadrian: work around Cabal's/GHC's different Arch/OS strings (19ffddc)
git at git.haskell.org
git at git.haskell.org
Thu Nov 22 18:45:04 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/19ffddc1f479fcd5a0f265330cc1041366e8c43d/ghc
>---------------------------------------------------------------
commit 19ffddc1f479fcd5a0f265330cc1041366e8c43d
Author: Alec Theriault <alec.theriault at gmail.com>
Date: Thu Nov 22 11:47:27 2018 -0500
Hadrian: work around Cabal's/GHC's different Arch/OS strings
The path to the 'include' subdirectory of 'rts' includes a folder that
whose name is generated by Cabal and mentiones the architecture and OS.
For example:
_build/stage1/lib/x86_64-osx-ghc-8.7.20181120/rts-1.0/include
Hadrian needs to be aware that Cabal renders architectures and OSes in
a slightly different way than GHC. There is already symmetric logic in
Cabal (for working with GHC environment files, which follow GHC's naming
conventions).
Test Plan: ./hadrian/build.sh -c "binary-dist" # on mac
Reviewers: snowleopard, alpmestan, bgamari
Reviewed By: snowleopard
Subscribers: rwbarton, carter
GHC Trac Issues: #15922
Differential Revision: https://phabricator.haskell.org/D5361
>---------------------------------------------------------------
19ffddc1f479fcd5a0f265330cc1041366e8c43d
hadrian/src/Hadrian/Haskell/Cabal.hs | 20 +++++++++++++++++++-
hadrian/src/Rules/BinaryDist.hs | 6 +++---
2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/hadrian/src/Hadrian/Haskell/Cabal.hs b/hadrian/src/Hadrian/Haskell/Cabal.hs
index 327e6a0..91de7b2 100644
--- a/hadrian/src/Hadrian/Haskell/Cabal.hs
+++ b/hadrian/src/Hadrian/Haskell/Cabal.hs
@@ -11,7 +11,8 @@
-----------------------------------------------------------------------------
module Hadrian.Haskell.Cabal (
pkgVersion, pkgIdentifier, pkgSynopsis, pkgDescription, pkgDependencies,
- pkgGenericDescription
+ pkgGenericDescription,
+ cabalArchString, cabalOsString,
) where
import Development.Shake
@@ -54,3 +55,20 @@ pkgDependencies = fmap (map pkgName . packageDependencies) . readPackageData
-- file is tracked.
pkgGenericDescription :: Package -> Action GenericPackageDescription
pkgGenericDescription = fmap genericPackageDescription . readPackageData
+
+-- | Cabal's rendering of an architecture as used in its directory structure.
+--
+-- Inverse of 'Cabal.Distribution.Simple.GHC.ghcArchString'.
+cabalArchString :: String -> String
+cabalArchString "powerpc" = "ppc"
+cabalArchString "powerpc64" = "ppc64"
+cabalArchString other = other
+
+-- | Cabal's rendering of an OS as used in its directory structure.
+--
+-- Inverse of 'Cabal.Distribution.Simple.GHC.ghcOsString'.
+cabalOsString :: String -> String
+cabalOsString "mingw32" = "windows"
+cabalOsString "darwin" = "osx"
+cabalOsString "solaris2" = "solaris"
+cabalOsString other = other
diff --git a/hadrian/src/Rules/BinaryDist.hs b/hadrian/src/Rules/BinaryDist.hs
index f0aeb4b..667fbf1 100644
--- a/hadrian/src/Rules/BinaryDist.hs
+++ b/hadrian/src/Rules/BinaryDist.hs
@@ -19,14 +19,14 @@ bindistRules = do
need targets
version <- setting ProjectVersion
targetPlatform <- setting TargetPlatformFull
- hostOs <- setting BuildOs
- hostArch <- setting BuildArch
+ cabalHostOs <- cabalOsString <$> setting BuildOs
+ cabalHostArch <- cabalArchString <$> setting BuildArch
rtsDir <- pkgIdentifier rts
let ghcBuildDir = root -/- stageString Stage1
bindistFilesDir = root -/- "bindist" -/- ghcVersionPretty
ghcVersionPretty = "ghc-" ++ version ++ "-" ++ targetPlatform
- distDir = hostArch ++ "-" ++ hostOs ++ "-ghc-" ++ version
+ distDir = cabalHostArch ++ "-" ++ cabalHostOs ++ "-ghc-" ++ version
rtsIncludeDir = ghcBuildDir -/- "lib" -/- distDir -/- rtsDir
-/- "include"
More information about the ghc-commits
mailing list