Commit 3e781503 authored by Edward Z. Yang's avatar Edward Z. Yang
Browse files

Undo backwards incompatible change to install paths.


Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
parent 2d0b9afd
......@@ -178,14 +178,14 @@ generate pkg_descr lbi clbi =
datadir = flat_datadir,
libexecdir = flat_libexecdir,
sysconfdir = flat_sysconfdir
} = absoluteInstallDirs pkg_descr lbi cid NoCopyDest
} = absoluteComponentInstallDirs pkg_descr lbi cid NoCopyDest
InstallDirs {
bindir = flat_bindirrel,
libdir = flat_libdirrel,
datadir = flat_datadirrel,
libexecdir = flat_libexecdirrel,
sysconfdir = flat_sysconfdirrel
} = prefixRelativeInstallDirs (packageId pkg_descr) lbi cid
} = prefixRelativeComponentInstallDirs (packageId pkg_descr) lbi cid
flat_bindirreloc = shortRelativePath flat_prefix flat_bindir
flat_libdirreloc = shortRelativePath flat_prefix flat_libdir
......
......@@ -649,8 +649,8 @@ configure (pkg_descr0', pbi) cfg = do
-- TODO: This is not entirely correct, because the dirs may vary
-- across libraries/executables
let dirs = absoluteInstallDirs pkg_descr lbi (localUnitId lbi) NoCopyDest
relative = prefixRelativeInstallDirs (packageId pkg_descr) lbi (localUnitId lbi)
let dirs = absoluteInstallDirs pkg_descr lbi NoCopyDest
relative = prefixRelativeInstallDirs (packageId pkg_descr) lbi
unless (isAbsolute (prefix dirs)) $ die $
"expected an absolute directory name for --prefix: " ++ prefix dirs
......@@ -2038,7 +2038,7 @@ checkRelocatable verbosity pkg lbi
-- NB: should be good enough to check this against the default
-- component ID, but if we wanted to be strictly correct we'd
-- check for each ComponentId.
installDirs = absoluteInstallDirs pkg lbi (localUnitId lbi) NoCopyDest
installDirs = absoluteInstallDirs pkg lbi NoCopyDest
p = prefix installDirs
relativeInstallDirs (InstallDirs {..}) =
all isJust
......@@ -2062,7 +2062,7 @@ checkRelocatable verbosity pkg lbi
-- NB: should be good enough to check this against the default
-- component ID, but if we wanted to be strictly correct we'd
-- check for each ComponentId.
installDirs = absoluteInstallDirs pkg lbi (localUnitId lbi) NoCopyDest
installDirs = absoluteInstallDirs pkg lbi NoCopyDest
p = prefix installDirs
ipkgs = PackageIndex.allPackages (installedPkgs lbi)
msg l = "Library directory of a dependency: " ++ show l ++
......
......@@ -651,7 +651,7 @@ buildOrReplLib forRepl verbosity numJobs pkg_descr lbi lib clbi = do
profileLibFilePath = libTargetDir </> mkProfLibName uid
sharedLibFilePath = libTargetDir </> mkSharedLibName compiler_id uid
ghciLibFilePath = libTargetDir </> Internal.mkGHCiLibName uid
libInstallPath = libdir $ absoluteInstallDirs pkg_descr lbi uid NoCopyDest
libInstallPath = libdir $ absoluteComponentInstallDirs pkg_descr lbi uid NoCopyDest
sharedLibInstallPath = libInstallPath </> mkSharedLibName compiler_id uid
stubObjs <- catMaybes <$> sequence
......
......@@ -74,9 +74,10 @@ install pkg_descr lbi flags = do
docdir = docPref,
htmldir = htmlPref,
haddockdir = interfacePref}
-- Notice use of localComponentId. This means for
-- non-library packages we'll just pick a nondescriptive foo-0.1
= absoluteInstallDirs pkg_descr lbi (localUnitId lbi) copydest
-- Notice use of 'absoluteInstallDirs' (not the
-- per-component variant). This means for non-library
-- packages we'll just pick a nondescriptive foo-0.1
= absoluteInstallDirs pkg_descr lbi copydest
unless (hasLibs pkg_descr || hasExes pkg_descr) $
die "No executables and no library found. Nothing to do."
......@@ -120,7 +121,7 @@ install pkg_descr lbi flags = do
let InstallDirs{
libdir = libPref,
includedir = incPref
} = absoluteInstallDirs pkg_descr lbi (componentUnitId clbi) copydest
} = absoluteComponentInstallDirs pkg_descr lbi (componentUnitId clbi) copydest
buildPref = libBuildDir lbi clbi
-- TODO: decide if we need the user to be able to control the libdir
-- for shared libs independently of the one for static libs. If so
......@@ -151,7 +152,7 @@ install pkg_descr lbi flags = do
withExeLBI pkg_descr lbi $ \exe clbi -> do
let installDirs@InstallDirs {
bindir = binPref
} = absoluteInstallDirs pkg_descr lbi (componentUnitId clbi) copydest
} = absoluteComponentInstallDirs pkg_descr lbi (componentUnitId clbi) copydest
-- the installers know how to find the actual location of the
-- binaries
buildPref = buildDir lbi
......
......@@ -62,6 +62,7 @@ module Distribution.Simple.LocalBuildInfo (
-- * Installation directories
module Distribution.Simple.InstallDirs,
absoluteInstallDirs, prefixRelativeInstallDirs,
absoluteComponentInstallDirs, prefixRelativeComponentInstallDirs,
substPathTemplate
) where
......@@ -511,7 +512,7 @@ depLibraryPaths :: Bool -- ^ Building for inplace?
-> IO [FilePath]
depLibraryPaths inplace relative lbi clbi = do
let pkgDescr = localPkgDescr lbi
installDirs = absoluteInstallDirs pkgDescr lbi (componentUnitId clbi) NoCopyDest
installDirs = absoluteComponentInstallDirs pkgDescr lbi (componentUnitId clbi) NoCopyDest
executable = case clbi of
ExeComponentLocalBuildInfo {} -> True
_ -> False
......@@ -529,7 +530,7 @@ depLibraryPaths inplace relative lbi clbi = do
lbi internalDeps ]
getLibDir sub_clbi
| inplace = libBuildDir lbi sub_clbi
| otherwise = libdir (absoluteInstallDirs pkgDescr lbi (componentUnitId sub_clbi) NoCopyDest)
| otherwise = libdir (absoluteComponentInstallDirs pkgDescr lbi (componentUnitId sub_clbi) NoCopyDest)
let ipkgs = allPackages (installedPkgs lbi)
allDepLibDirs = concatMap Installed.libraryDirs ipkgs
......@@ -562,12 +563,22 @@ depLibraryPaths inplace relative lbi clbi = do
-- -----------------------------------------------------------------------------
-- Wrappers for a couple functions from InstallDirs
-- |See 'InstallDirs.absoluteInstallDirs'
-- | Backwards compatibility function which computes the InstallDirs
-- assuming that @$libname@ points to the public library (or some fake
-- package identifier if there is no public library.) IF AT ALL
-- POSSIBLE, please use 'absoluteComponentInstallDirs' instead.
absoluteInstallDirs :: PackageDescription -> LocalBuildInfo
-> UnitId
-> CopyDest
-> InstallDirs FilePath
absoluteInstallDirs pkg lbi uid copydest =
absoluteInstallDirs pkg lbi copydest =
absoluteComponentInstallDirs pkg lbi (localUnitId lbi) copydest
-- | See 'InstallDirs.absoluteInstallDirs'.
absoluteComponentInstallDirs :: PackageDescription -> LocalBuildInfo
-> UnitId
-> CopyDest
-> InstallDirs FilePath
absoluteComponentInstallDirs pkg lbi uid copydest =
InstallDirs.absoluteInstallDirs
(packageId pkg)
uid
......@@ -576,11 +587,20 @@ absoluteInstallDirs pkg lbi uid copydest =
(hostPlatform lbi)
(installDirTemplates lbi)
-- |See 'InstallDirs.prefixRelativeInstallDirs'
-- | Backwards compatibility function which computes the InstallDirs
-- assuming that @$libname@ points to the public library (or some fake
-- package identifier if there is no public library.) IF AT ALL
-- POSSIBLE, please use 'prefixRelativeComponentInstallDirs' instead.
prefixRelativeInstallDirs :: PackageId -> LocalBuildInfo
-> UnitId
-> InstallDirs (Maybe FilePath)
prefixRelativeInstallDirs pkg_descr lbi uid =
prefixRelativeInstallDirs pkg_descr lbi =
prefixRelativeComponentInstallDirs pkg_descr lbi (localUnitId lbi)
-- |See 'InstallDirs.prefixRelativeInstallDirs'
prefixRelativeComponentInstallDirs :: PackageId -> LocalBuildInfo
-> UnitId
-> InstallDirs (Maybe FilePath)
prefixRelativeComponentInstallDirs pkg_descr lbi uid =
InstallDirs.prefixRelativeInstallDirs
(packageId pkg_descr)
uid
......
......@@ -385,7 +385,7 @@ inplaceInstalledPackageInfo inplaceDir distPref pkg abi_hash lib lbi clbi =
adjustRelativeIncludeDirs = map (inplaceDir </>)
libTargetDir = libBuildDir lbi clbi
installDirs =
(absoluteInstallDirs pkg lbi (componentUnitId clbi) NoCopyDest) {
(absoluteComponentInstallDirs pkg lbi (componentUnitId clbi) NoCopyDest) {
libdir = inplaceDir </> libTargetDir,
datadir = inplaceDir </> dataDir pkg,
docdir = inplaceDocdir,
......@@ -417,7 +417,7 @@ absoluteInstalledPackageInfo pkg abi_hash lib lbi clbi =
| null (installIncludes bi) = []
| otherwise = [includedir installDirs]
bi = libBuildInfo lib
installDirs = absoluteInstallDirs pkg lbi (componentUnitId clbi) NoCopyDest
installDirs = absoluteComponentInstallDirs pkg lbi (componentUnitId clbi) NoCopyDest
relocatableInstalledPackageInfo :: PackageDescription
......@@ -439,7 +439,7 @@ relocatableInstalledPackageInfo pkg abi_hash lib lbi clbi pkgroot =
bi = libBuildInfo lib
installDirs = fmap (("${pkgroot}" </>) . shortRelativePath pkgroot)
$ absoluteInstallDirs pkg lbi (componentUnitId clbi) NoCopyDest
$ absoluteComponentInstallDirs pkg lbi (componentUnitId clbi) NoCopyDest
-- -----------------------------------------------------------------------------
-- Unregistration
......
......@@ -7,7 +7,7 @@ import qualified PackageTests.TestStanza.Check
import qualified PackageTests.DeterministicAr.Check
import qualified PackageTests.TestSuiteTests.ExeV10.Check
import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(localPkgDescr, compiler), absoluteInstallDirs, InstallDirs(libdir), maybeGetComponentLocalBuildInfo, ComponentLocalBuildInfo(componentUnitId), ComponentName(CLibName))
import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(localPkgDescr, compiler), absoluteComponentInstallDirs, InstallDirs(libdir), maybeGetComponentLocalBuildInfo, ComponentLocalBuildInfo(componentUnitId), ComponentName(CLibName))
import Distribution.Simple.InstallDirs (CopyDest(NoCopyDest))
import Distribution.Simple.BuildPaths (mkLibName, mkSharedLibName)
import Distribution.Simple.Compiler (compilerId)
......@@ -340,7 +340,7 @@ tests config = do
cname = (CLibName "foo-internal")
Just clbi = maybeGetComponentLocalBuildInfo lbi cname
uid = componentUnitId clbi
dir = libdir (absoluteInstallDirs pkg_descr lbi uid NoCopyDest)
dir = libdir (absoluteComponentInstallDirs pkg_descr lbi uid NoCopyDest)
assertBool "interface files should NOT be installed" . not
=<< liftIO (doesFileExist (dir </> "Foo.hi"))
assertBool "static library should NOT be installed" . not
......
......@@ -10,7 +10,6 @@ import Distribution.Simple.InstallDirs ( mandir
)
import Distribution.Simple.LocalBuildInfo ( LocalBuildInfo(..)
, absoluteInstallDirs
, localUnitId
)
import Distribution.Simple.Utils ( copyFiles
, notice )
......@@ -50,7 +49,5 @@ buildManpage lbi verbosity = do
installManpage :: PackageDescription -> LocalBuildInfo -> Verbosity -> CopyDest -> IO ()
installManpage pkg lbi verbosity copy = do
-- NB: no library here, let's just use the default unit ID
-- (it shouldn't make a difference)
let destDir = mandir (absoluteInstallDirs pkg lbi (localUnitId lbi) copy) </> "man1"
let destDir = mandir (absoluteInstallDirs pkg lbi copy) </> "man1"
copyFiles verbosity destDir [(buildDir lbi </> "cabal", "cabal.1")]
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