From fa71a08ed3cae4ed26d2cb84b1f7a29be94e3ddb Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 13 Aug 2014 10:18:46 -0700 Subject: Simplified Setup.hs. It no longer builds and installs man pages. All it does is hook the hsb preprocessor. This should make the build process more robust over Cabal API changes. We'll add a Makefile to generate man pages. --- Setup.hs | 54 +++--------------------------------------------------- 1 file changed, 3 insertions(+), 51 deletions(-) (limited to 'Setup.hs') diff --git a/Setup.hs b/Setup.hs index 55a7c2178..d3a816948 100644 --- a/Setup.hs +++ b/Setup.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {- Copyright (C) 2006-2014 John MacFarlane @@ -19,60 +18,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import Distribution.Simple import Distribution.Simple.PreProcess -import Distribution.Simple.Setup - (copyDest, copyVerbosity, fromFlag, installVerbosity, BuildFlags(..), - TestFlags(..)) -import Distribution.PackageDescription (PackageDescription(..), Executable(..)) -import Distribution.Simple.LocalBuildInfo - (LocalBuildInfo(..), absoluteInstallDirs) -import Distribution.Verbosity ( Verbosity, silent ) -import Distribution.Simple.InstallDirs (mandir, CopyDest (NoCopyDest), toPathTemplate) -import Distribution.Simple.Utils (installOrdinaryFiles, info) -import Distribution.Simple.Test (test) import System.Process ( rawSystem ) import System.FilePath ( () ) import System.Directory ( findExecutable ) -import System.Exit +import Distribution.Simple.Utils (info) main :: IO () -main = do - defaultMainWithHooks $ simpleUserHooks { - 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 - --- | Build man pages from markdown sources in man/ -makeManPages :: Args -> BuildFlags -> PackageDescription -> LocalBuildInfo -> IO () -makeManPages _ flags _ lbi = do - let verbosity = fromFlag $ buildVerbosity flags - let args = ["--verbose" | verbosity /= silent] - rawSystem (buildDir lbi "make-pandoc-man-pages" "make-pandoc-man-pages") - args >>= exitWith - -manpages :: [FilePath] -manpages = ["man1" "pandoc.1" - ,"man5" "pandoc_markdown.5"] - -manDir :: FilePath -manDir = "man" - -installManpages :: PackageDescription -> LocalBuildInfo - -> Verbosity -> CopyDest -> IO () -installManpages pkg lbi verbosity copy = - installOrdinaryFiles verbosity (mandir (absoluteInstallDirs pkg lbi copy)) - (zip (repeat manDir) manpages) +main = defaultMainWithHooks $ simpleUserHooks { + hookedPreProcessors = [ppBlobSuffixHandler] } ppBlobSuffixHandler :: PPSuffixHandler ppBlobSuffixHandler = ("hsb", \_ _ -> @@ -85,5 +38,4 @@ ppBlobSuffixHandler = ("hsb", \_ _ -> Just p -> rawSystem p [infile, infile, outfile] Nothing -> error "hsb2hs is needed to build this program: cabal install hsb2hs" return () - }) -- cgit v1.2.3