LaTeXML Portfile issues

Joshua Root jmr at
Fri Jul 4 05:35:30 PDT 2014

On 2014-7-4 21:15 , Bruce Miller wrote:
> Hi all;
>   I'd like to draw attention to the ticket
> where there are a couple of issues to improve
> the Portfile.
> Basically, during installation, I'd like to
> be able to detect whether there is _any_
> TeX installation available (whether MacPort's
> own texlive, or MacTeX or _any_ other TeX).
> This allows LaTeXML to install it's own style
> files into the TeX distribution.  I attempted
> to do this by looking for "kpsewhich",
> but it turns out that the user's $PATH is not
> visible within port.  Is there any approved
> way to do this?

No, the user's PATH is just gone after we set our own. More generally,
ports that build differently depending on what the user happens to have
installed at the time are strongly discouraged, as among other things
this means such ports don't work properly in conjunction with prebuilt
archives, and it's also difficult to reproduce issues that are specific
to the user's setup.

> I fixed (I think) the post-activate to attempt
> to run mktexlsr more safely, using
>   { catch { exec "mktexlsr" } }
> instead of
>   { system "mktexlsr" }
> Is that reasonable? (I'm not a TCL programmer,
> but it seems to work)

Exec is different to system in that exec gives you the command's output
as its return value, whereas system sends the output to stdout/stderr
and the log file. You can catch errors thrown by either of them, or you
can run something like "mktexlsr || true". If you want to log the output
of mktexlsr then you want system.

> After doing that, it revealed the old
> perl version path problem. Namely, the executables
> were installed into /opt/local/libexec/perl5.16/sitebin,
> which is not in the typical user's path.  I "fixed"
> that by making symlinks from /opt/local/bin to the
> installed locations.  Is that acceptable, or
> is there a better way to achieve the same effect?

That's fine. The perl5 portgroup will create these links for you, and
you can clear perl5.link_binaries_suffix to make the links not have a
trailing perl version in their names.

> Namely, LaTeXML is an _application_; the user doesn't
> care that it's written in Perl (and in fact it works
> on all perl versions from 5.8.5 through 5.20 RC1).
> Likewise, I don't particularly care where the executables
> are installed, so long as they end up visible in $PATH
> either by putting them in a standard place or automatically
> modifying $PATH.
> That is to say, it seems reasonable that a user ought
> to be able to run
>   sudo port install SomeApplication
> and immediately be able to run
>   SomeApplication


- Josh

More information about the macports-dev mailing list