Commit 4e782d65 authored by Edward Z. Yang's avatar Edward Z. Yang
Browse files

Use per-component install directories.


Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
parent 15dd8455
......@@ -1076,6 +1076,7 @@ elaborateInstallPlan platform compiler compilerprogdb
elabComponentDependencies = deps,
-- TODO: track dependencies on executables
elabComponentExeDependencies = [],
elabComponentInstallDirs = installDirs,
-- These are filled in later
elabComponentBuildTargets = [],
elabComponentReplTarget = Nothing,
......@@ -1104,6 +1105,28 @@ elaborateInstallPlan platform compiler compilerprogdb
, Just confid' <- [Map.lookup cdep internal_map] ]
deps = external_deps ++ internal_deps
installDirs
| shouldBuildInplaceOnly spkg
-- use the ordinary default install dirs
= (InstallDirs.absoluteInstallDirs
pkgid
(SimpleUnitId cid) -- differs!
(compilerInfo compiler)
InstallDirs.NoCopyDest
platform
defaultInstallDirs) {
InstallDirs.libsubdir = "", -- absoluteInstallDirs sets these as
InstallDirs.datasubdir = "" -- 'undefined' but we have to use
} -- them as "Setup.hs configure" args
| otherwise
-- use special simplified install dirs
= storePackageInstallDirs
cabalDirLayout
(compilerId compiler)
cid
elaborateSolverPackage :: (SolverId -> [ElaboratedPlanPackage])
-> SolverPackage UnresolvedPkgLoc
......@@ -2133,9 +2156,8 @@ setupHsConfigureFlags (ReadyPackage pkg_or_comp)
configProgPrefix = maybe mempty toFlag pkgProgPrefix
configProgSuffix = maybe mempty toFlag pkgProgSuffix
-- TODO: do this per-component
configInstallDirs = fmap (toFlag . InstallDirs.toPathTemplate)
pkgInstallDirs
(elabInstallDirs pkg_or_comp)
-- we only use configDependencies, unless we're talking to an old Cabal
-- in which case we use configConstraints
......
......@@ -140,9 +140,9 @@ elabDistDirParams shared (ElabComponent comp) = DistDirParams {
distParamPlatform = pkgConfigPlatform shared
}
-- TODO: give each component a separate install dir prefix
elabInstallDirs :: ElaboratedConfiguredPackage -> InstallDirs.InstallDirs FilePath
elabInstallDirs = pkgInstallDirs . getElaboratedPackage
elabInstallDirs (ElabPackage pkg) = pkgInstallDirs pkg
elabInstallDirs (ElabComponent comp) = elabComponentInstallDirs comp
elabRequiresRegistration :: ElaboratedConfiguredPackage -> Bool
elabRequiresRegistration (ElabPackage pkg) = pkgRequiresRegistration pkg
......@@ -216,9 +216,9 @@ data ElaboratedComponent
-- | Should we REPL this component (TRANSIENT, see 'pkgReplTarget')
elabComponentReplTarget :: Maybe SubComponentTarget,
-- | Should we Haddock this component (TRANSIENT, see 'pkgBuildHaddocks')
elabComponentBuildHaddocks :: Bool
-- NB: Careful, if you add elabComponentInstallDirs, need
-- to adjust 'packageHashInputs'!!!
elabComponentBuildHaddocks :: Bool,
-- | Where things should get installed to
elabComponentInstallDirs :: InstallDirs.InstallDirs FilePath
}
deriving (Eq, Show, Generic)
......
Supports Markdown
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