Typst typesetting system compiler port

For information, a port of the open source compiler and command-line tool of Typst, the trendy new typesetting system which seems to be promised to make many switching away from LaTeX, will be soon… stroke that, IS available on HaikuPorts depot:

https://depot.haiku-os.org/typst

Here a screenshot showing the package info, a test Typst file opened in Pe editor and the PDF rendition of this file via the typst command line program:

More info about Typst:

Please note that only the opensource compiler part (GitHub - typst/typst: A new markup-based typesetting system that is powerful and easy to learn.) is ported, there is no graphical IDE for it under Haiku.
Yet.

14 Likes

On the topic of alternatives to LaTeX… we also have the (incredibly small when compared to TeX/LaTex) “Basser Lout” typesetting system available on repos (and Pe has better support for it than any other editor on the planet, AFAIK :slight_smile:).

Albeit it seems only odd-balls like me ever heard, least make use, of Lout, so @phoudoin addition of a modern Tex/LaTeX alternative is great.

So… thanks @phoudoin! And nice to see you “back in action”!

As I was away from haiku community since long, I dunno how new haikuports are automatically built and pushed to public haikuports depot, and under which timespan.

I may look at how to add Typst syntax highlightning to Pe next

1 Like

Your PR already got merged, so it is only a matter of time before the package builders get to it, and the packages get available for installation via pkgman/HaikuDepot.

But the package builders have been experiencing some problems the last few days, so we may need to wait a bit longer for now.

1 Like

Small change needed for 32bit, commented on the PR, and thanks again!

My bad, I didn’t test the build on 32bits, I don’t have a 32bits haiku dev environment atm.

I’ll push a fix commit later today.

I just saw that the 64bits buildmaster succesfully built typst hpkg.

No problem, I find myself skipping 32bit checks more often these days too, where it was my primary target for years.

At the moment 64bit buildmaster is still stuck?

https://build.haiku-os.org/buildmaster/master/x86_64/?buildrunDir=&viewMode=expanded

Seems.

But at least, before that, it succeeded to build typst.

1 Like

Build failure on 32bit (OOM), so I guess that’s the end in trying to make it work there. :slight_smile:

https://build.haiku-os.org/buildmaster/master/x86_gcc2/logviewer.html?buildruns/7804/builds/85977.log

Yeah, I’m not surprised, even on x86_64, this (main) crate take both a very long time and large amount of RAM to succeed. On multiple time, because I had Web+ or too many apps opened eating a bit of my RAM, it failed there, while having only 8GB of RAM.

Okay, will disable the 32bits arch then.

The final ‘typst’ binary is ~38MB…

Rust is a pain with almost any package :slight_smile: don’t know how long it took me to get rav1e to build.

Maybe you could add a defineDebugInfoPackage to it to reduce the base binary? (didn’t check there myself).

Could do that.

Also, I saw that for rav1e port you defined every dependencies crates via SOURCE_URL to then build a cargo.toml from them and build with --frozen.

I didn’t follow this way of doing, as typst already list each crates with a frozen version in it.

Did I miss something on why it would be better to do as you did ?

I think I mostly followed Arch PKGBUILD file, it’s been a while since I looked at it, every time gives me the shivers :rofl:

So far there is no straightforward template on rust recipes, so if it works, go ahead with that one. :slight_smile:

There is sort of an informal policy that recipes should avoid downloading files during the build phase. In order to do that, the cargo file must be parsed and turned into source urls to be downloaded before the build starts.

Also, there is a script in the haikuporter repository which helps generate the source urls for rust recipes.

1 Like

Oh, you mean it breaks the download cache done by haikuporter ?
While it won’t re-download typst source tarball, during build it does, indeed, download each crate, without caching it somewhere to avoid this step next haikuporter run.

Damn, typst have more than 125 direct dependencies crates, and with indirect it’s > 350!

Oh my.

Will check for this helper script, then.

Thanks.

The cache has been disabled for a few years.

But it’s the general idea, yes. Unfortunately some recipes had to be deleted because the sources are lost, and not available anywhere on the internet anymore.

The cache may come back after some refactoring of haikuporter to be able to store data in S3 buckets instead of regular storage, apparently that will allow to save a lot of hosting costs on caches and other storage (i know nothing about modern coud hosting, so that’s only what I understood from kallisti5’s explanations)

I don’t tend to list all crates in rust recipes, some of them can go up in the hunderds, the sources for these crates are mentioned in the Cargo.lock file which contains checksum on all of them, works well enough for “me”.

Example:

[[package]]
name = "adler2"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"

Package is now available on HaikuPorts depot:

https://depot.haiku-os.org/typst

4 Likes

BTW, how one, if it’s even possible, could add the package an icon, so in haikudepot (web site like the app) the package is displayed with a custom icon, not the generic package one ?