Commit a650e8da authored by Christiaan Baaij's avatar Christiaan Baaij

Setup correct package registration paths for relocatable packages

parent cf218c71
......@@ -28,6 +28,7 @@ module Distribution.Simple.InstallDirs (
CopyDest(..),
prefixRelativeInstallDirs,
substituteInstallDirTemplates,
substituteInstallDirTemplatesNP,
PathTemplate,
PathTemplateVariable(..),
......@@ -280,6 +281,42 @@ substituteInstallDirTemplates env dirs = dirs'
prefixBinLibVars = [prefixVar, bindirVar, libdirVar, libsubdirVar]
prefixBinLibDataVars = prefixBinLibVars ++ [datadirVar, datasubdirVar]
-- | Like 'substituteInstallDirTemplates', but does not allow substitution of
-- the 'prefix' variable
substituteInstallDirTemplatesNP :: PathTemplateEnv
-> InstallDirTemplates -> InstallDirTemplates
substituteInstallDirTemplatesNP env dirs = dirs'
where
dirs' = InstallDirs {
-- So this specifies exactly which vars are allowed in each template
prefix = subst prefix [],
bindir = subst bindir [],
libdir = subst libdir [bindirVar],
libsubdir = subst libsubdir [],
dynlibdir = subst dynlibdir [bindirVar, libdirVar],
libexecdir = subst libexecdir prefixBinLibVars,
includedir = subst includedir prefixBinLibVars,
datadir = subst datadir prefixBinLibVars,
datasubdir = subst datasubdir [],
docdir = subst docdir prefixBinLibDataVars,
mandir = subst mandir (prefixBinLibDataVars ++ [docdirVar]),
htmldir = subst htmldir (prefixBinLibDataVars ++ [docdirVar]),
haddockdir = subst haddockdir (prefixBinLibDataVars ++
[docdirVar, htmldirVar]),
sysconfdir = subst sysconfdir prefixBinLibVars
}
subst dir env' = substPathTemplate (env'++env) (dir dirs)
bindirVar = (BindirVar, bindir dirs')
libdirVar = (LibdirVar, libdir dirs')
libsubdirVar = (LibsubdirVar, libsubdir dirs')
datadirVar = (DatadirVar, datadir dirs')
datasubdirVar = (DatasubdirVar, datasubdir dirs')
docdirVar = (DocdirVar, docdir dirs')
htmldirVar = (HtmldirVar, htmldir dirs')
prefixBinLibVars = [bindirVar, libdirVar, libsubdirVar]
prefixBinLibDataVars = prefixBinLibVars ++ [datadirVar, datasubdirVar]
-- | Convert from abstract install directories to actual absolute ones by
-- substituting for all the variables in the abstract paths, to get real
-- absolute path.
......
......@@ -40,7 +40,7 @@ import Distribution.Simple.LocalBuildInfo
( LocalBuildInfo(..), ComponentLocalBuildInfo(..)
, ComponentName(..), getComponentLocalBuildInfo
, LibraryName(..)
, InstallDirs(..), absoluteInstallDirs )
, InstallDirs(..), absoluteInstallDirs, prefixRelativeInstallDirs )
import Distribution.Simple.BuildPaths (haddockName)
import qualified Distribution.Simple.GHC as GHC
import qualified Distribution.Simple.LHC as LHC
......@@ -84,7 +84,7 @@ import System.Directory
import Control.Monad (when)
import Data.Maybe
( isJust, fromMaybe, maybeToList )
( isJust, fromJust, fromMaybe, maybeToList )
import Data.List
( partition, nub )
import qualified Data.ByteString.Lazy.Char8 as BS.Char8
......@@ -394,14 +394,8 @@ relocatableInstalledPackageInfo pkg ipid lib lbi clbi =
| null (installIncludes bi) = []
| otherwise = [includedir installDirs]
bi = libBuildInfo lib
installDirs =
(absoluteInstallDirs pkg lbi NoCopyDest) {
libdir = "${pkgroot}" </> display (pkgKey lbi),
haddockdir = "${pkgroot}" </> ".." </> ".." </> "share" </> "doc" </>
"ghc" </> "html" </> "libraries" </> display (package pkg),
htmldir = "${pkgrooturl}/../../share/doc/ghc/html/libraries/" ++
display (package pkg)
}
installDirs = fmap (((("${pkgroot}" </> "..") </> "..") </>) . fromJust)
$ prefixRelativeInstallDirs (packageId pkg) lbi
-- -----------------------------------------------------------------------------
-- Unregistration
......
......@@ -1421,7 +1421,7 @@ installUnpackedPackage verbosity buildLimit installLock numJobs pkg_key
defInstallDirs <- InstallDirs.defaultInstallDirs flavor userInstall False
return $ configFlags' {
configInstallDirs = fmap Cabal.Flag .
InstallDirs.substituteInstallDirTemplates env $
InstallDirs.substituteInstallDirTemplatesNP env $
InstallDirs.combineInstallDirs fromFlagOrDefault
defInstallDirs (configInstallDirs configFlags)
}
......
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