summaryrefslogtreecommitdiff
path: root/utils/ghc-pkg
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2019-06-20 18:04:30 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-07-09 22:56:18 -0400
commit24782b89907ab36fb5aef3a17584f4c10f1e2690 (patch)
treeb0d55f9b146f33fc901aa10b166a647aeded0c0e /utils/ghc-pkg
parent0472f0f6a92395d478e9644c0dbd12948518099f (diff)
downloadhaskell-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 'utils/ghc-pkg')
-rw-r--r--utils/ghc-pkg/Main.hs15
-rw-r--r--utils/ghc-pkg/ghc-pkg.cabal1
-rw-r--r--utils/ghc-pkg/ghc.mk13
3 files changed, 9 insertions, 20 deletions
diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs
index 0e28ce9353..bace7356cd 100644
--- a/utils/ghc-pkg/Main.hs
+++ b/utils/ghc-pkg/Main.hs
@@ -30,7 +30,6 @@
module Main (main) where
-import Version ( version )
import qualified GHC.PackageDb as GhcPkg
import GHC.PackageDb (BinaryStringRep(..))
import GHC.HandleEncoding
@@ -40,6 +39,10 @@ import GHC.Platform
( platformArch, platformOS
, stringEncodeArch, stringEncodeOS
)
+import GHC.UniqueSubdir
+ ( uniqueSubdir0
+ )
+import GHC.Version ( cProjectVersion )
import qualified Distribution.Simple.PackageIndex as PackageIndex
import qualified Data.Graph as Graph
import qualified Distribution.ModuleName as ModuleName
@@ -229,7 +232,7 @@ deprecFlags = [
]
ourCopyright :: String
-ourCopyright = "GHC package manager version " ++ Version.version ++ "\n"
+ourCopyright = "GHC package manager version " ++ GHC.Version.cProjectVersion ++ "\n"
shortUsage :: String -> String
shortUsage prog = "For usage information see '" ++ prog ++ " --help'."
@@ -654,7 +657,7 @@ getPkgDatabases verbosity mode use_user use_cache expand_vars my_flags = do
case getTargetPlatform settingsFile mySettings of
Right platform -> pure (stringEncodeArch $ platformArch platform, stringEncodeOS $ platformOS platform)
Left e -> die e
- let subdir = arch ++ '-':os ++ '-':Version.version
+ let subdir = uniqueSubdir0 arch os
dir = appdir </> subdir
r <- lookForPackageDBIn dir
case r of
@@ -2016,9 +2019,9 @@ checkHSLib :: Verbosity -> [String] -> String -> Validate ()
checkHSLib _verbosity dirs lib = do
let filenames = ["lib" ++ lib ++ ".a",
"lib" ++ lib ++ "_p.a",
- "lib" ++ lib ++ "-ghc" ++ Version.version ++ ".so",
- "lib" ++ lib ++ "-ghc" ++ Version.version ++ ".dylib",
- lib ++ "-ghc" ++ Version.version ++ ".dll"]
+ "lib" ++ lib ++ "-ghc" ++ GHC.Version.cProjectVersion ++ ".so",
+ "lib" ++ lib ++ "-ghc" ++ GHC.Version.cProjectVersion ++ ".dylib",
+ lib ++ "-ghc" ++ GHC.Version.cProjectVersion ++ ".dll"]
b <- liftIO $ doesFileExistOnPath filenames dirs
when (not b) $
verror ForceFiles ("cannot find any of " ++ show filenames ++
diff --git a/utils/ghc-pkg/ghc-pkg.cabal b/utils/ghc-pkg/ghc-pkg.cabal
index 4b1aae7631..13f47c0c3e 100644
--- a/utils/ghc-pkg/ghc-pkg.cabal
+++ b/utils/ghc-pkg/ghc-pkg.cabal
@@ -23,7 +23,6 @@ Flag terminfo
Executable ghc-pkg
Default-Language: Haskell2010
Main-Is: Main.hs
- Other-Modules: Version
Other-Extensions: CPP
Build-Depends: base >= 4 && < 5,
diff --git a/utils/ghc-pkg/ghc.mk b/utils/ghc-pkg/ghc.mk
index 32e18f490d..1ba38329d2 100644
--- a/utils/ghc-pkg/ghc.mk
+++ b/utils/ghc-pkg/ghc.mk
@@ -13,13 +13,6 @@
# -----------------------------------------------------------------------------
# Bootstrapping ghc-pkg
-utils/ghc-pkg/dist/build/Version.hs \
-utils/ghc-pkg/dist-install/build/Version.hs: mk/project.mk | $$(dir $$@)/.
- $(call removeFiles,$@)
- echo "module Version where" >> $@
- echo "version :: String" >> $@
- echo "version = \"$(ProjectVersion)\"" >> $@
-
utils/ghc-pkg_PACKAGE = ghc-pkg
# Note [Why build certain utils twice?]
@@ -72,9 +65,6 @@ $(eval $(call build-prog,utils/ghc-pkg,dist,0))
# is to specify global package db only.
$(ghc-pkg_INPLACE) : | $(INPLACE_PACKAGE_CONF)/. $(INPLACE_LIB)/settings
-utils/ghc-pkg/dist/package-data.mk: \
- utils/ghc-pkg/dist/build/Version.hs
-
# -----------------------------------------------------------------------------
# Build another copy of ghc-pkg with the stage1 compiler in the dist-install
# directory. Don't install it inplace (we use the dist copy there), but do
@@ -92,9 +82,6 @@ utils/ghc-pkg_dist-install_INSTALL = YES
utils/ghc-pkg_dist-install_INSTALL_SHELL_WRAPPER_NAME = ghc-pkg-$(ProjectVersion)
$(eval $(call build-prog,utils/ghc-pkg,dist-install,1))
-
-utils/ghc-pkg/dist-install/package-data.mk: \
- utils/ghc-pkg/dist-install/build/Version.hs
endif
# -----------------------------------------------------------------------------