Generate man page in cabal build process and include in data/.
The pandoc.1 man page is generated automatically after the cabal build process. It goes in `data/pandoc.1`. It can be obtained by the user who installs pandoc via cabal thus: pandoc --print-default-data-file pandoc.1 > pandoc.1
This commit is contained in:
parent
958a615b75
commit
28cb50503b
6 changed files with 23 additions and 16 deletions
2
INSTALL
2
INSTALL
|
@ -77,7 +77,7 @@ Quick install
|
||||||
|
|
||||||
To build the `pandoc.1` man page:
|
To build the `pandoc.1` man page:
|
||||||
|
|
||||||
make man/man1/pandoc.1
|
pandoc --print-default-data-file pandoc.1 > pandoc.1
|
||||||
|
|
||||||
To build the `pandoc-citeproc` man pages, go to the pandoc-citeproc
|
To build the `pandoc-citeproc` man pages, go to the pandoc-citeproc
|
||||||
build directory, and
|
build directory, and
|
||||||
|
|
12
Makefile
12
Makefile
|
@ -40,21 +40,11 @@ debpkg:
|
||||||
osxpkg:
|
osxpkg:
|
||||||
./make_osx_package.sh
|
./make_osx_package.sh
|
||||||
|
|
||||||
man/man1/pandoc.1: README man/pandoc.1.template
|
|
||||||
@[ -n "$(pandoc)" ] || \
|
|
||||||
(echo "Could not find pandoc in dist/" && exit 1)
|
|
||||||
$(pandoc) $< -t man -s --template man/pandoc.1.template \
|
|
||||||
--filter man/capitalizeHeaders.hs \
|
|
||||||
--filter man/removeNotes.hs \
|
|
||||||
--filter man/removeLinks.hs \
|
|
||||||
-o $@
|
|
||||||
|
|
||||||
download_stats:
|
download_stats:
|
||||||
curl https://api.github.com/repos/jgm/pandoc/releases | \
|
curl https://api.github.com/repos/jgm/pandoc/releases | \
|
||||||
jq '[.[] | .assets | .[] | {name: .name, download_count: .download_count}]'
|
jq '[.[] | .assets | .[] | {name: .name, download_count: .download_count}]'
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
cabal clean
|
cabal clean
|
||||||
-rm man/man1/pandoc.1
|
|
||||||
|
|
||||||
.PHONY: deps quick full install man clean test bench haddock osxpkg dist bindist prof download_stats
|
.PHONY: deps quick full install clean test bench osxpkg dist prof download_stats
|
||||||
|
|
17
Setup.hs
17
Setup.hs
|
@ -31,6 +31,8 @@ main :: IO ()
|
||||||
main = defaultMainWithHooks $ simpleUserHooks {
|
main = defaultMainWithHooks $ simpleUserHooks {
|
||||||
-- enable hsb2hs preprocessor for .hsb files
|
-- enable hsb2hs preprocessor for .hsb files
|
||||||
hookedPreProcessors = [ppBlobSuffixHandler]
|
hookedPreProcessors = [ppBlobSuffixHandler]
|
||||||
|
, postBuild = \args bf pkgdescr lbi ->
|
||||||
|
makeManPages args bf pkgdescr lbi
|
||||||
}
|
}
|
||||||
|
|
||||||
ppBlobSuffixHandler :: PPSuffixHandler
|
ppBlobSuffixHandler :: PPSuffixHandler
|
||||||
|
@ -45,3 +47,18 @@ ppBlobSuffixHandler = ("hsb", \_ _ ->
|
||||||
Nothing -> error "hsb2hs is needed to build this program: cabal install hsb2hs"
|
Nothing -> error "hsb2hs is needed to build this program: cabal install hsb2hs"
|
||||||
return ()
|
return ()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
makeManPages :: Args -> BuildFlags -> PackageDescription -> LocalBuildInfo
|
||||||
|
-> IO ()
|
||||||
|
makeManPages _ bf _ LocalBuildInfo{buildDir=buildDir}
|
||||||
|
= do info verbosity "Creating data/pandoc.1"
|
||||||
|
rawSystemExit verbosity progPath args
|
||||||
|
where verbosity = fromFlagOrDefault normal $ buildVerbosity bf
|
||||||
|
progPath = buildDir </> "pandoc" </> "pandoc"
|
||||||
|
args = ["README", "-t", "man", "-s",
|
||||||
|
"--template", "man/pandoc.1.template",
|
||||||
|
"--filter", "man/capitalizeHeaders.hs",
|
||||||
|
"--filter", "man/removeNotes.hs",
|
||||||
|
"--filter", "man/removeLinks.hs",
|
||||||
|
"-o", "data/pandoc.1"]
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ echo Building pandoc...
|
||||||
cabal clean
|
cabal clean
|
||||||
cabal install --force --reinstall --flags="embed_data_files make-pandoc-man-pages" . pandoc-citeproc
|
cabal install --force --reinstall --flags="embed_data_files make-pandoc-man-pages" . pandoc-citeproc
|
||||||
|
|
||||||
make -B man/man1/pandoc.1
|
|
||||||
# get pandoc-citeproc man page:
|
# get pandoc-citeproc man page:
|
||||||
PANDOC_CITEPROC_PATH=`cabal unpack -d make_binary_package.tmp.$$ pandoc-citeproc | awk '{print $3;}'`
|
PANDOC_CITEPROC_PATH=`cabal unpack -d make_binary_package.tmp.$$ pandoc-citeproc | awk '{print $3;}'`
|
||||||
strip $SANDBOX/bin/pandoc
|
strip $SANDBOX/bin/pandoc
|
||||||
|
@ -43,7 +42,7 @@ mkdir -p $DEST/share/doc/pandoc-citeproc
|
||||||
find $DIST -type d | xargs chmod 755
|
find $DIST -type d | xargs chmod 755
|
||||||
cp $SANDBOX/bin/pandoc $DEST/bin/
|
cp $SANDBOX/bin/pandoc $DEST/bin/
|
||||||
cp $SANDBOX/bin/pandoc-citeproc $DEST/bin/
|
cp $SANDBOX/bin/pandoc-citeproc $DEST/bin/
|
||||||
cp man/man1/pandoc.1 $DEST/share/man/man1/pandoc.1
|
$SANDBOX/bin/pandoc --print-default-data-file pandoc.1 > $DEST/share/man/man1/pandoc.1
|
||||||
gzip -9 $DEST/share/man/man1/pandoc.1
|
gzip -9 $DEST/share/man/man1/pandoc.1
|
||||||
cp $PANDOC_CITEPROC_PATH/man/man1/pandoc-citeproc.1 $DEST/share/man/man1/
|
cp $PANDOC_CITEPROC_PATH/man/man1/pandoc-citeproc.1 $DEST/share/man/man1/
|
||||||
gzip -9 $DEST/share/man/man1/pandoc-citeproc.1
|
gzip -9 $DEST/share/man/man1/pandoc-citeproc.1
|
||||||
|
|
|
@ -27,7 +27,6 @@ cabal clean
|
||||||
cabal install cpphs hsb2hs
|
cabal install cpphs hsb2hs
|
||||||
cabal install --ghc-options="-optl-mmacosx-version-min=10.6" --reinstall --flags="embed_data_files make-pandoc-man-pages" --ghc-options "-pgmP$CPPHS -optP--cpp" . pandoc-citeproc
|
cabal install --ghc-options="-optl-mmacosx-version-min=10.6" --reinstall --flags="embed_data_files make-pandoc-man-pages" --ghc-options "-pgmP$CPPHS -optP--cpp" . pandoc-citeproc
|
||||||
|
|
||||||
make -B man/man1/pandoc.1
|
|
||||||
# get pandoc-citeproc man page:
|
# get pandoc-citeproc man page:
|
||||||
PANDOC_CITEPROC_PATH=`cabal unpack -d $DIST pandoc-citeproc | awk '{print $3;}'`
|
PANDOC_CITEPROC_PATH=`cabal unpack -d $DIST pandoc-citeproc | awk '{print $3;}'`
|
||||||
|
|
||||||
|
@ -38,7 +37,7 @@ for f in pandoc pandoc-citeproc; do
|
||||||
cp $SANDBOX/bin/$f $DEST/bin/;
|
cp $SANDBOX/bin/$f $DEST/bin/;
|
||||||
done
|
done
|
||||||
cp $PANDOC_CITEPROC_PATH/man/man1/pandoc-citeproc.1 $DEST/share/man/man1/
|
cp $PANDOC_CITEPROC_PATH/man/man1/pandoc-citeproc.1 $DEST/share/man/man1/
|
||||||
cp man/man1/pandoc.1 $DEST/share/man/man1/pandoc.1
|
$SANDBOX/bin/pandoc --print-default-data-file pandoc.1 > $DEST/share/man/man1/pandoc.1
|
||||||
|
|
||||||
chown -R $ME:staff $DIST
|
chown -R $ME:staff $DIST
|
||||||
|
|
||||||
|
|
|
@ -106,6 +106,8 @@ Data-Files:
|
||||||
data/sample.lua
|
data/sample.lua
|
||||||
-- documentation
|
-- documentation
|
||||||
README, COPYRIGHT
|
README, COPYRIGHT
|
||||||
|
-- man page (generated by Setup.hs after build:)
|
||||||
|
data/pandoc.1
|
||||||
Extra-Source-Files:
|
Extra-Source-Files:
|
||||||
-- documentation
|
-- documentation
|
||||||
INSTALL, BUGS, CONTRIBUTING.md, changelog
|
INSTALL, BUGS, CONTRIBUTING.md, changelog
|
||||||
|
|
Loading…
Reference in a new issue