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-06 09:35:32 +00:00
|
|
|
import Distribution.Simple.Utils (installOrdinaryFiles)
|
|
|
|
import Distribution.PackageDescription (PackageDescription(..))
|
|
|
|
import Distribution.Verbosity (Verbosity)
|
2011-06-30 18:55:03 +00:00
|
|
|
import System.Cmd
|
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
|
|
|
|
, instHook = install
|
2012-06-06 09:35:32 +00:00
|
|
|
, postInst = const installManpages
|
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
|
|
|
|
|
|
|
install pkg_descr lbi userhooks flags = do
|
|
|
|
r <- (instHook simpleUserHooks) pkg_descr lbi userhooks flags
|
|
|
|
_ <- rawSystem "ln" ["-sf", "git-annex",
|
|
|
|
bindir installDirs </> "git-annex-shell"]
|
|
|
|
return r
|
|
|
|
where
|
|
|
|
installDirs = absoluteInstallDirs pkg_descr lbi $
|
|
|
|
fromFlag (copyDest defaultCopyFlags)
|
2012-06-06 09:35:32 +00:00
|
|
|
|
|
|
|
-- 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.
|
|
|
|
--
|
2012-06-08 02:01:49 +00:00
|
|
|
-- XXX: lhs2tex installs man pages with the 'postCopy' hook.
|
|
|
|
-- I chose 'postInst'. Pandoc uses both :P So, probably
|
|
|
|
-- to use the 'postCopy' hook.
|
|
|
|
--
|
2012-06-06 09:35:32 +00:00
|
|
|
-- 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
|