82fd635ac1
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1371 788f1e2b-df1e-0410-8736-df70ead52e1b
286 lines
9.5 KiB
Text
286 lines
9.5 KiB
Text
% Installing pandoc
|
|
|
|
Installing from Source
|
|
======================
|
|
|
|
This method will work on all architectures, but requires that you first
|
|
install the GHC compiler and some build tools: [GNU `make`], `sed`,
|
|
`bash`, and `perl`. These are standard on unix systems (including MacOS
|
|
X). If you're using Windows, you can install [Cygwin].
|
|
|
|
[Cygwin]: http://www.cygwin.com/
|
|
[GNU `make`]: http://www.gnu.org/software/make/
|
|
|
|
Installing GHC
|
|
--------------
|
|
|
|
To compile Pandoc, you'll need [GHC] version 6.6 or greater and [Cabal]
|
|
version 1.2 or greater. If you don't have GHC already, you can get it
|
|
from the [GHC Download] page. If you're compiling GHC from source, be
|
|
sure to get the `extralibs` in addition to the base tarball. GHC comes
|
|
with a version of Cabal. Note, however, that the version of Cabal that
|
|
comes with GHC 6.6 is not recent enough. So if you are using GHC 6.6,
|
|
you'll probably need to [install Cabal] separately. You can check your
|
|
Cabal version using `ghc-pkg list`.
|
|
|
|
If you're running MacOS X, it may be more convenient to install GHC
|
|
using [MacPorts] or [Fink].
|
|
|
|
If you're on a [debian]-based linux system (such as [Ubuntu]), you can get
|
|
GHC and the required libraries using `apt-get`:
|
|
|
|
sudo apt-get install ghc6 libghc6-xhtml-dev libghc6-mtl-dev libghc6-network-dev libghc6-utf8-string-dev
|
|
|
|
Otherwise, you should already have all the libraries you need except for
|
|
`utf8-string`. Download the [utf8-string] tarball from HackageDB, extract it, and
|
|
switch to that directory. Then:
|
|
|
|
runghc Setup.lhs configure
|
|
runghc Setup.lhs build
|
|
sudo runghc Setup.lhs install
|
|
|
|
[GHC]: http://www.haskell.org/ghc/
|
|
[GHC Download]: http://www.haskell.org/ghc/download.html
|
|
[Cabal]: http://www.haskell.org/cabal/
|
|
[install Cabal]: http://www.haskell.org/cabal/download.html
|
|
[MacPorts]: http://macports.org
|
|
[Fink]: http://finkproject.org
|
|
[Ubuntu]: http://www.ubuntu.com
|
|
[debian]: http://www.debian.org/
|
|
[utf8-string]: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/utf8-string
|
|
|
|
Getting the source
|
|
------------------
|
|
|
|
Download the source tarball from pandoc's [pandoc's google code site].
|
|
Extract the contents into a subdirectory:
|
|
|
|
tar xvzf pandoc-0.xy.tar.gz
|
|
|
|
[pandoc's google code site]: http://pandoc.googlecode.com
|
|
|
|
Installing Pandoc
|
|
-----------------
|
|
|
|
1. Change to the directory containing the Pandoc distribution.
|
|
|
|
2. Compile:
|
|
|
|
make
|
|
|
|
If you get "Unknown modifier" errors, it is probably because `make`
|
|
on your system is not [GNU `make`]. Try using `gmake` instead.
|
|
|
|
3. See if it worked (optional, but recommended):
|
|
|
|
make test
|
|
|
|
Note: if you see errors like the following, they're due to differences
|
|
between different versions of the xhtml library, and can safely be
|
|
disregarded:
|
|
|
|
2c2
|
|
< <html xmlns="http://www.w3.org/1999/xhtml"
|
|
---
|
|
> <html
|
|
|
|
4. Install:
|
|
|
|
sudo make install
|
|
|
|
Note: This installs `pandoc`, together with its wrappers and
|
|
documentation, into the `/usr/local` directory. If you'd rather
|
|
install `pandoc` somewhere else--say, in `/opt/local`--you can
|
|
set the `PREFIX` environment variable:
|
|
|
|
PREFIX=/opt/local sudo make install
|
|
|
|
If you don't have root privileges or would prefer to install
|
|
`pandoc` and the associated wrappers into your `~/bin` directory,
|
|
type this instead:
|
|
|
|
PREFIX=~ make install-exec
|
|
|
|
5. Build and install the Haskell libraries and library
|
|
documentation (optional--for Haskell programmers only):
|
|
|
|
make build-all
|
|
sudo make install-all
|
|
|
|
Note that building the library documentation requires [haddock].
|
|
|
|
[haddock]: http://www.haskell.org/haddock/
|
|
|
|
Installing pandoc using Cabal
|
|
-----------------------------
|
|
|
|
Pandoc can also be installed using the standard Haskell packaging tool,
|
|
[Cabal](http://www.haskell.org/cabal/). You'll need GHC 6.6 or greater
|
|
and Cabal 1.2 or greater (see [Installing GHC](#installing-ghc), above).
|
|
Just download the source tarball, unpack, and type:
|
|
|
|
runhaskell Setup.hs configure
|
|
runhaskell Setup.hs build
|
|
runhaskell Setup.hs haddock # optional, to build library documentation
|
|
runhaskell Setup.hs install # this one as root
|
|
|
|
This will install the pandoc executable and the Haskell libraries,
|
|
but not the shell scripts, man pages, or other documentation.
|
|
|
|
You may just want the executable, or just the libraries. This
|
|
can be controlled with configuration flags (the `-` negates the
|
|
flag):
|
|
|
|
runhaskell Setup.hs configure -f-library # just the executable
|
|
runhaskell Setup.hs configure -f-executable # just the libraries
|
|
|
|
Note: If you are using GHC 6.6.*, you will need to start by
|
|
replacing `pandoc.cabal` with a version suitable for GHC 6.6:
|
|
|
|
cp pandoc.cabal pandoc.cabal.orig
|
|
cp pandoc.cabal.ghc66 pandoc.cabal
|
|
|
|
Optional syntax highlighting support
|
|
------------------------------------
|
|
|
|
Pandoc can optionally be compiled with support for syntax highlighting of
|
|
delimited code blocks. This feature requires the [`highlighting-kate` library].
|
|
It also requires Cabal version 1.2 or greater.
|
|
|
|
If you are using Cabal to compile pandoc, specify the `highlighting` flag in
|
|
the configure step:
|
|
|
|
runhaskell Setup.hs configure -fhighlighting
|
|
|
|
If you are using the Makefile:
|
|
|
|
CABALOPTS=-fhighlighting make
|
|
|
|
If you have already built pandoc, you may need to do a `make clean` or
|
|
`runhaskell Setup.hs clean` first.
|
|
|
|
[`highlighting-kate` library]: http://johnmacfarlane.net/highlighting-kate
|
|
|
|
Removing Pandoc
|
|
---------------
|
|
|
|
Each of the installation steps described above can be reversed:
|
|
|
|
sudo make uninstall
|
|
|
|
PREFIX=~ make uninstall-exec
|
|
|
|
sudo make uninstall-all
|
|
|
|
Other targets
|
|
-------------
|
|
|
|
The following 'make' targets should not be needed by the average user,
|
|
but are documented here for packagers and developers:
|
|
|
|
### Building and installing
|
|
|
|
* `configure`: Performs the needed preprocessing to create a proper
|
|
Cabal package for Pandoc:
|
|
- Builds `ASCIIMathML.hs`, `DefaultHeaders.hs`, and `S5.hs`
|
|
from templates in `src/templates` and data in `src/ASCIIMathML.js`,
|
|
`src/ui`, and `src/headers`.
|
|
- Stores values of relevant environment variables in `vars` for
|
|
persistence.
|
|
- Runs Cabal's "configure" command.
|
|
* `build-exec`: Builds `pandoc` executable (using Cabal's "build"
|
|
command) and creates the wrappers `html2markdown` and `markdown2pdf`
|
|
from templates in `src/wrappers`.
|
|
* `build-doc`: Builds program documentation (e.g. `README.html`).
|
|
* `build-lib-doc`: Builds Haddock documentation for Pandoc libraries.
|
|
* `install-doc`, `uninstall-doc`: Installs/uninstalls user documentation
|
|
and man pages.
|
|
* `install-lib-doc`, `uninstall-lib-doc`: Installs/uninstalls library
|
|
documentation and man pages.
|
|
* `install-exec`, `uninstall-exec`: Installs/uninstalls programs
|
|
(`pandoc` and wrappers).
|
|
|
|
### Testing
|
|
|
|
* `test`: Runs Pandoc's test suite. (All tests should pass.)
|
|
* `test-markdown`: Runs the Markdown regression test suite, using
|
|
`pandoc --strict`. (Three of the tests will fail.)
|
|
|
|
### Cleaning
|
|
|
|
* `clean`: Restores directory to pre-build state, removing generated files.
|
|
* `distclean`: Like clean, but also cleans up files created by `make deb`.
|
|
|
|
### Packaging
|
|
|
|
* `tarball`: Creates a source tarball for distribution.
|
|
* `deb`: Creates debian packages in `..` directory.
|
|
* `macport`: Creates MacPorts Portfile in `macports` directory.
|
|
* `freebsd`: Creates freebsd Makefile and distinfo in `freebsd` directory.
|
|
* `win-pkg`: Creates a Windows binary package (presupposes `pandoc.exe`,
|
|
which must be created by building Pandoc on a Windows machine).
|
|
* `website`: Creates Pandoc's website in `web/pandoc` directory.
|
|
|
|
Installing pandoc using MacPorts
|
|
================================
|
|
|
|
This is an alternative to compiling from source on MacOS X.
|
|
[MacPorts] is a system for building and maintaining \*nix software
|
|
on MacOS X computers. If you don't already have MacPorts, follow
|
|
[these instructions for installing
|
|
it](http://trac.macosforge.org/projects/macports/wiki/InstallingMacPorts).
|
|
|
|
Once you've installed MacPorts, you can install pandoc by typing:
|
|
|
|
sudo port sync # to get the most recent ports
|
|
sudo port install pandoc
|
|
|
|
Since pandoc depends on GHC, the process may take a long time.
|
|
|
|
Installing the Windows binary
|
|
=============================
|
|
|
|
Simply download the zip file from [pandoc's google code site].
|
|
Extract the files from the archive, and put `pandoc.exe` somewhere
|
|
in your PATH.
|
|
|
|
Note that the Windows binary distribution does not include the shell
|
|
scripts `markdown2pdf`, `html2markdown`, or `hsmarkdown`. If you need
|
|
these, compile from source.
|
|
|
|
Installing pandoc on Debian
|
|
===========================
|
|
|
|
Pandoc is now in the debian unstable archive, and can be installed
|
|
using `apt-get` (as root):
|
|
|
|
apt-get install pandoc # the program, shell scripts, and docs
|
|
apt-get install libghc6-pandoc-dev # the libraries
|
|
apt-get install pandoc-doc # library documentation
|
|
|
|
Thanks to Recai Oktaş for setting up the debian packages.
|
|
|
|
Installing pandoc on FreeBSD
|
|
============================
|
|
|
|
Pandoc is in the FreeBSD ports repository (`textproc/pandoc`) and can be
|
|
installed in the normal way:
|
|
|
|
cd /usr/ports/textproc/pandoc
|
|
make install clean # as root
|
|
|
|
Alternatively, you can use `pkg_add`:
|
|
|
|
pkg_add -r pandoc
|
|
|
|
Note that the version of pandoc in FreeBSD's official repository may be
|
|
somewhat older than the most recent version.
|
|
|
|
Installing pandoc on Arch linux
|
|
===============================
|
|
|
|
Abhishek Dasgupta has created a binary package for `pandoc` in the
|
|
Arch linux repository. Arch users can install `pandoc` by typing
|
|
|
|
pacman -Sy pandoc
|
|
|