aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2010-03-22 18:43:38 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2010-03-22 18:43:38 -0700
commit7689cacb5d0147e79b9080607bb35a0dd262b96a (patch)
tree342f596c5bcff853d8c30a1abd951dd5e3218115
parent1b1ba25432d35f66e17bb0a8f528ed251dc1d936 (diff)
downloadpandoc-7689cacb5d0147e79b9080607bb35a0dd262b96a.tar.gz
Setup.hs: Don't assume that the build directory is "dist."
Instead, get it from localBuildInfo.
-rw-r--r--Setup.hs19
1 files changed, 10 insertions, 9 deletions
diff --git a/Setup.hs b/Setup.hs
index 7284202f2..aa007576e 100644
--- a/Setup.hs
+++ b/Setup.hs
@@ -48,7 +48,9 @@ runTestSuite _ _ pkg _ = do
-- | Build man pages from markdown sources in man/man1/.
makeManPages :: Args -> BuildFlags -> PackageDescription -> LocalBuildInfo -> IO ()
-makeManPages _ flags _ _ = mapM_ (makeManPage (fromFlag $ buildVerbosity flags)) manpages
+makeManPages _ flags _ buildInfo =
+ mapM_ (makeManPage pandocPath (fromFlag $ buildVerbosity flags)) manpages
+ where pandocPath = (buildDir buildInfo) </> "pandoc" </> "pandoc"
manpages :: [FilePath]
manpages = ["pandoc.1", "markdown2pdf.1"]
@@ -57,21 +59,20 @@ manDir :: FilePath
manDir = "man" </> "man1"
-- | Build a man page from markdown source in man/man1.
-makeManPage :: Verbosity -> FilePath -> IO ()
-makeManPage verbosity manpage = do
- let pandoc = "dist" </> "build" </> "pandoc" </> "pandoc"
+makeManPage :: FilePath -> Verbosity -> FilePath -> IO ()
+makeManPage pandoc verbosity manpage = do
let page = manDir </> manpage
- let source = manDir </> manpage <.> "md"
+ let source = page <.> "md"
modifiedDeps <- modifiedDependencies page [source]
unless (null modifiedDeps) $ do
ec <- runProcess pandoc ["-s", "-S", "-r", "markdown", "-w", "man",
"--template=templates/man.template", "-o", page, source]
Nothing Nothing Nothing Nothing (Just stderr) >>= waitForProcess
case ec of
- ExitSuccess -> unless (verbosity == silent) $
- putStrLn $ "Created " ++ manDir </> manpage
- _ -> do putStrLn $ "Error creating " ++ manDir </> manpage
- exitWith ec
+ ExitSuccess -> unless (verbosity == silent) $
+ putStrLn $ "Created " ++ page
+ ExitFailure n -> putStrLn ("Error creating " ++ page ++
+ ". Exit code = " ++ show n) >> exitWith ec
installScripts :: PackageDescription -> LocalBuildInfo
-> Verbosity -> CopyDest -> IO ()