summaryrefslogtreecommitdiff
path: root/Setup.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-09-01 15:20:45 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-09-01 15:20:45 -0400
commit87b9da70e6436bda534425b82553972c55208ac2 (patch)
treed46ebad4cf997ee0cd513d0a234a013e05c445a4 /Setup.hs
parent10a48da98805df4f903853c40c8c7dd7ff33b3be (diff)
avoid installing man pages when they do not exist
Man pages are shipped prebuilt in cabal tarball, but will not be available when cloning git and running cabal install.
Diffstat (limited to 'Setup.hs')
-rw-r--r--Setup.hs16
1 files changed, 11 insertions, 5 deletions
diff --git a/Setup.hs b/Setup.hs
index 06390975b..5db0ca7f7 100644
--- a/Setup.hs
+++ b/Setup.hs
@@ -9,6 +9,9 @@ import Distribution.Simple.Utils (installOrdinaryFiles, rawSystemExit)
import Distribution.PackageDescription (PackageDescription(..))
import Distribution.Verbosity (Verbosity)
import System.FilePath
+import Control.Applicative
+import Control.Monad
+import System.Directory
import qualified Build.InstallDesktopFile as InstallDesktopFile
import qualified Build.Configure as Configure
@@ -38,15 +41,18 @@ installGitAnnexShell copyDest verbosity pkg lbi =
where
dstBinDir = bindir $ absoluteInstallDirs pkg lbi copyDest
--- See http://www.haskell.org/haskellwiki/Cabal/Developer-FAQ#Installing_manpages.
---
--- Based on pandoc's Setup.hs.
+{- See http://www.haskell.org/haskellwiki/Cabal/Developer-FAQ#Installing_manpages
+ -
+ - Man pages are provided prebuilt in the tarball in cabal,
+ - but may not be available otherwise, in which case, skip installing them.
+ -}
installManpages :: CopyDest -> Verbosity -> PackageDescription -> LocalBuildInfo -> IO ()
installManpages copyDest verbosity pkg lbi =
- installOrdinaryFiles verbosity dstManDir srcManpages
+ installOrdinaryFiles verbosity dstManDir =<< srcManpages
where
dstManDir = mandir (absoluteInstallDirs pkg lbi copyDest) </> "man1"
- srcManpages = zip (repeat srcManDir) manpages
+ srcManpages = zip (repeat srcManDir)
+ <$> filterM doesFileExist manpages
srcManDir = ""
manpages = ["git-annex.1", "git-annex-shell.1"]