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