git-annex/Setup.hs
Nathan Collins 000bbba3c0 Clean up Setup.hs.
Remove post-copy hook 'myPostCopy': it's easy to write one based on
'myPostInst', so just wait until someone complains that it's missing.

Remove most comments.

Put long type sigs on one line like in the other source files.
2012-06-12 02:50:09 -07:00

48 lines
1.6 KiB
Haskell

{-# LANGUAGE NamedFieldPuns #-}
{- cabal setup file -}
import Distribution.Simple
import Distribution.Simple.LocalBuildInfo
import Distribution.Simple.Setup
import Distribution.Simple.Utils (installOrdinaryFiles, rawSystemExit)
import Distribution.PackageDescription (PackageDescription(..))
import Distribution.Verbosity (Verbosity)
import System.FilePath
import qualified Build.Configure as Configure
main = defaultMainWithHooks simpleUserHooks
{ preConf = configure
, postInst = myPostInst
}
configure _ _ = do
Configure.run Configure.tests
return (Nothing, [])
myPostInst :: Args -> InstallFlags -> PackageDescription -> LocalBuildInfo -> IO ()
myPostInst _ (InstallFlags { installVerbosity }) pkg lbi = do
installGitAnnexShell dest verbosity pkg lbi
installManpages dest verbosity pkg lbi
where
dest = NoCopyDest
verbosity = fromFlag installVerbosity
installGitAnnexShell :: CopyDest -> Verbosity -> PackageDescription -> LocalBuildInfo -> IO ()
installGitAnnexShell copyDest verbosity pkg lbi =
rawSystemExit verbosity "ln"
["-sf", "git-annex", dstBinDir </> "git-annex-shell"]
where
dstBinDir = bindir $ absoluteInstallDirs pkg lbi copyDest
-- See http://www.haskell.org/haskellwiki/Cabal/Developer-FAQ#Installing_manpages.
--
-- Based on pandoc's Setup.hs.
installManpages :: CopyDest -> Verbosity -> PackageDescription -> LocalBuildInfo -> IO ()
installManpages copyDest verbosity pkg lbi =
installOrdinaryFiles verbosity dstManDir srcManpages
where
dstManDir = mandir (absoluteInstallDirs pkg lbi copyDest) </> "man1"
srcManpages = zip (repeat srcManDir) manpages
srcManDir = ""
manpages = ["git-annex.1", "git-annex-shell.1"]