diff options
author | John Ericson <git@JohnEricson.me> | 2019-07-12 12:04:08 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-10-04 21:45:48 -0400 |
commit | dd8f76b2e3285f8d01d652c8fa8c28e37ea474de (patch) | |
tree | ac82ccd6feac34e0ee962b0559395f05ffb93821 /utils/ghc-pkg | |
parent | b538476be3706264620c072e6e436debf9e0d3e4 (diff) | |
download | haskell-dd8f76b2e3285f8d01d652c8fa8c28e37ea474de.tar.gz |
Factor out a smaller part of Platform for host fallback
Diffstat (limited to 'utils/ghc-pkg')
-rw-r--r-- | utils/ghc-pkg/Main.hs | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs index 3f6c5bea3f..946ae72007 100644 --- a/utils/ghc-pkg/Main.hs +++ b/utils/ghc-pkg/Main.hs @@ -35,13 +35,9 @@ import GHC.PackageDb (BinaryStringRep(..)) import GHC.HandleEncoding import GHC.BaseDir (getBaseDir) import GHC.Settings (getTargetPlatform, maybeReadFuzzy) -import GHC.Platform - ( platformArch, platformOS - , stringEncodeArch, stringEncodeOS - ) -import GHC.UniqueSubdir - ( uniqueSubdir0 - ) +import GHC.Platform (platformMini) +import GHC.Platform.Host (cHostPlatformMini) +import GHC.UniqueSubdir (uniqueSubdir) import GHC.Version ( cProjectVersion ) import qualified Distribution.Simple.PackageIndex as PackageIndex import qualified Data.Graph as Graph @@ -642,11 +638,11 @@ getPkgDatabases verbosity mode use_user use_cache expand_vars my_flags = do -- See Note [Settings File] about this file, and why we need GHC to share it with us. let settingsFile = top_dir </> "settings" exists_settings_file <- doesFileExist settingsFile - (arch, os) <- case exists_settings_file of + targetPlatformMini <- case exists_settings_file of False -> do warn $ "WARNING: settings file doesn't exist " ++ show settingsFile warn "cannot know target platform so guessing target == host (native compiler)." - pure (HOST_ARCH, HOST_OS) + pure cHostPlatformMini True -> do settingsStr <- readFile settingsFile mySettings <- case maybeReadFuzzy settingsStr of @@ -655,9 +651,9 @@ getPkgDatabases verbosity mode use_user use_cache expand_vars my_flags = do -- least) but completely inexcusable to have a malformed one. Nothing -> die $ "Can't parse settings file " ++ show settingsFile case getTargetPlatform settingsFile mySettings of - Right platform -> pure (stringEncodeArch $ platformArch platform, stringEncodeOS $ platformOS platform) + Right platform -> pure $ platformMini platform Left e -> die e - let subdir = uniqueSubdir0 arch os + let subdir = uniqueSubdir targetPlatformMini dir = appdir </> subdir r <- lookForPackageDBIn dir case r of |