| 1 |
Installation guide |
| 2 |
================== |
| 3 |
|
| 4 |
This installation guide focuses on packaging for redistribution. For |
| 5 |
the final user, it is recommended to install via LuaRocks or using the |
| 6 |
self-installing script; see the [README](README.md) for details. |
| 7 |
|
| 8 |
Digestif has the following dependencies: |
| 9 |
|
| 10 |
* Lua version 5.3 or 5.4 |
| 11 |
* LPeg (https://luarocks.org/modules/gvvaughan/lpeg) |
| 12 |
* LuaFileSystem (https://luarocks.org/modules/hisham/luafilesystem) |
| 13 |
* cjson (optional, https://luarocks.org/modules/openresty/lua-cjson) |
| 14 |
* LuaZip (optional, https://luarocks.org/modules/mpeterv/luazip) |
| 15 |
|
| 16 |
If the cjson library is missing, Digestif uses its own LPeg-based JSON |
| 17 |
serializer, which is slower but adequate. LuaZip is required only |
| 18 |
when placing the data files in a zip archive. |
| 19 |
|
| 20 |
All shell commands and file name references assume that the directory |
| 21 |
containing this file is the current directory. |
| 22 |
|
| 23 |
Standard packaging |
| 24 |
------------------ |
| 25 |
|
| 26 |
For a regular installation of Digestif into, say, `PREFIX=/usr`, copy |
| 27 |
the files as follows: |
| 28 |
|
| 29 |
install -Dt $PREFIX/bin bin/digestif |
| 30 |
install -Dt $PREFIX/share/lua/$LUA_VERSION digestif |
| 31 |
install -Dt $PREFIX/share/digestif data/*.tags |
| 32 |
|
| 33 |
Before doing so, however, consider the following: |
| 34 |
|
| 35 |
1. In order for the tags files to be found, add the following at the |
| 36 |
top of the `bin/digestif` script: |
| 37 |
|
| 38 |
require "digestif.config".data_dirs = {"$PREFIX/share/digestif"} |
| 39 |
|
| 40 |
2. Make sure the `package.path` Lua variable includes the directory |
| 41 |
into which the `digestif` directory is installed. |
| 42 |
|
| 43 |
3. It is recommended that the `package.path` and `package.cpath` Lua |
| 44 |
variables do not include the default relative entries such as |
| 45 |
`./?.lua`. This is especially important if any of the optional |
| 46 |
dependencies are not installed. |
| 47 |
|
| 48 |
4. If LuaZip is available, the tags files may also be placed in a zip |
| 49 |
file: |
| 50 |
|
| 51 |
zip -j data.zip data/*.tags |
| 52 |
install -Dt $PREFIX/share/digestif data.zip |
| 53 |
|
| 54 |
In this case, add the following line at the top of `bin/digestif`: |
| 55 |
|
| 56 |
require "digestif.config".data_dirs = {"$PREFIX/share/digestif/data.zip"} |
| 57 |
|
| 58 |
Packaging for a TeX distribution |
| 59 |
-------------------------------- |
| 60 |
|
| 61 |
For an installation depending only on the `texlua` interpreter from |
| 62 |
LuaTeX (which bundles all dependencies except the optional cjson), |
| 63 |
create a zip file containing `digestif/*.lua` and `data/*.tags` (no |
| 64 |
subdirectories), place it anywhere kpathsearch will find it and use |
| 65 |
the `bin/digestif.texlua` executable script. For instance: |
| 66 |
|
| 67 |
zip -j digestif.zip digestif/*.lua data/*.tags |
| 68 |
install -Dt $TEXMF/scripts digestif.zip |
| 69 |
install bin/digestif.texlua $PREFIX/bin/digestif |
| 70 |
|
| 71 |
Unbundled installation |
| 72 |
---------------------- |
| 73 |
|
| 74 |
To install Digestif on a directory of its own, say |
| 75 |
`PREFIX=/opt/digestif`, copy the `bin`, `data` and `digestif` folders |
| 76 |
and add a symlink of the executable script somewhere in the `PATH`. |
| 77 |
For instance: |
| 78 |
|
| 79 |
install -Dt $PREFIX bin data digestif |
| 80 |
ln -s $PREFIX/bin/digestif /opt/bin/digestif |