[luatex] LuaTeX as a Library
Nicolas.Holzschuch at inria.fr
Mon Nov 20 10:31:43 CET 2017
100 % agree with everything you say.
I'm not sure there is a strong demand for "luatex-as-a-library" (right now it seems it's at most 3 people worlwide...), but I agree with you.
> On 19 Nov 2017, at 19:10, Mojca Miklavec <mojca.miklavec.lists at gmail.com> wrote:
> On 19 November 2017 at 17:47, Nicolas Holzschuch wrote:
>> If you're not compiling for iOS, you will need to edit the Makefiles a bit. I'm open to suggestions in
>> how to make the changes more compatible with other platforms.
> Sorry for being totally off-topic, but some random thoughts ...
> - (It would be a lot easier for you to work with patches if luatex
> development would switch to git. You patches become hard to track as
> LuaTeX keeps changing. It might be easier to work if someone would
> make a git repository tracking subversion and updating the repository
> on regular basis, so that your patches in a special feature branch
> could be clearly distinguished from upstream changes.)
> - Independent of whether or not that ever happens: it would help a lot
> if you send patches like "fixing a million memory leaks" to Luigi, so
> that he would incorporate them and they would end up upstream. Then
> you would only need to keep track of other, more non-straightforward
> patches needed to reach your goal.
Will do. To be clear, said memory leaks only happened because, if you run in a library, you have to explicitly release all memory after the compilation (as opposed to an app). They are not impacting luatex-as-an-app. So I would say they are low-priority.
> - I assume that many cases where "#ifdef __IPHONE__" is used are not
> really specific to IPHONE, but to the way a library works and would be
> just as well needed on Android or any other device where the "start
> once and flush everything" paradigm isn't the most suitable one. So
> the patches *may* need a bit more tweaking. (But tweaking them would
> be a lot easier if the first two points would be addressed.)
Good points. Basically, there are two kind of changes:
- not calling system(), fork() and exec() because these are unavailable in a sandboxed environment.
- initializing all variables at the start, releasing all allocated memory at the end.
The former is specific to iOS, the latter is generic. I should have separated them with different #defines, such as __IPHONE__ and LIBRARY.
Then again, if you are using a luatex-as-a-library, it's probably because you don't have access to system() or fork()/exec(). So...
Maybe NO_SYSTEM and LIBRARY, then.
> - Regarding the need for editing Makefile-s. I recently discovered an
> awesome cross-platform build tool called meson. Porting the sources to
> meson would probably require a whole lot of work, but if this was ever
> done, it would be an awesome simplification of the current build
> system that would also work natively on Windows (as well as other
> platforms, including iPhone). Changing raw Makefiles is super tedious
> and non-repeatable, but doing the right minor change in the build
> specification will make your changes work correctly on all platforms
> "for free".
More information about the luatex