Skip to content

Commit

Permalink
Use system perl or no-op on windows (#33)
Browse files Browse the repository at this point in the history
Someone reported on Slack that MakieTeX doesn't work on windows, since Perl_jll doesn't build for the Windows platform. This PR works around that by using system Perl if it exists, or skipping it if it doesn't.

This currently executes on load but it may be worth it to execute on init instead, which would not be a difficult PR but would introduce some complications on how to handle this.
  • Loading branch information
asinghvi17 authored May 26, 2022
1 parent 3fada62 commit de353c8
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/rendering.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ function dvisvg()
return DVISVGM_PATH[]
end

# Since perl_jll doesn't build for windows we check this.
# todo define the function in a static block
@static if Sys.iswindows() # !hasproperty(Perl_jll, :perl)
if isnothing(Sys.which("perl"))
@warn "Perl not found! Skipping cropping step"
mtperl(f) = identity(f)
else
function mtperl(f)
f(`perl`)
end
end
else
mtperl(f) = Perl_jll.perl(f)
end


# The main compilation method - compiles arbitrary LaTeX documents
function compile_latex(
Expand Down Expand Up @@ -90,7 +105,7 @@ function compile_latex(
redirect_stderr(devnull) do
redirect_stdout(devnull) do
Ghostscript_jll.gs() do gs_exe
Perl_jll.perl() do perl_exe
mtperl() do perl_exe
run(`$perl_exe $pdfcrop --margin $crop_margins $() --gscmd $gs_exe temp.pdf temp_cropped.pdf`)
end
end
Expand Down

0 comments on commit de353c8

Please sign in to comment.