Skip to content

Commit

Permalink
Merge pull request #6055 from zw3rk/fix-datadir
Browse files Browse the repository at this point in the history
Fix datadir path in generated `Paths_` file
  • Loading branch information
JoshMeredith authored May 24, 2019
2 parents 27ef964 + 5f55491 commit 11047e4
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 15 deletions.
3 changes: 2 additions & 1 deletion Cabal/Distribution/Simple/Build/PathsModule.hs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ generate pkg_descr lbi clbi =
datadir = flat_datadir,
libexecdir = flat_libexecdir,
sysconfdir = flat_sysconfdir
} = absoluteComponentInstallDirs pkg_descr lbi cid NoCopyDest
} = absoluteInstallCommandDirs pkg_descr lbi cid NoCopyDest

InstallDirs {
bindir = flat_bindirrel,
libdir = flat_libdirrel,
Expand Down
17 changes: 3 additions & 14 deletions Cabal/Distribution/Simple/Install.hs
Original file line number Diff line number Diff line change
Expand Up @@ -97,21 +97,10 @@ copyPackage verbosity pkg_descr lbi distPref copydest = do
-- per-component (data files and Haddock files.)
InstallDirs {
datadir = dataPref,
-- NB: The situation with Haddock is a bit delicate. On the
-- one hand, the easiest to understand Haddock documentation
-- path is pkgname-0.1, which means it's per-package (not
-- per-component). But this means that it's impossible to
-- install Haddock documentation for internal libraries. We'll
-- keep this constraint for now; this means you can't use
-- Cabal to Haddock internal libraries. This does not seem
-- like a big problem.
docdir = docPref,
htmldir = htmlPref,
haddockdir = interfacePref}
-- 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
haddockdir = interfacePref
} = absoluteInstallCommandDirs pkg_descr lbi (localUnitId lbi) copydest

-- Install (package-global) data files
installDataFiles verbosity pkg_descr dataPref
Expand Down Expand Up @@ -161,7 +150,7 @@ copyComponent verbosity pkg_descr lbi (CLib lib) clbi copydest = do
libdir = libPref,
dynlibdir = dynlibPref,
includedir = incPref
} = absoluteComponentInstallDirs pkg_descr lbi (componentUnitId clbi) copydest
} = absoluteInstallCommandDirs pkg_descr lbi (componentUnitId clbi) copydest
buildPref = componentBuildDir lbi clbi

case libName lib of
Expand Down
29 changes: 29 additions & 0 deletions Cabal/Distribution/Simple/LocalBuildInfo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ module Distribution.Simple.LocalBuildInfo (
-- * Installation directories
module Distribution.Simple.InstallDirs,
absoluteInstallDirs, prefixRelativeInstallDirs,
absoluteInstallCommandDirs,
absoluteComponentInstallDirs, prefixRelativeComponentInstallDirs,
substPathTemplate,
) where
Expand Down Expand Up @@ -302,6 +303,34 @@ absoluteComponentInstallDirs pkg lbi uid copydest =
(hostPlatform lbi)
(installDirTemplates lbi)

absoluteInstallCommandDirs :: PackageDescription -> LocalBuildInfo
-> UnitId
-> CopyDest
-> InstallDirs FilePath
absoluteInstallCommandDirs pkg lbi uid copydest =
dirs {
-- Handle files which are not
-- per-component (data files and Haddock files.)
datadir = datadir dirs',
-- NB: The situation with Haddock is a bit delicate. On the
-- one hand, the easiest to understand Haddock documentation
-- path is pkgname-0.1, which means it's per-package (not
-- per-component). But this means that it's impossible to
-- install Haddock documentation for internal libraries. We'll
-- keep this constraint for now; this means you can't use
-- Cabal to Haddock internal libraries. This does not seem
-- like a big problem.
docdir = docdir dirs',
htmldir = htmldir dirs',
haddockdir = haddockdir dirs'
}
where
dirs = absoluteComponentInstallDirs pkg lbi uid 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
dirs' = absoluteInstallDirs pkg lbi copydest

-- | 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
Expand Down

0 comments on commit 11047e4

Please sign in to comment.