On Mon Aug 15, 2022 at 2:03 PM CEST, amano.kenji via ntg-context wrote:
TexLive has texmfcnf.lua that doesn't really work with texlive-context installed by linux distributions.
Arch Linux has its own patched version of texmfcnf.lua.
It seems I'd be better off with a linux package for ConTeXt LMTX.
How can I build and install ConTeXt LMTX on Gentoo Linux or any linux distribution?
I wish it was as simple as ./configure, make, and make install.
Some of the problems were mentioned in previous discussions. Like: - you would need to maintain your own "snapshots" of the current ConTeXt (or make use of the public git mirror) - you currently can't build luametatex binary from source, you would have to download it prebuilt (and also keep snapshots of it) - different directory structure expected by Linux distributions (FHS, "file hierarchy standard") vs TeX (TDS, "TeX directory structure") In addition, there are still many uncertain things, like how you want to handle fonts: - install some with ConTeXt? (In that case you might distribute fonts already available in your Linux distribution) - use system ones? (Then your documents may be subject to breakages from uncoordinated updates - ConTeXt has goodie files tuned to particular versions of fonts) Also, AFAIK, packages are diligent with keeping license information and documentation, you would have to decide how that information would be kept (this is mostly the directory structure problem). With that said, taking Hans' instructions as a start: On Fri Aug 19, 2022 at 3:11 PM CEST, Hans Hagen via ntg-context wrote:
Not sure what you mean here but basically a (future) installation is:
- unzip the main zip file - goto the source subtree - run build.sh (assumes compiler and cmake installed) - move the binary file to the relevant bin location - set symlinks from luametatex to mtsrun and context - copy mtxrun.lua and context.lue there too - adapt your path - maybe add texmf-fonts and texmf-projects - and you're done
You need two things from ConTeXt: texmf directories (there are two provided by ConTeXt "texmf-context" - what you really need, "texmf" - mostly fonts) and the luametatex binary. For simplicity let's only include "texmf-context": In that case you need to extract "mtxrun" (rename to "luametatex") from http://lmtx.pragma-ade.nl/install-lmtx/context-linux-64.zip and download the "texmf-context" texmf tree from http://lmtx.pragma-ade.nl/install-lmtx/texmf-context.zip. This is how you get luametatex to execute script like mtxrun or context: - luametatex binary gets executed with name (argv[0]) <script> - <script>.lua from the same directory gets executed If you setup paths correctly, you can run all ConTeXt scripts with mtxrun --script <script> E.g. mtxrun --script context Is equivalent to `context`. So having mtxrun is enough. But you need to tell it how to find the files from texmf. `texmfcnf.lua` configuration file is used for that. ConTeXt has a few hardcoded directories where it looks for these files [1], but you can use the `TEXMFCNF` environment variable to override this (usually variables can be also looked up from config files, but there is a bit of bootstrapping problem here - ConTeXt allows setting of TEXMFCNF also in config files, but then it gets a bit hairy and I didn't investigate that). I may have got the wrong impression, but I didn't get multiple configuration files working. In the config file, you can see the settings of some special variables like TEXINPUTS (this one tells TeX where to look for .tex files). You should keep them like they are, since they implement the TDS. They all refer to the TEXMF variable, where I advise changing things. You can structure TEXMF trees in any way you like and would probably have to decide what is the best way for Gentoo. [1]: https://github.com/vlasakm/context/blob/419cacd966ab0adcb9451b60c9fd98790cce... It seems that getting file finding to work is everything you need. ConTeXt automatically generates the file finding caches, format files, etc. I prepared a proof of concept, that I am ready to take down immediately at Hans' request, since I don't handle license information properly, and texmf-context is stripped down (just so that the downloads are not too big for proof of concept). https://github.com/vlasakm/context There is documentation about how it can be used. I hope its obvious how I got "texmf" (texmf-context.zip, unzip, delete some files I didn't want to take up space), "luametatex" (copy the binary from installation zip or download from build farm) and texmcnf.lua (copy of the fallback contextcnf.lua where I made modifications to leverage TEXMFDOTDIR and TEXMF even as a user interface). The rest is the `mtxrun` shell script which is what the user runs. This is what runs luametatex with the name `mtxrun` (using "exec -a"). Normally you would just symlink mtxrun to luametatex, but I also had some trouble setting TEXMFCNF otherwise, so I just put both things in this one script. After this, mtxrun.lua is executed, which is symlinked by the Makefile - the last thing in the repository. This is essentially what you wanted, a possibility to `make install` ConTeXt. I didn't script the downloading and unzipping part. The install target just copies things to /bin and /share and symlinks mtxrun.lua from /bin to /share. Standard `PREFIX` and `DESTDIR` variables are used (I believe they originate from the "GNU coding standards", if you are not familiar with them). I pushed a release, so you can download a tarball from a convenient address: https://github.com/vlasakm/context/releases/tag/v20220821 I am not really familiar with ebuild, but I am sure you can get it working. Though the crucial parts for you mtxrun, and partly texmfcnf.lua, you still have to do (and mainly decide) things yourself. I got it working with Debian, RPM and Arch Linux packaging tools / formats: https://build.opensuse.org/package/show/home:lahcim8/context Essentially the following needs to run somewhere in the build scripts: make DESTDIR=... PREFIX=... install Downloads for a couple of distros are available here: https://software.opensuse.org/download.html?project=home%3Alahcim8&package=context Although from brief testing only Arch Linux works correctly, Debian can't find system fonts and on Fedora even file finding doesn't work. A bit of a disclaimer: I don't really recommend pursuing this further. Some time ago I was also that foolish to try to package TeX for Linux distributions. Unfortunately I think that the result will never by optimal - as demonstrated by the previous discussions, the usual purposes of packages (to integrate software into the system) don't apply much to TeX / ConTeXt - there one wants something more or less self contained (so that updates are under control, no random non-essential libraries brake things, etc.). Good luck. Michal Vlasák