summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--INSTALL15
-rw-r--r--Setup.hs26
-rwxr-xr-xmake_deb.sh2
-rwxr-xr-xmake_osx_package.sh2
-rw-r--r--pandoc.cabal3
5 files changed, 27 insertions, 21 deletions
diff --git a/INSTALL b/INSTALL
index 88d962a85..2b32524e5 100644
--- a/INSTALL
+++ b/INSTALL
@@ -75,17 +75,12 @@ Quick install
--extra-include-dirs=/usr/local/Cellar/icu4c/51.1/include \
-funicode_collation text-icu pandoc-citeproc
-To build the `pandoc.1` man page:
+The `pandoc.1` man page will be built and installed automatically.
+The build process shows you where it is installed: you may need
+to set your `MANPATH` accordingly.
- pandoc --print-default-data-file pandoc.1 > pandoc.1
-
-To build the `pandoc-citeproc` man pages, go to the pandoc-citeproc
-build directory, and
-
- cd man
- make
-
-The man page will be created in the `man1` subdirectory.
+The `pandoc-citeproc.1` man page will also be built and installed
+automatically.
[GHC]: http://www.haskell.org/ghc/
[Haskell platform]: http://hackage.haskell.org/platform/
diff --git a/Setup.hs b/Setup.hs
index 03e3248ef..c72e5b10b 100644
--- a/Setup.hs
+++ b/Setup.hs
@@ -18,11 +18,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import Distribution.Simple
import Distribution.Simple.PreProcess
+import Distribution.Simple.InstallDirs (mandir)
import Distribution.PackageDescription (PackageDescription(..), Executable(..))
import System.Process ( rawSystem )
import System.FilePath ( (</>) )
import System.Directory ( findExecutable )
-import Distribution.Simple.Utils (info, rawSystemExit)
+import Distribution.Simple.Utils (info, notice, rawSystemExit, installOrdinaryFile)
import Distribution.Simple.Setup
import Distribution.Simple.LocalBuildInfo
import Distribution.Verbosity
@@ -32,7 +33,11 @@ main = defaultMainWithHooks $ simpleUserHooks {
-- enable hsb2hs preprocessor for .hsb files
hookedPreProcessors = [ppBlobSuffixHandler]
, postBuild = \args bf pkgdescr lbi ->
- makeManPages args bf pkgdescr lbi
+ makeManPage args bf pkgdescr lbi
+
+ , postCopy = \_ flags pkg lbi ->
+ installManpage pkg lbi (fromFlag $ copyVerbosity flags)
+ NoCopyDest
}
ppBlobSuffixHandler :: PPSuffixHandler
@@ -48,10 +53,10 @@ ppBlobSuffixHandler = ("hsb", \_ _ ->
return ()
})
-makeManPages :: Args -> BuildFlags -> PackageDescription -> LocalBuildInfo
- -> IO ()
-makeManPages _ bf _ LocalBuildInfo{buildDir=buildDir}
- = do info verbosity "Creating data/pandoc.1"
+makeManPage :: Args -> BuildFlags -> PackageDescription -> LocalBuildInfo
+ -> IO ()
+makeManPage _ bf _ LocalBuildInfo{buildDir=buildDir}
+ = do notice verbosity "Creating man/pandoc.1"
rawSystemExit verbosity progPath args
where verbosity = fromFlagOrDefault normal $ buildVerbosity bf
progPath = buildDir </> "pandoc" </> "pandoc"
@@ -60,5 +65,12 @@ makeManPages _ bf _ LocalBuildInfo{buildDir=buildDir}
"--filter", "man/capitalizeHeaders.hs",
"--filter", "man/removeNotes.hs",
"--filter", "man/removeLinks.hs",
- "-o", "data/pandoc.1"]
+ "-o", "man/pandoc.1"]
+installManpage :: PackageDescription -> LocalBuildInfo
+ -> Verbosity -> CopyDest -> IO ()
+installManpage pkg lbi verbosity copy = do
+ let mandest = mandir (absoluteInstallDirs pkg lbi copy) </>
+ "man1" </> "pandoc.1"
+ notice verbosity $ "Copying man page to " ++ mandest
+ installOrdinaryFile verbosity ("man" </> "pandoc.1") mandest
diff --git a/make_deb.sh b/make_deb.sh
index b61a43d32..a5aaf1549 100755
--- a/make_deb.sh
+++ b/make_deb.sh
@@ -42,7 +42,7 @@ mkdir -p $DEST/share/doc/pandoc-citeproc
find $DIST -type d | xargs chmod 755
cp $SANDBOX/bin/pandoc $DEST/bin/
cp $SANDBOX/bin/pandoc-citeproc $DEST/bin/
-$SANDBOX/bin/pandoc --print-default-data-file pandoc.1 > $DEST/share/man/man1/pandoc.1
+cp $SANDBOX/share/man/man1/pandoc.1 $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/
gzip -9 $DEST/share/man/man1/pandoc-citeproc.1
diff --git a/make_osx_package.sh b/make_osx_package.sh
index 32314f967..e86ed18f2 100755
--- a/make_osx_package.sh
+++ b/make_osx_package.sh
@@ -37,7 +37,7 @@ for f in pandoc pandoc-citeproc; do
cp $SANDBOX/bin/$f $DEST/bin/;
done
cp $PANDOC_CITEPROC_PATH/man/man1/pandoc-citeproc.1 $DEST/share/man/man1/
-$SANDBOX/bin/pandoc --print-default-data-file pandoc.1 > $DEST/share/man/man1/pandoc.1
+cp $SANDBOX/share/man/man1/pandoc.1 $DEST/share/man/man1/pandoc.1
chown -R $ME:staff $DIST
diff --git a/pandoc.cabal b/pandoc.cabal
index 8d69358fb..54e09d38f 100644
--- a/pandoc.cabal
+++ b/pandoc.cabal
@@ -106,8 +106,6 @@ Data-Files:
data/sample.lua
-- documentation
README, COPYRIGHT
- -- man page (generated by Setup.hs after build:)
- data/pandoc.1
Extra-Source-Files:
-- documentation
INSTALL, BUGS, CONTRIBUTING.md, changelog
@@ -206,6 +204,7 @@ Extra-Source-Files:
tests/epub/*.native
tests/txt2tags.t2t
tests/twiki-reader.twiki
+Extra-Tmp-Files: man/pandoc.1
Source-repository head
type: git