Commit d0a57968 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Make absoluteInstallDirs only take the package id

It doesn't need the entire PackageDescription
parent 8e513352
......@@ -23,7 +23,7 @@ import Distribution.System
import Distribution.Simple.Compiler
( CompilerFlavor(..), compilerFlavor, compilerVersion )
import Distribution.Package
( packageName, packageVersion )
( packageId, packageName, packageVersion )
import Distribution.PackageDescription
( PackageDescription(..), hasLibs )
import Distribution.Simple.LocalBuildInfo
......@@ -128,14 +128,14 @@ generate pkg_descr lbi =
libdir = flat_libdir,
datadir = flat_datadir,
libexecdir = flat_libexecdir
} = absoluteInstallDirs pkg_descr lbi NoCopyDest
} = absoluteInstallDirs (packageId pkg_descr) lbi NoCopyDest
InstallDirs {
bindir = flat_bindirrel,
libdir = flat_libdirrel,
datadir = flat_datadirrel,
libexecdir = flat_libexecdirrel,
progdir = flat_progdirrel
} = prefixRelativeInstallDirs pkg_descr lbi
} = prefixRelativeInstallDirs (packageId pkg_descr) lbi
mkGetDir _ (Just dirrel) = "getPrefixDirRel " ++ show dirrel
mkGetDir dir Nothing = "return " ++ show dir
......
......@@ -437,8 +437,8 @@ configure (pkg_descr0, pbi) cfg
progSuffix = fromFlag $ configProgSuffix cfg
}
let dirs = absoluteInstallDirs pkg_descr lbi NoCopyDest
relative = prefixRelativeInstallDirs pkg_descr lbi
let dirs = absoluteInstallDirs (packageId pkg_descr) lbi NoCopyDest
relative = prefixRelativeInstallDirs (packageId pkg_descr) lbi
unless (isAbsolute (prefix dirs)) $ die $
"expected an absolute directory name for --prefix: " ++ prefix dirs
......
......@@ -96,10 +96,10 @@ install pkg_descr lbi flags = do
htmldir = htmlPref,
haddockdir = interfacePref,
includedir = incPref})
= absoluteInstallDirs pkg_descr lbi copydest
= absoluteInstallDirs (packageId pkg_descr) lbi copydest
progPrefixPref = substPathTemplate pkg_descr lbi (progPrefix lbi)
progSuffixPref = substPathTemplate pkg_descr lbi (progSuffix lbi)
progPrefixPref = substPathTemplate (packageId pkg_descr) lbi (progPrefix lbi)
progSuffixPref = substPathTemplate (packageId pkg_descr) lbi (progSuffix lbi)
docExists <- doesDirectoryExist $ haddockPref distPref pkg_descr
info verbosity ("directory " ++ haddockPref distPref pkg_descr ++
......@@ -154,7 +154,7 @@ install pkg_descr lbi flags = do
JHC -> do withLib pkg_descr $ JHC.installLib verbosity libPref buildPref pkg_descr
withExe pkg_descr $ JHC.installExe verbosity binPref buildPref (progPrefixPref, progSuffixPref) pkg_descr
Hugs -> do
let targetProgPref = progdir (absoluteInstallDirs pkg_descr lbi NoCopyDest)
let targetProgPref = progdir (absoluteInstallDirs (packageId pkg_descr) lbi NoCopyDest)
let scratchPref = scratchDir lbi
Hugs.install verbosity libPref progPref binPref targetProgPref scratchPref (progPrefixPref, progSuffixPref) pkg_descr
NHC -> do withLib pkg_descr $ NHC.installLib verbosity libPref buildPref (packageId pkg_descr)
......
......@@ -61,7 +61,7 @@ import qualified Distribution.Simple.InstallDirs as InstallDirs
import Distribution.Simple.Setup (CopyDest(..))
import Distribution.Simple.Program (ProgramConfiguration)
import Distribution.PackageDescription (PackageDescription(..))
import Distribution.Package (PackageIdentifier, Package(..))
import Distribution.Package (PackageId, Package(..))
import Distribution.Simple.Compiler
( Compiler(..), PackageDB, OptimisationLevel )
import Distribution.Simple.PackageIndex (PackageIndex)
......@@ -80,7 +80,7 @@ data LocalBuildInfo = LocalBuildInfo {
scratchDir :: FilePath,
-- ^ Where to put the result of the Hugs build.
--TODO: eliminate packageDeps field
packageDeps :: [PackageIdentifier],
packageDeps :: [PackageId],
-- ^ External package dependencies for the package as a whole,
-- the union of the individual 'targetPackageDeps'.
-- The 'Distribution.PackageDescription.PackageDescription'
......@@ -112,24 +112,24 @@ data LocalBuildInfo = LocalBuildInfo {
} deriving (Read, Show)
data ComponentLocalBuildInfo = ComponentLocalBuildInfo {
componentPackageDeps :: [PackageIdentifier]
componentPackageDeps :: [PackageId]
} deriving (Read, Show)
-- -----------------------------------------------------------------------------
-- Wrappers for a couple functions from InstallDirs
-- |See 'InstallDirs.absoluteInstallDirs'
absoluteInstallDirs :: PackageDescription -> LocalBuildInfo -> CopyDest
absoluteInstallDirs :: PackageId -> LocalBuildInfo -> CopyDest
-> InstallDirs FilePath
absoluteInstallDirs pkg_descr lbi copydest =
absoluteInstallDirs pkgid lbi copydest =
InstallDirs.absoluteInstallDirs
(packageId pkg_descr)
pkgid
(compilerId (compiler lbi))
copydest
(installDirTemplates lbi)
-- |See 'InstallDirs.prefixRelativeInstallDirs'
prefixRelativeInstallDirs :: PackageDescription -> LocalBuildInfo
prefixRelativeInstallDirs :: PackageId -> LocalBuildInfo
-> InstallDirs (Maybe FilePath)
prefixRelativeInstallDirs pkg_descr lbi =
InstallDirs.prefixRelativeInstallDirs
......@@ -137,10 +137,10 @@ prefixRelativeInstallDirs pkg_descr lbi =
(compilerId (compiler lbi))
(installDirTemplates lbi)
substPathTemplate :: PackageDescription -> LocalBuildInfo
substPathTemplate :: PackageId -> LocalBuildInfo
-> PathTemplate -> FilePath
substPathTemplate pkg_descr lbi = fromPathTemplate
substPathTemplate pkgid lbi = fromPathTemplate
. ( InstallDirs.substPathTemplate env )
where env = initialPathTemplateEnv
(packageId pkg_descr)
pkgid
(compilerId (compiler lbi))
......@@ -199,7 +199,7 @@ register pkg_descr lbi regFlags
Hugs -> do
when inplace $ die "--inplace is not supported with Hugs"
let installDirs = absoluteInstallDirs pkg_descr lbi NoCopyDest
let installDirs = absoluteInstallDirs (packageId pkg_descr) lbi NoCopyDest
createDirectoryIfMissingVerbose verbosity True (libdir installDirs)
installOrdinaryFile verbosity (installedPkgConfigFile distPref)
(libdir installDirs </> "package.conf")
......@@ -261,8 +261,8 @@ mkInstalledPackageInfo distPref pkg_descr lbi inplace = do
lib = fromJust (library pkg_descr) -- checked for Nothing earlier
bi = libBuildInfo lib
build_dir = pwd </> buildDir lbi
installDirs = absoluteInstallDirs pkg_descr lbi NoCopyDest
inplaceDirs = (absoluteInstallDirs pkg_descr lbi NoCopyDest) {
installDirs = absoluteInstallDirs (packageId pkg_descr) lbi NoCopyDest
inplaceDirs = (absoluteInstallDirs (packageId pkg_descr) lbi NoCopyDest) {
datadir = pwd,
datasubdir = distPref,
docdir = inplaceDocdir,
......@@ -335,7 +335,7 @@ unregister pkg_descr lbi regFlags = do
let genScript = fromFlag (regGenScript regFlags)
verbosity = fromFlag (regVerbosity regFlags)
packageDB = fromFlagOrDefault (withPackageDB lbi) (regPackageDB regFlags)
installDirs = absoluteInstallDirs pkg_descr lbi NoCopyDest
installDirs = absoluteInstallDirs (packageId pkg_descr) lbi NoCopyDest
setupMessage verbosity "Unregistering" (packageId pkg_descr)
case compilerFlavor (compiler lbi) of
GHC -> do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment