[commit: packages/Cabal] ghc-head: Add sysconfdir. (4a2aa7d)
git at git.haskell.org
git at git.haskell.org
Mon Aug 26 23:29:19 CEST 2013
Repository : ssh://git@git.haskell.org/Cabal
On branch : ghc-head
Link : http://git.haskell.org/?p=packages/Cabal.git;a=commit;h=4a2aa7d36ed67c17cbce8d8d3b4c7a591c61ee42
>---------------------------------------------------------------
commit 4a2aa7d36ed67c17cbce8d8d3b4c7a591c61ee42
Author: Clint Adams <clint at debian.org>
Date: Sat Aug 3 12:33:25 2013 -0400
Add sysconfdir.
>---------------------------------------------------------------
4a2aa7d36ed67c17cbce8d8d3b4c7a591c61ee42
Cabal/Distribution/Simple/Build/PathsModule.hs | 16 +++++++++++-----
Cabal/Distribution/Simple/Configure.hs | 1 +
Cabal/Distribution/Simple/InstallDirs.hs | 18 ++++++++++++------
Cabal/Distribution/Simple/Setup.hs | 6 ++++++
4 files changed, 30 insertions(+), 11 deletions(-)
diff --git a/Cabal/Distribution/Simple/Build/PathsModule.hs b/Cabal/Distribution/Simple/Build/PathsModule.hs
index 5f1d518..af81396 100644
--- a/Cabal/Distribution/Simple/Build/PathsModule.hs
+++ b/Cabal/Distribution/Simple/Build/PathsModule.hs
@@ -68,7 +68,7 @@ generate pkg_descr lbi =
"module " ++ display paths_modulename ++ " (\n"++
" version,\n"++
" getBinDir, getLibDir, getDataDir, getLibexecDir,\n"++
- " getDataFileName\n"++
+ " getDataFileName, getSysconfDir\n"++
" ) where\n"++
"\n"++
foreign_imports++
@@ -85,17 +85,19 @@ generate pkg_descr lbi =
body
| absolute =
- "\nbindir, libdir, datadir, libexecdir :: FilePath\n"++
+ "\nbindir, libdir, datadir, libexecdir, sysconfdir :: FilePath\n"++
"\nbindir = " ++ show flat_bindir ++
"\nlibdir = " ++ show flat_libdir ++
"\ndatadir = " ++ show flat_datadir ++
"\nlibexecdir = " ++ show flat_libexecdir ++
+ "\nsysconfdir = " ++ show flat_sysconfdir ++
"\n"++
- "\ngetBinDir, getLibDir, getDataDir, getLibexecDir :: IO FilePath\n"++
+ "\ngetBinDir, getLibDir, getDataDir, getLibexecDir, getSysconfDir :: IO FilePath\n"++
"getBinDir = "++mkGetEnvOr "bindir" "return bindir"++"\n"++
"getLibDir = "++mkGetEnvOr "libdir" "return libdir"++"\n"++
"getDataDir = "++mkGetEnvOr "datadir" "return datadir"++"\n"++
"getLibexecDir = "++mkGetEnvOr "libexecdir" "return libexecdir"++"\n"++
+ "getSysconfDir = "++mkGetEnvOr "sysconfdir" "return sysconfdir"++"\n"++
"\n"++
"getDataFileName :: FilePath -> IO FilePath\n"++
"getDataFileName name = do\n"++
@@ -115,6 +117,8 @@ generate pkg_descr lbi =
(mkGetDir flat_datadir flat_datadirrel)++"\n\n"++
"getLibexecDir :: IO FilePath\n"++
"getLibexecDir = "++mkGetDir flat_libexecdir flat_libexecdirrel++"\n\n"++
+ "getSysconfDir :: IO FilePath\n"++
+ "getSysconfDir = "++mkGetDir flat_sysconfdir flat_sysconfdirrel++"\n\n"++
"getDataFileName :: FilePath -> IO FilePath\n"++
"getDataFileName name = do\n"++
" dir <- getDataDir\n"++
@@ -131,13 +135,15 @@ generate pkg_descr lbi =
bindir = flat_bindir,
libdir = flat_libdir,
datadir = flat_datadir,
- libexecdir = flat_libexecdir
+ libexecdir = flat_libexecdir,
+ sysconfdir = flat_sysconfdir
} = absoluteInstallDirs pkg_descr lbi NoCopyDest
InstallDirs {
bindir = flat_bindirrel,
libdir = flat_libdirrel,
datadir = flat_datadirrel,
libexecdir = flat_libexecdirrel,
+ sysconfdir = flat_sysconfdirrel,
progdir = flat_progdirrel
} = prefixRelativeInstallDirs (packageId pkg_descr) lbi
@@ -181,7 +187,7 @@ generate pkg_descr lbi =
-- component of interest.
pkgPathEnvVar :: PackageDescription
-> String -- ^ path component; one of \"bindir\", \"libdir\",
- -- \"datadir\" or \"libexecdir\"
+ -- \"datadir\", \"libexecdir\", or \"sysconfdir\"
-> String -- ^ environment variable name
pkgPathEnvVar pkg_descr var =
showPkgName (packageName pkg_descr) ++ "_" ++ var
diff --git a/Cabal/Distribution/Simple/Configure.hs b/Cabal/Distribution/Simple/Configure.hs
index ee83b70..86e961a 100644
--- a/Cabal/Distribution/Simple/Configure.hs
+++ b/Cabal/Distribution/Simple/Configure.hs
@@ -570,6 +570,7 @@ configure (pkg_descr0, pbi) cfg
dirinfo "Private binaries" (libexecdir dirs) (libexecdir relative)
dirinfo "Data files" (datadir dirs) (datadir relative)
dirinfo "Documentation" (docdir dirs) (docdir relative)
+ dirinfo "Configuration files" (sysconfdir dirs) (sysconfdir relative)
sequence_ [ reportProgram verbosity prog configuredProg
| (prog, configuredProg) <- knownPrograms programsConfig''' ]
diff --git a/Cabal/Distribution/Simple/InstallDirs.hs b/Cabal/Distribution/Simple/InstallDirs.hs
index 9bcc59f..164d112 100644
--- a/Cabal/Distribution/Simple/InstallDirs.hs
+++ b/Cabal/Distribution/Simple/InstallDirs.hs
@@ -116,7 +116,8 @@ data InstallDirs dir = InstallDirs {
docdir :: dir,
mandir :: dir,
htmldir :: dir,
- haddockdir :: dir
+ haddockdir :: dir,
+ sysconfdir :: dir
} deriving (Read, Show)
instance Functor InstallDirs where
@@ -134,7 +135,8 @@ instance Functor InstallDirs where
docdir = f (docdir dirs),
mandir = f (mandir dirs),
htmldir = f (htmldir dirs),
- haddockdir = f (haddockdir dirs)
+ haddockdir = f (haddockdir dirs),
+ sysconfdir = f (sysconfdir dirs)
}
instance Monoid dir => Monoid (InstallDirs dir) where
@@ -152,7 +154,8 @@ instance Monoid dir => Monoid (InstallDirs dir) where
docdir = mempty,
mandir = mempty,
htmldir = mempty,
- haddockdir = mempty
+ haddockdir = mempty,
+ sysconfdir = mempty
}
mappend = combineInstallDirs mappend
@@ -174,7 +177,8 @@ combineInstallDirs combine a b = InstallDirs {
docdir = docdir a `combine` docdir b,
mandir = mandir a `combine` mandir b,
htmldir = htmldir a `combine` htmldir b,
- haddockdir = haddockdir a `combine` haddockdir b
+ haddockdir = haddockdir a `combine` haddockdir b,
+ sysconfdir = sysconfdir a `combine` sysconfdir b
}
appendSubdirs :: (a -> a -> a) -> InstallDirs a -> InstallDirs a
@@ -250,7 +254,8 @@ defaultInstallDirs comp userInstall _hasLibs = do
docdir = "$datadir" </> "doc" </> "$arch-$os-$compiler" </> "$pkgid",
mandir = "$datadir" </> "man",
htmldir = "$docdir" </> "html",
- haddockdir = "$htmldir"
+ haddockdir = "$htmldir",
+ sysconfdir = "$prefix" </> "etc"
}
-- ---------------------------------------------------------------------------
@@ -288,7 +293,8 @@ substituteInstallDirTemplates env dirs = dirs'
mandir = subst mandir (prefixBinLibDataVars ++ [docdirVar]),
htmldir = subst htmldir (prefixBinLibDataVars ++ [docdirVar]),
haddockdir = subst haddockdir (prefixBinLibDataVars ++
- [docdirVar, htmldirVar])
+ [docdirVar, htmldirVar]),
+ sysconfdir = subst sysconfdir []
}
subst dir env' = substPathTemplate (env'++env) (dir dirs)
diff --git a/Cabal/Distribution/Simple/Setup.hs b/Cabal/Distribution/Simple/Setup.hs
index 1880d13..58c29bf 100644
--- a/Cabal/Distribution/Simple/Setup.hs
+++ b/Cabal/Distribution/Simple/Setup.hs
@@ -588,6 +588,11 @@ installDirsOptions =
"installation directory for haddock interfaces"
haddockdir (\v flags -> flags { haddockdir = v })
installDirArg
+
+ , option "" ["sysconfdir"]
+ "installation directory for configuration files"
+ sysconfdir (\v flags -> flags { sysconfdir = v })
+ installDirArg
]
where
installDirArg _sf _lf d get set =
@@ -1727,6 +1732,7 @@ configureArgs bcHack flags
++ optFlag' "libdir" libdir
++ optFlag' "libexecdir" libexecdir
++ optFlag' "datadir" datadir
+ ++ optFlag' "sysconfdir" sysconfdir
++ configConfigureArgs flags
where
hc_flag = case (configHcFlavor flags, configHcPath flags) of
More information about the ghc-commits
mailing list