Setup.hs: Don't assume that the build directory is "dist."
Instead, get it from localBuildInfo.
This commit is contained in:
parent
1b1ba25432
commit
7689cacb5d
1 changed files with 10 additions and 9 deletions
19
Setup.hs
19
Setup.hs
|
@ -48,7 +48,9 @@ runTestSuite _ _ pkg _ = do
|
||||||
|
|
||||||
-- | Build man pages from markdown sources in man/man1/.
|
-- | Build man pages from markdown sources in man/man1/.
|
||||||
makeManPages :: Args -> BuildFlags -> PackageDescription -> LocalBuildInfo -> IO ()
|
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 :: [FilePath]
|
||||||
manpages = ["pandoc.1", "markdown2pdf.1"]
|
manpages = ["pandoc.1", "markdown2pdf.1"]
|
||||||
|
@ -57,21 +59,20 @@ manDir :: FilePath
|
||||||
manDir = "man" </> "man1"
|
manDir = "man" </> "man1"
|
||||||
|
|
||||||
-- | Build a man page from markdown source in man/man1.
|
-- | Build a man page from markdown source in man/man1.
|
||||||
makeManPage :: Verbosity -> FilePath -> IO ()
|
makeManPage :: FilePath -> Verbosity -> FilePath -> IO ()
|
||||||
makeManPage verbosity manpage = do
|
makeManPage pandoc verbosity manpage = do
|
||||||
let pandoc = "dist" </> "build" </> "pandoc" </> "pandoc"
|
|
||||||
let page = manDir </> manpage
|
let page = manDir </> manpage
|
||||||
let source = manDir </> manpage <.> "md"
|
let source = page <.> "md"
|
||||||
modifiedDeps <- modifiedDependencies page [source]
|
modifiedDeps <- modifiedDependencies page [source]
|
||||||
unless (null modifiedDeps) $ do
|
unless (null modifiedDeps) $ do
|
||||||
ec <- runProcess pandoc ["-s", "-S", "-r", "markdown", "-w", "man",
|
ec <- runProcess pandoc ["-s", "-S", "-r", "markdown", "-w", "man",
|
||||||
"--template=templates/man.template", "-o", page, source]
|
"--template=templates/man.template", "-o", page, source]
|
||||||
Nothing Nothing Nothing Nothing (Just stderr) >>= waitForProcess
|
Nothing Nothing Nothing Nothing (Just stderr) >>= waitForProcess
|
||||||
case ec of
|
case ec of
|
||||||
ExitSuccess -> unless (verbosity == silent) $
|
ExitSuccess -> unless (verbosity == silent) $
|
||||||
putStrLn $ "Created " ++ manDir </> manpage
|
putStrLn $ "Created " ++ page
|
||||||
_ -> do putStrLn $ "Error creating " ++ manDir </> manpage
|
ExitFailure n -> putStrLn ("Error creating " ++ page ++
|
||||||
exitWith ec
|
". Exit code = " ++ show n) >> exitWith ec
|
||||||
|
|
||||||
installScripts :: PackageDescription -> LocalBuildInfo
|
installScripts :: PackageDescription -> LocalBuildInfo
|
||||||
-> Verbosity -> CopyDest -> IO ()
|
-> Verbosity -> CopyDest -> IO ()
|
||||||
|
|
Loading…
Add table
Reference in a new issue