2012-06-10 06:32:25 +00:00
|
|
|
{-# LANGUAGE NamedFieldPuns #-}
|
2012-06-12 15:38:16 +00:00
|
|
|
|
2011-06-30 18:55:03 +00:00
|
|
|
{- cabal setup file -}
|
|
|
|
|
|
|
|
import Distribution.Simple
|
2012-04-14 18:01:14 +00:00
|
|
|
import Distribution.Simple.LocalBuildInfo
|
|
|
|
import Distribution.Simple.Setup
|
2012-06-10 06:32:25 +00:00
|
|
|
import Distribution.Simple.Utils (installOrdinaryFiles, rawSystemExit)
|
2012-06-06 09:35:32 +00:00
|
|
|
import Distribution.PackageDescription (PackageDescription(..))
|
|
|
|
import Distribution.Verbosity (Verbosity)
|
2012-04-14 18:01:14 +00:00
|
|
|
import System.FilePath
|
2011-06-30 18:55:03 +00:00
|
|
|
|
2012-03-10 18:00:26 +00:00
|
|
|
import qualified Build.Configure as Configure
|
2011-06-30 18:55:03 +00:00
|
|
|
|
2012-04-14 18:01:14 +00:00
|
|
|
main = defaultMainWithHooks simpleUserHooks
|
|
|
|
{ preConf = configure
|
2012-06-10 06:32:25 +00:00
|
|
|
, postInst = myPostInst
|
2012-04-14 18:01:14 +00:00
|
|
|
}
|
2011-06-30 18:55:03 +00:00
|
|
|
|
2012-03-10 18:00:26 +00:00
|
|
|
configure _ _ = do
|
2012-03-23 16:24:40 +00:00
|
|
|
Configure.run Configure.tests
|
2012-03-10 18:00:26 +00:00
|
|
|
return (Nothing, [])
|
2012-04-14 18:01:14 +00:00
|
|
|
|
2012-06-12 09:50:09 +00:00
|
|
|
myPostInst :: Args -> InstallFlags -> PackageDescription -> LocalBuildInfo -> IO ()
|
2012-06-10 06:32:25 +00:00
|
|
|
myPostInst _ (InstallFlags { installVerbosity }) pkg lbi = do
|
2012-06-10 09:21:13 +00:00
|
|
|
installGitAnnexShell dest verbosity pkg lbi
|
|
|
|
installManpages dest verbosity pkg lbi
|
|
|
|
where
|
|
|
|
dest = NoCopyDest
|
|
|
|
verbosity = fromFlag installVerbosity
|
2012-06-10 06:32:25 +00:00
|
|
|
|
2012-06-12 09:50:09 +00:00
|
|
|
installGitAnnexShell :: CopyDest -> Verbosity -> PackageDescription -> LocalBuildInfo -> IO ()
|
2012-06-10 06:32:25 +00:00
|
|
|
installGitAnnexShell copyDest verbosity pkg lbi =
|
2012-06-10 09:21:13 +00:00
|
|
|
rawSystemExit verbosity "ln"
|
|
|
|
["-sf", "git-annex", dstBinDir </> "git-annex-shell"]
|
|
|
|
where
|
|
|
|
dstBinDir = bindir $ absoluteInstallDirs pkg lbi copyDest
|
2012-06-06 09:35:32 +00:00
|
|
|
|
|
|
|
-- See http://www.haskell.org/haskellwiki/Cabal/Developer-FAQ#Installing_manpages.
|
|
|
|
--
|
2012-06-12 09:50:09 +00:00
|
|
|
-- Based on pandoc's Setup.hs.
|
|
|
|
installManpages :: CopyDest -> Verbosity -> PackageDescription -> LocalBuildInfo -> IO ()
|
2012-06-10 06:32:25 +00:00
|
|
|
installManpages copyDest verbosity pkg lbi =
|
2012-06-10 09:21:13 +00:00
|
|
|
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"]
|