ProdriveTechnologies / bazel-latex

Bazel build system rules for LaTeX
Apache License 2.0
75 stars 37 forks source link

Add support for generating svgs from tex files #87

Closed solsjo closed 1 year ago

solsjo commented 2 years ago

This can be a nice feature when a .tex file contains a tikz figure.

This is enabled by exposing the dvisvgm binary in the defined latex texlive toolchan.

dvisvgm is dependent on ghostscript as a dynamic lib, which is why it has been added.

solsjo commented 2 years ago

Result from github actions here: https://github.com/solsjo/bazel-latex/actions/runs/2976895982

solsjo commented 2 years ago

One should be able to do something of the following to support testing on mac and windows as well: https://github.com/features/actions

    strategy:
      matrix:
        platform: [ubuntu-latest, macos-latest, windows-latest]
    runs-on: ${{ matrix.platform }}

That way we aren't in the dark about where things work or not.

Kernald commented 2 years ago

@patbro Do you have any objections about switching from Cirrus to GitHub Actions for CI? I'm happy to implement it if that's fine with you.

patbro commented 2 years ago

@patbro Do you have any objections about switching from Cirrus to GitHub Actions for CI? I'm happy to implement it if that's fine with you.

No, definitely not. Go ahead! You're in the lead to decide whatever works best for the repo.

solsjo commented 1 year ago

@patbro @Kernald , I have, as far as I’ve been able to, tried to handle and add support for OS X in svg generation. But there is still something failing. (Maybe if we build ghost script from source in the same pipeline?)

Can we move on with only Linux support to start with?

Kernald commented 1 year ago

@patbro @Kernald , I have, as far as I’ve been able to, tried to handle and add support for OS X in svg generation. But there is still something failing. (Maybe if we build ghost script from source in the same pipeline?)

Can we move on with only Linux support to start with?

I guess that would be acceptable for now, given two things:

I can take a look at it in a few days to try and figure out what's going on.

solsjo commented 1 year ago

@Kernald Thanks!

I'll update the readme.

Regarding os x, I suspect that it is related to runtime hardening. But I'm not certain. In that case (and I've only read at about it this far), solutions might involve passing the absolute path to --libgs, as dlopen might require that. It might be easy to fix by using run_shell instead of run.

E.g. ... actions.run_shell( cmd = ["--libgs=$(abs {})".format(libgs_path)], ) ...

I guess the best thing would have been to have a dvisvgm artifact statically linked to Ghostscript. (I did try that a few times) But not using the full texlive source. Only using the dvisvgm source. Should be something along the lines:

configure --disable-all-pkgs --enable-dvipdfm-x \
  -C CFLAGS=-g CXXFLAGS=-g

Though, that might require having a set of other dependencies available for dvisvgm.

solsjo commented 1 year ago

@Kernald The pipeline fails to download artifacts, seems like a temporary problem.

But I updated the dvisvgm rule to take the full path. If you could try that out locally, or re-trigger the pipeline at some point, that would be appreciated. I seem to lack permission to re-trigger.

patbro commented 1 year ago

@Kernald Perhaps a bit random, but mainly from a convenience perspective: I'm happy to add @solsjo as an external collaborator, might that help to make life a little easier? Let me know!

Kernald commented 1 year ago

@Kernald Perhaps a bit random, but mainly from a convenience perspective: I'm happy to add @solsjo as an external collaborator, might that help to make life a little easier? Let me know!

I'd be really happy with that! Life is sadly getting in the way at the moment...

solsjo commented 1 year ago

Support for OS X sort of in place 😊 Updated the README.

solsjo commented 1 year ago

@Kernald @patbro :)

solsjo commented 1 year ago

@patbro I accept 😊 I noticed that I now have merge capabilities. But I'd rather not merge my own commits in someone else's repo. I can wait patiently until you or @Kernald, consider it reviewed.