diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2019-06-20 18:04:30 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-07-09 22:56:18 -0400 |
commit | 24782b89907ab36fb5aef3a17584f4c10f1e2690 (patch) | |
tree | b0d55f9b146f33fc901aa10b166a647aeded0c0e /compiler | |
parent | 0472f0f6a92395d478e9644c0dbd12948518099f (diff) | |
download | haskell-24782b89907ab36fb5aef3a17584f4c10f1e2690.tar.gz |
Deduplicate "unique subdir" code between GHC and Cabal
The code, including the generated module with the version, is now in
ghc-boot. Config.hs reexports stuff as needed, ghc-pkg doesn't need any
tricks at all.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/ghc.mk | 26 | ||||
-rw-r--r-- | compiler/main/DynFlags.hs | 12 |
2 files changed, 15 insertions, 23 deletions
diff --git a/compiler/ghc.mk b/compiler/ghc.mk index 1cd82d1635..4e0fb9095b 100644 --- a/compiler/ghc.mk +++ b/compiler/ghc.mk @@ -49,33 +49,33 @@ compiler/stage%/build/Config.hs : mk/config.mk mk/project.mk | $$(dir $$@)/. $(call removeFiles,$@) @echo 'Creating $@ ... ' @echo '{-# LANGUAGE CPP #-}' >> $@ - @echo 'module Config where' >> $@ + @echo 'module Config' >> $@ + @echo ' ( module GHC.Version' >> $@ + @echo ' , cBuildPlatformString' >> $@ + @echo ' , cHostPlatformString' >> $@ + @echo ' , cProjectName' >> $@ + @echo ' , cBooterVersion' >> $@ + @echo ' , cStage' >> $@ + @echo ' ) where' >> $@ @echo >> $@ @echo 'import GhcPrelude' >> $@ @echo >> $@ + @echo 'import GHC.Version' >> $@ + @echo >> $@ @echo '#include "ghc_boot_platform.h"' >> $@ @echo >> $@ @echo 'cBuildPlatformString :: String' >> $@ @echo 'cBuildPlatformString = BuildPlatform_NAME' >> $@ + @echo >> $@ @echo 'cHostPlatformString :: String' >> $@ @echo 'cHostPlatformString = HostPlatform_NAME' >> $@ @echo >> $@ @echo 'cProjectName :: String' >> $@ @echo 'cProjectName = "$(ProjectName)"' >> $@ - @echo 'cProjectGitCommitId :: String' >> $@ - @echo 'cProjectGitCommitId = "$(ProjectGitCommitId)"' >> $@ - @echo 'cProjectVersion :: String' >> $@ - @echo 'cProjectVersion = "$(ProjectVersion)"' >> $@ - @echo 'cProjectVersionInt :: String' >> $@ - @echo 'cProjectVersionInt = "$(ProjectVersionInt)"' >> $@ - @echo 'cProjectPatchLevel :: String' >> $@ - @echo 'cProjectPatchLevel = "$(ProjectPatchLevel)"' >> $@ - @echo 'cProjectPatchLevel1 :: String' >> $@ - @echo 'cProjectPatchLevel1 = "$(ProjectPatchLevel1)"' >> $@ - @echo 'cProjectPatchLevel2 :: String' >> $@ - @echo 'cProjectPatchLevel2 = "$(ProjectPatchLevel2)"' >> $@ + @echo >> $@ @echo 'cBooterVersion :: String' >> $@ @echo 'cBooterVersion = "$(GhcVersion)"' >> $@ + @echo >> $@ @echo 'cStage :: String' >> $@ @echo 'cStage = show (STAGE :: Int)' >> $@ @echo done. diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 2379f484e9..7009771aa4 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -250,6 +250,7 @@ module DynFlags ( import GhcPrelude import GHC.Platform +import GHC.UniqueSubdir (uniqueSubdir) import PlatformConstants import Module import PackageConfig @@ -1499,17 +1500,8 @@ versionedAppDir dflags = do appdir <- tryMaybeT $ getAppUserDataDirectory (programName dflags) return $ appdir </> versionedFilePath dflags --- | A filepath like @x86_64-linux-7.6.3@ with the platform string to use when --- constructing platform-version-dependent files that need to co-exist. --- versionedFilePath :: DynFlags -> FilePath -versionedFilePath dflags = intercalate "-" - [ stringEncodeArch $ platformArch $ targetPlatform dflags - , stringEncodeOS $ platformOS $ targetPlatform dflags - , projectVersion dflags - ] - -- NB: This functionality is reimplemented in Cabal, so if you - -- change it, be sure to update Cabal. +versionedFilePath dflags = uniqueSubdir $ targetPlatform dflags -- | The target code type of the compilation (if any). -- |