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.
This commit is contained in:
parent
1cfd2e1c05
commit
6f17b2fb39
1 changed files with 24 additions and 0 deletions
24
Setup.hs
24
Setup.hs
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue