Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added docs for Linux packaging. #2980

Merged
merged 1 commit into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ not generally supported:
command line.


Packaging
---------

See :doc:`packaging`.


Enabling Integrated OCR Support
---------------------------------------------------------

Expand Down
97 changes: 97 additions & 0 deletions docs/packaging.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
.. include:: header.rst


Packaging for Linux distributions
=================================


Requirements
------------

* Python
* MuPDF checkout (including submodules).
* PyMuPDF checkout.
* System packages listed in `scripts/sysinstall.py:g_sys_packages`.
* Python packages listed in `pyproject.toml`.

Extra requirements for running tests:

* Python packages listed in `scripts/gh_release.py:test_packages`.


General steps
-------------

* Build and install MuPDF:

* Install required system packages.
* Run `make install-shared-python` on MuPDF's `Makefile` with at least
these make variables:

* `DESTDIR` set to the install directory, e.g. `/`.
*
`prefix` set to location relative to DESTDIR, such as `/usr/local` or
`/usr`. Must start with `/`.
* `USE_SYSTEM_LIBS=yes`.
* `HAVE_LEPTONICA=yes`.
* `HAVE_TESSERACT=yes`.

* Build and install PyMuPDF:

*
Run `pip install ./PyMuPDF` or `pip wheel ./PyMuPDF` with at least these
environment variables:

*
`PYMUPDF_SETUP_MUPDF_BUILD=` (empty string) to prevent download and build
of hard-coded MuPDF release.
*
`CFLAGS`, `CXXFLAGS` and `LDFLAGS` set to allow visibility of the
installed MuPDF headers and shared libraries.
*
`PYMUPDF_SETUP_IMPLEMENTATIONS=b` to build only the rebased
implementation. [This will become the default in a future release.]

* Run PyMuPDF tests:

* Ensure required Python packages are available.
*
Run `pytest -k "not test_color_count" PyMuPDF` (test `test_color_count` is
known fail if MuPDF is not built with PyMuPDF's custom config.h).


Use of scripts/sysinstall.py
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

`scripts/sysinstall.py` provides a useful example of build commands
that are known to to work, because it does a build, install and test
using a local fake root director and is run regularly by Github action
`.github/workflows/test_sysinstall.yml`.

* Run with `-h` or look at the doc-string to see detailed usage information.
* It uses Debian-style `apt` commands to install system packages.
* By default it assumes local git checkouts `mupdf/` and `PyMuPDF/`.
*
It currently installs only into a fake root directory because `pip` cannot
do a system install; the commands will need to be modified to install into
`/usr` or `/usr/local`.

To run a full build, install and test in a local fake root:

.. code-block:: shell

./PyMuPDF/scripts/sysinstall.py

To see what commands would be run without actually running them:

.. code-block:: shell

./PyMuPDF/scripts/sysinstall.py -m 0 -p 0 -t 0


See also
--------

*
`setup.py`'s initial doc-comment has detailed information about the
environment variables used when building PyMuPDF.
Loading