diff options
author | Nathan Collins <nathan.collins@gmail.com> | 2012-06-06 02:35:32 -0700 |
---|---|---|
committer | Nathan Collins <nathan.collins@gmail.com> | 2012-06-06 02:35:32 -0700 |
commit | 6f17b2fb39f389b01accee420548b54e22f41e0a (patch) | |
tree | 0329dc20074366fb6e09fe4dac72667ddce989e4 /Setup.hs | |
parent | 1cfd2e1c0572acf13f75897af3f5921cf0950e75 (diff) |
WIP: Add man page installation to Setup.hs
This works with `cabal-dev install .`, but `cabal sdist` does not yet
include the man pages (tried adding a `make $(mans)` before `cabal
sdist` in `make sdist`, but no luck).
XXX: Need to go back and replace spaces with tabs.
Diffstat (limited to 'Setup.hs')
-rw-r--r-- | Setup.hs | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -3,6 +3,9 @@ import Distribution.Simple import Distribution.Simple.LocalBuildInfo import Distribution.Simple.Setup +import Distribution.Simple.Utils (installOrdinaryFiles) +import Distribution.PackageDescription (PackageDescription(..)) +import Distribution.Verbosity (Verbosity) import System.Cmd import System.FilePath @@ -11,6 +14,7 @@ import qualified Build.Configure as Configure main = defaultMainWithHooks simpleUserHooks { preConf = configure , instHook = install + , postInst = const installManpages } configure _ _ = do @@ -25,3 +29,23 @@ install pkg_descr lbi userhooks flags = do where installDirs = absoluteInstallDirs pkg_descr lbi $ fromFlag (copyDest defaultCopyFlags) + +-- See http://www.haskell.org/haskellwiki/Cabal/Developer-FAQ#Installing_manpages. +-- +-- Based on pandoc's 'Setup.installManpages' and 'postInst' hook. +-- Would be easier to just use 'rawSystem' as above. +-- +-- XXX: fix tabs! +installManpages :: InstallFlags -> PackageDescription -> LocalBuildInfo -> IO () +installManpages flags pkg lbi = + installOrdinaryFiles verbosity dstManDir manpages + where + srcManDir = "" + -- The 'NoCopyDest' means "don't add an additional path prefix". + -- The pandoc Setup.hs uses 'NoCopyDest' in the post install hook + -- and the 'CopyDest' from the copy flags in the post copy hook. + dstManDir = mandir (absoluteInstallDirs pkg lbi NoCopyDest) </> "man1" + manpages = zip (repeat srcManDir) + [ "git-annex.1" + , "git-annex-shell.1" ] + verbosity = fromFlag $ installVerbosity flags |