diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2013-10-06 18:04:18 -0700 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2013-10-06 18:04:18 -0700 |
commit | ed061b91c8e3247e1d3b1538eca24687adf0e575 (patch) | |
tree | 28abe21e2ee93ae1bec1accc22e52d10610f57d5 /Setup.hs | |
parent | dbd4aee7305ed82c9daf33a59fd0c29d3e3461d6 (diff) | |
download | pandoc-ed061b91c8e3247e1d3b1538eca24687adf0e575.tar.gz |
Setup.hs: Better way of handling man page building.
Previously we tried to remove make-pandoc-man-pages from the list
of packages to be haddocked, installed, copied, etc.
It works better to set 'Buildable: False' on make-pandoc-man-pages,
then have the buildHook temporarily set Buildable to True. This
allows make-pandoc-man-pages to be built (and used in generating
the man pages), but not installed.
Diffstat (limited to 'Setup.hs')
-rw-r--r-- | Setup.hs | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -4,7 +4,7 @@ import Distribution.Simple import Distribution.Simple.PreProcess import Distribution.Simple.Setup (copyDest, copyVerbosity, fromFlag, installVerbosity, BuildFlags(..)) -import Distribution.PackageDescription (PackageDescription(..), Executable(..)) +import Distribution.PackageDescription (PackageDescription(..), Executable(..), BuildInfo(..)) import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(..), absoluteInstallDirs) import Distribution.Verbosity ( Verbosity, silent ) @@ -19,18 +19,19 @@ import System.Exit main :: IO () main = do defaultMainWithHooks $ simpleUserHooks { - postBuild = makeManPages + buildHook = \pkgdescr -> + (buildHook simpleUserHooks) pkgdescr{ executables = + [x | x <- executables pkgdescr, + exeName x /= "make-pandoc-man-pages"] ++ + [x{ buildInfo = (buildInfo x){ buildable = True } } + | x <- executables pkgdescr, + exeName x == "make-pandoc-man-pages"] } + , postBuild = makeManPages , postCopy = \ _ flags pkg lbi -> installManpages pkg lbi (fromFlag $ copyVerbosity flags) (fromFlag $ copyDest flags) , postInst = \ _ flags pkg lbi -> installManpages pkg lbi (fromFlag $ installVerbosity flags) NoCopyDest - , copyHook = \pkgdescr -> - (copyHook simpleUserHooks) pkgdescr{ executables = - [x | x <- executables pkgdescr, exeName x /= "make-pandoc-man-pages"] } - , instHook = \pkgdescr -> - (instHook simpleUserHooks) pkgdescr{ executables = - [x | x <- executables pkgdescr, exeName x /= "make-pandoc-man-pages"] } , hookedPreProcessors = [ppBlobSuffixHandler] } exitWith ExitSuccess |