How to build MuPDF

## License

MuPDF is Copyright (c) 2006-2019 Artifex Software, Inc.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/

For commercial licensing, including our "Indie Dev" friendly options, please contact Artifex Software.

## Download

The latest development source is available directly from the git repository:

    git clone --recursive git://git.ghostscript.com/mupdf.git

In the mupdf directory, update the third party libraries:

    git submodule update --init

## Compiling on Windows

On Windows there is a Visual Studio project file in `platform/win32/mupdf.vcproj`.

## Compiling on Linux

If you are compiling from source you will need several third party libraries: freetype2, jbig2dec, libjpeg, openjpeg, and zlib. These libraries are contained in the source archive. If you are using git, they are included as git submodules.

You will also need the X11 headers and libraries if you're building on Linux. These can typically be found in the xorg-dev package. Alternatively, if you only want the command line tools, you can build with HAVE_X11=no.

The new OpenGL-based viewer also needs OpenGL headers and libraries. If you're building on Linux, install the mesa-common-dev, libgl1-mesa-dev packages, and libglu1-mesa-dev packages. You'll also need several X11 development packages: xorg-dev, libxcursor-dev, libxrandr-dev, and libxinerama-dev. To skip building the OpenGL viewer, build with HAVE_GLUT=no.

To install the viewer, command line tools, libraries, and header files on your system:

    make prefix=/usr/local install

To install only the command line tools, libraries, and headers invoke make like this:

    make HAVE_X11=no HAVE_GLUT=no prefix=/usr/local install