Commit 4f93b63e authored by Daniel Gröber (dxld)'s avatar Daniel Gröber (dxld)

Add $libexecsubdir InstallDirs variable

parent 1340c21e
......@@ -85,6 +85,7 @@ data InstallDirs dir = InstallDirs {
dynlibdir :: dir,
flibdir :: dir, -- ^ foreign libraries
libexecdir :: dir,
libexecsubdir:: dir,
includedir :: dir,
datadir :: dir,
datasubdir :: dir,
......@@ -116,6 +117,7 @@ combineInstallDirs combine a b = InstallDirs {
dynlibdir = dynlibdir a `combine` dynlibdir b,
flibdir = flibdir a `combine` flibdir b,
libexecdir = libexecdir a `combine` libexecdir b,
libexecsubdir= libexecsubdir a `combine` libexecsubdir b,
includedir = includedir a `combine` includedir b,
datadir = datadir a `combine` datadir b,
datasubdir = datasubdir a `combine` datasubdir b,
......@@ -129,8 +131,10 @@ combineInstallDirs combine a b = InstallDirs {
appendSubdirs :: (a -> a -> a) -> InstallDirs a -> InstallDirs a
appendSubdirs append dirs = dirs {
libdir = libdir dirs `append` libsubdir dirs,
libexecdir = libexecdir dirs `append` libexecsubdir dirs,
datadir = datadir dirs `append` datasubdir dirs,
libsubdir = error "internal error InstallDirs.libsubdir",
libexecsubdir = error "internal error InstallDirs.libexecsubdir",
datasubdir = error "internal error InstallDirs.datasubdir"
}
......@@ -200,6 +204,7 @@ defaultInstallDirs' False comp userInstall _hasLibs = do
LHC -> "$compiler"
UHC -> "$pkgid"
_other -> "$abi",
libexecsubdir= "$abi" </> "$pkgid",
flibdir = "$libdir",
libexecdir = case buildOS of
Windows -> "$prefix" </> "$libname"
......@@ -244,6 +249,7 @@ substituteInstallDirTemplates env dirs = dirs'
dynlibdir = subst dynlibdir [prefixVar, bindirVar, libdirVar],
flibdir = subst flibdir [prefixVar, bindirVar, libdirVar],
libexecdir = subst libexecdir prefixBinLibVars,
libexecsubdir = subst libexecsubdir [],
includedir = subst includedir prefixBinLibVars,
datadir = subst datadir prefixBinLibVars,
datasubdir = subst datasubdir [],
......
......@@ -927,6 +927,11 @@ installDirsOptions =
libexecdir (\v flags -> flags { libexecdir = v })
installDirArg
, option "" ["libexecsubdir"]
"subdirectory of libexecdir in which private executables are installed"
libexecsubdir (\v flags -> flags { libexecsubdir = v })
installDirArg
, option "" ["datadir"]
"installation directory for read-only data"
datadir (\v flags -> flags { datadir = v })
......
......@@ -656,6 +656,14 @@ path options:
``$pkg``, ``$version``, ``$compiler``, ``$os``, ``$arch``, ``$abi``,
``$abitag``
.. option:: --libexecsubdir=dir
A subdirectory of *libexecdir* in which private executables are installed.
*dir* may contain the following path variables: ``$pkgid``,
``$pkg``, ``$version``, ``$compiler``, ``$os``, ``$arch``, ``$abi``,
``$abitag``
.. option:: --datasubdir=dir
A subdirectory of *datadir* in which data files are actually
......
......@@ -1420,9 +1420,12 @@ elaborateInstallPlan verbosity platform compiler compilerprogdb pkgConfigDB
platform
defaultInstallDirs) {
InstallDirs.libsubdir = "", -- absoluteInstallDirs sets these as
InstallDirs.datasubdir = "" -- 'undefined' but we have to use
} -- them as "Setup.hs configure" args
-- absoluteInstallDirs sets these as 'undefined' but we have
-- to use them as "Setup.hs configure" args
InstallDirs.libsubdir = "",
InstallDirs.libexecsubdir = "",
InstallDirs.datasubdir = ""
}
| otherwise
-- use special simplified install dirs
......@@ -1567,9 +1570,12 @@ elaborateInstallPlan verbosity platform compiler compilerprogdb pkgConfigDB
platform
defaultInstallDirs) {
InstallDirs.libsubdir = "", -- absoluteInstallDirs sets these as
InstallDirs.datasubdir = "" -- 'undefined' but we have to use
} -- them as "Setup.hs configure" args
-- absoluteInstallDirs sets these as 'undefined' but we have to
-- use them as "Setup.hs configure" args
InstallDirs.libsubdir = "",
InstallDirs.libexecsubdir = "",
InstallDirs.datasubdir = ""
}
| otherwise
-- use special simplified install dirs
......@@ -2930,6 +2936,7 @@ storePackageInstallDirs StoreDirLayout{storePackageDirectory}
dynlibdir = libdir
flibdir = libdir
libexecdir = prefix </> "libexec"
libexecsubdir= ""
includedir = libdir </> "include"
datadir = prefix </> "share"
datasubdir = ""
......
......@@ -550,7 +550,7 @@ instance Arbitrary a => Arbitrary (InstallDirs a) where
<$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary -- 4
<*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary -- 8
<*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary -- 12
<*> arbitrary <*> arbitrary <*> arbitrary -- 15
<*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary -- 16
instance Arbitrary PackageDB where
arbitrary = oneof [ pure GlobalPackageDB
......
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