git.iko.soy/typeable/pandoc
on master help sign in
Install man pages as part of cabal 'copy' phase.
commit9ffd1babc7db537b5cc254674999bc3da567e070 authorJohn MacFarlane <jgm@berkeley.edu> dateWed 1 Jul 2015, 18:01 (11 years ago) parent28cb505
5 files changed+27−21
INSTALL+5−10 Setup.hs+19−7 make_deb.sh+1−1 make_osx_package.sh+1−1 pandoc.cabal+1−2
INSTALL+5−10
@@ -75,17 +75,12 @@ Quick install
7575 --extra-include-dirs=/usr/local/Cellar/icu4c/51.1/include \
7676 -funicode_collation text-icu pandoc-citeproc
7777
78−To build the `pandoc.1` man page:
78+The `pandoc.1` man page will be built and installed automatically.
79+The build process shows you where it is installed: you may need
80+to set your `MANPATH` accordingly.
7981
80− pandoc --print-default-data-file pandoc.1 > pandoc.1
81−
82−To build the `pandoc-citeproc` man pages, go to the pandoc-citeproc
83−build directory, and
84−
85− cd man
86− make
87−
88−The man page will be created in the `man1` subdirectory.
82+The `pandoc-citeproc.1` man page will also be built and installed
83+automatically.
8984
9085[GHC]: http://www.haskell.org/ghc/
9186[Haskell platform]: http://hackage.haskell.org/platform/
Setup.hs+19−7
@@ -18,11 +18,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1818
1919import Distribution.Simple
2020import Distribution.Simple.PreProcess
21+import Distribution.Simple.InstallDirs (mandir)
2122import Distribution.PackageDescription (PackageDescription(..), Executable(..))
2223import System.Process ( rawSystem )
2324import System.FilePath ( (</>) )
2425import System.Directory ( findExecutable )
25−import Distribution.Simple.Utils (info, rawSystemExit)
26+import Distribution.Simple.Utils (info, notice, rawSystemExit, installOrdinaryFile)
2627import Distribution.Simple.Setup
2728import Distribution.Simple.LocalBuildInfo
2829import Distribution.Verbosity
@@ -32,7 +33,11 @@ main = defaultMainWithHooks $ simpleUserHooks {
3233 -- enable hsb2hs preprocessor for .hsb files
3334 hookedPreProcessors = [ppBlobSuffixHandler]
3435 , postBuild = \args bf pkgdescr lbi ->
35− makeManPages args bf pkgdescr lbi
36+ makeManPage args bf pkgdescr lbi
37+
38+ , postCopy = \_ flags pkg lbi ->
39+ installManpage pkg lbi (fromFlag $ copyVerbosity flags)
40+ NoCopyDest
3641 }
3742
3843ppBlobSuffixHandler :: PPSuffixHandler
@@ -48,10 +53,10 @@ ppBlobSuffixHandler = ("hsb", \_ _ ->
4853 return ()
4954 })
5055
51−makeManPages :: Args -> BuildFlags -> PackageDescription -> LocalBuildInfo
52− -> IO ()
53−makeManPages _ bf _ LocalBuildInfo{buildDir=buildDir}
54− = do info verbosity "Creating data/pandoc.1"
56+makeManPage :: Args -> BuildFlags -> PackageDescription -> LocalBuildInfo
57+ -> IO ()
58+makeManPage _ bf _ LocalBuildInfo{buildDir=buildDir}
59+ = do notice verbosity "Creating man/pandoc.1"
5560 rawSystemExit verbosity progPath args
5661 where verbosity = fromFlagOrDefault normal $ buildVerbosity bf
5762 progPath = buildDir </> "pandoc" </> "pandoc"
@@ -60,5 +65,12 @@ makeManPages _ bf _ LocalBuildInfo{buildDir=buildDir}
6065 "--filter", "man/capitalizeHeaders.hs",
6166 "--filter", "man/removeNotes.hs",
6267 "--filter", "man/removeLinks.hs",
63− "-o", "data/pandoc.1"]
68+ "-o", "man/pandoc.1"]
6469
70+installManpage :: PackageDescription -> LocalBuildInfo
71+ -> Verbosity -> CopyDest -> IO ()
72+installManpage pkg lbi verbosity copy = do
73+ let mandest = mandir (absoluteInstallDirs pkg lbi copy) </>
74+ "man1" </> "pandoc.1"
75+ notice verbosity $ "Copying man page to " ++ mandest
76+ installOrdinaryFile verbosity ("man" </> "pandoc.1") mandest
make_deb.sh+1−1
@@ -42,7 +42,7 @@ mkdir -p $DEST/share/doc/pandoc-citeproc
4242find $DIST -type d | xargs chmod 755
4343cp $SANDBOX/bin/pandoc $DEST/bin/
4444cp $SANDBOX/bin/pandoc-citeproc $DEST/bin/
45−$SANDBOX/bin/pandoc --print-default-data-file pandoc.1 > $DEST/share/man/man1/pandoc.1
45+cp $SANDBOX/share/man/man1/pandoc.1 $DEST/share/man/man1/pandoc.1
4646gzip -9 $DEST/share/man/man1/pandoc.1
4747cp $PANDOC_CITEPROC_PATH/man/man1/pandoc-citeproc.1 $DEST/share/man/man1/
4848gzip -9 $DEST/share/man/man1/pandoc-citeproc.1
make_osx_package.sh+1−1
@@ -37,7 +37,7 @@ for f in pandoc pandoc-citeproc; do
3737 cp $SANDBOX/bin/$f $DEST/bin/;
3838done
3939cp $PANDOC_CITEPROC_PATH/man/man1/pandoc-citeproc.1 $DEST/share/man/man1/
40−$SANDBOX/bin/pandoc --print-default-data-file pandoc.1 > $DEST/share/man/man1/pandoc.1
40+cp $SANDBOX/share/man/man1/pandoc.1 $DEST/share/man/man1/pandoc.1
4141
4242chown -R $ME:staff $DIST
4343
pandoc.cabal+1−2
@@ -106,8 +106,6 @@ Data-Files:
106106 data/sample.lua
107107 -- documentation
108108 README, COPYRIGHT
109− -- man page (generated by Setup.hs after build:)
110− data/pandoc.1
111109Extra-Source-Files:
112110 -- documentation
113111 INSTALL, BUGS, CONTRIBUTING.md, changelog
@@ -206,6 +204,7 @@ Extra-Source-Files:
206204 tests/epub/*.native
207205 tests/txt2tags.t2t
208206 tests/twiki-reader.twiki
207+Extra-Tmp-Files: man/pandoc.1
209208
210209Source-repository head
211210 type: git