summaryrefslogtreecommitdiff
path: root/Setup.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Setup.hs')
-rw-r--r--Setup.hs24
1 files changed, 24 insertions, 0 deletions
diff --git a/Setup.hs b/Setup.hs
index c36d6e4fe..c722077eb 100644
--- a/Setup.hs
+++ b/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