git.iko.soy/typeable/pandoc
on mallard help sign in
234 lines 7.6 kB history raw
1% Installing pandoc
3These instructions explain how to install pandoc from source.
4Binary packages or ports of pandoc are available for freebsd
5and several linux distributions, so check your package manager.
6There are also binary installers for Windows and Mac OS X.
8If you are installing the development version from github, see also:
9https://github.com/jgm/pandoc/wiki/Installing-the-development-version-of-pandoc
11Quick install with stack
12------------------------
141. Install [stack](http://docs.haskellstack.org/en/stable/install_and_upgrade.html).
162. If you used git to get the pandoc source (as opposed to unpacking
17 a release tarball), do
19 git submodule update --init
213. In the pandoc source directory,
23 stack install
25 You may be prompted to run `stack setup`, which will automatically
26 download the ghc compiler if needed.
29Quick install with cabal
30------------------------
321. Install the [Haskell platform]. This will give you [GHC] and
33 the [cabal-install] build tool.
352. Update your package database:
37 cabal update
393. Use `cabal` to install pandoc and its dependencies:
41 cabal install pandoc
43 This procedure will install the released version of pandoc,
44 which will be downloaded automatically from HackageDB.
46 If this step fails, and you are using an older version
47 of the Haskell Platform, e.g. on Debian stable, you may need to
48 upgrade your version of cabal:
50 cabal install cabal-install
51 ~/.cabal/bin/cabal update
52 ~/.cabal/bin/cabal install pandoc
54 If you want to install a modified or development version
55 of pandoc instead, switch to the source directory and do
56 as above, but without the 'pandoc':
58 cabal install
60 Note: If you obtained the source from the git repository (rather
61 than a release tarball), you'll need to do
63 git submodule update --init
65 to fetch the contents of `data/templates` before `cabal install`.
674. Make sure the `$CABALDIR/bin` directory is in your path. You should
68 now be able to run `pandoc`:
70 pandoc --help
72 [Not sure where `$CABALDIR` is?](http://www.haskell.org/haskellwiki/Cabal-Install#The_cabal-install_configuration_file)
745. If you want to process citations with pandoc, you will also need to
75 install a separate package, `pandoc-citeproc`. This can be installed
76 using cabal:
78 cabal install pandoc-citeproc
80 By default `pandoc-citeproc` uses the "i;unicode-casemap" method
81 to sort bibliography entries (RFC 5051). If you would like to
82 use the locale-sensitive unicode collation algorithm instead,
83 specify the `unicode_collation` flag:
85 cabal install pandoc-citeproc -funicode_collation
87 Note that this requires the `text-icu` library, which in turn
88 depends on the C library `icu4c`. Installation directions
89 vary by platform. Here is how it might work on OSX with homebrew:
91 brew install icu4c
92 cabal install --extra-lib-dirs=/usr/local/Cellar/icu4c/51.1/lib \
93 --extra-include-dirs=/usr/local/Cellar/icu4c/51.1/include \
94 -funicode_collation text-icu pandoc-citeproc
96The `pandoc.1` man page will be installed automatically. cabal shows
97you where it is installed: you may need to set your `MANPATH`
98accordingly. If `README` has been modified, the man page can be
99rebuilt: `make man/pandoc.1`.
101The `pandoc-citeproc.1` man page will also be installed automatically.
103[GHC]: http://www.haskell.org/ghc/
104[Haskell platform]: http://hackage.haskell.org/platform/
105[cabal-install]: http://hackage.haskell.org/trac/hackage/wiki/CabalInstall
107Custom install
108--------------
110This is a step-by-step procedure that offers maximal control
111over the build and installation. Most users should use the
112quick install, but this information may be of use to packagers.
113For more details, see the [Cabal User's Guide]. These instructions
114assume that the pandoc source directory is your working directory.
1161. Install dependencies: in addition to the [Haskell platform],
117 you will need a number of additional libraries. You can install
118 them all with
120 cabal update
121 cabal install --only-dependencies
1232. Configure:
125 cabal configure --prefix=DIR --bindir=DIR --libdir=DIR \
126 --datadir=DIR --libsubdir=DIR --datasubdir=DIR --docdir=DIR \
127 --htmldir=DIR --program-prefix=PREFIX --program-suffix=SUFFIX \
128 --mandir=DIR --flags=FLAGSPEC
130 All of the options have sensible defaults that can be overridden
131 as needed.
133 `FLAGSPEC` is a list of Cabal configuration flags, optionally
134 preceded by a `-` (to force the flag to `false`), and separated
135 by spaces. Pandoc's flags include:
137 - `embed_data_files`: embed all data files into the binary (default no).
138 This is helpful if you want to create a relocatable binary.
139 Note: if this option is selected, you need to install the
140 `hsb2hs` preprocessor: `cabal install hsb2hs` (version 0.3.1 or
141 higher is required).
143 - `https`: enable support for downloading resources over https
144 (using the `http-client` and `http-client-tls` libraries).
1463. Build:
148 cabal build
1504. Build API documentation:
152 cabal haddock --html-location=URL --hyperlink-source
1545. Copy the files:
156 cabal copy --destdir=PATH
158 The default destdir is `/`.
1606. Register pandoc as a GHC package:
162 cabal register
164 Package managers may want to use the `--gen-script` option to
165 generate a script that can be run to register the package at
166 install time.
168Creating a relocatable binary
169-----------------------------
171It is possible to compile pandoc such that the data files
172pandoc uses are embedded in the binary. The resulting binary
173can be run from any directory and is completely self-contained.
175 cabal install hsb2hs # a required build tool
176 cabal install --flags="embed_data_files" citeproc-hs
177 cabal configure --flags="embed_data_files"
178 cabal build
180You can find the pandoc executable in `dist/build/pandoc`. Copy this wherever
181you please.
183Or alternatively with `stack`:
185 stack install pandoc --flag pandoc:embed_data_files
187[zip-archive]: http://hackage.haskell.org/package/zip-archive
188[highlighting-kate]: http://hackage.haskell.org/package/highlighting-kate
189[blaze-html]: http://hackage.haskell.org/package/blaze-html
190[Cabal User's Guide]: http://www.haskell.org/cabal/release/latest/doc/users-guide/builders.html#setup-configure-paths
192Running tests
193-------------
195Pandoc comes with an automated test suite integrated to cabal.
196To build the tests:
198 cabal configure --enable-tests && cabal build
200To run the tests:
202 cabal test
204To run particular tests (pattern-matching on their names), use
205the `-t` option:
207 cabal test --test-options='-t markdown'
209If you add a new feature to pandoc, please add tests as well, following
210the pattern of the existing tests. The test suite code is in
211`tests/test-pandoc.hs`. If you are adding a new reader or writer, it is
212probably easiest to add some data files to the `tests` directory, and
213modify `tests/Tests/Old.hs`. Otherwise, it is better to modify the module
214under the `tests/Tests` hierarchy corresponding to the pandoc module you
215are changing.
217Running benchmarks
218------------------
220To build the benchmarks:
222 cabal configure --enable-benchmarks && cabal build
224To run the benchmarks:
226 cabal bench
228To use a smaller sample size so the benchmarks run faster:
230 cabal bench --benchmark-options='-s 20'
232To run just the markdown benchmarks:
234 cabal bench --benchmark-options='markdown'