Skip to content

fix: unblock jcpan -t LaTeXML configure phase#641

Merged
fglock merged 1 commit intomasterfrom
fix/jcpan-latexml-makemaker
Apr 30, 2026
Merged

fix: unblock jcpan -t LaTeXML configure phase#641
fglock merged 1 commit intomasterfrom
fix/jcpan-latexml-makemaker

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented Apr 30, 2026

Summary

./jcpan -t LaTeXML was failing immediately at the configure phase with:

Can't locate object method "MY::SUPER::postamble" via package "PerlOnJava::MM::Installed"
  ... at Makefile.PL line 299.

LaTeXML's Makefile.PL declares package MY; and chains its overrides via
$self->MY::SUPER::postamble(@rules) / $self->MY::SUPER::libscan($path).
Our ExtUtils::MakeMaker shim never set up @MY::ISA, so this dispatch
died.

Fixing that exposed several follow-on issues. This PR fixes all of them so
LaTeXML reaches the test phase.

What's fixed

  • ExtUtils/MakeMaker.pm

    • Set @MY::ISA = ('PerlOnJava::MM::Installed') so user package MY
      overrides can chain to defaults via MY::SUPER::*.
    • Add no-op default postamble / libscan / constants / depend /
      dist_core / install / realclean / clean / test /
      top_targets on PerlOnJava::MM::Installed for those SUPER::
      calls to land on (instead of relying on AUTOLOAD, which doesn't
      return the empty string the call sites concatenate with).
    • Emit standard MakeMaker macros (PERLRUN, FULLPERLRUN,
      PERLRUNINST, MKPATH, MV, CP, RM_F, INST_ARCHLIB,
      INST_LIBDIR, INST_ARCHLIBDIR, SHELL, TEST_VERBOSE,
      MOD_INSTALL, UNINSTALL, ...) in the generated Makefile. User
      postamble rules (LaTeXML's MathGrammar/REVISION, etc.) reference
      these and silently produced empty commands before.
    • Honor user-supplied macro => { ... } from WriteMakefile and emit
      those as Makefile macro definitions (LaTeXML uses this for
      REVISION_BASE, REVISION_FILE, RECORD_REVISION, ...).
  • ArgumentParser.java (jperl -M/-m injection)

    • Wrap the synthetic use Module; injection in #line 0 "<script>" /
      #line 1 "<script>" directives so caller() inside the module's
      import reports line 0 (matching real Perl).
      Parse::RecDescent's precompiler mode
      (perl -MParse::RecDescent - grammar class) relies on this exact
      signal to decide whether to precompile the grammar; before this fix
      it silently exited and produced no .pm output, so the next
      Makefile rule (mv MathGrammar.pm blib/lib/...) failed.
  • ErrorMessageUtil.java

    • Allow #line 0 "file" directives. The previous directiveLine >= 1
      guard silently ignored line 0, which meant the new -M injection
      couldn't reach line 0 either.

Test plan

  • make (all unit tests pass)
  • ./jcpan -t LaTeXML no longer dies at the configure phase
  • Makefile.PL for LaTeXML now reports -- OK
  • Generated Makefile's postamble rules expand $(PERLRUN),
    $(MKPATH), $(INST_LIBDIR) etc. correctly
  • Parse::RecDescent precompiler mode (-MParse::RecDescent -)
    now generates MathGrammar.pm
  • caller() inside a module's import reports line 0 for -M
    invocations (verified with a small repro)

Remaining LaTeXML test failures are caused by the missing XML::LibXML
XS module (PerlOnJava has no Java implementation for it yet), which is a
separate, much larger porting effort.

Generated with Devin

LaTeXML's Makefile.PL declares `package MY` and chains via
`$self->MY::SUPER::postamble(@rules)`, which used to die with
"Can't locate object method MY::SUPER::postamble". Several follow-on
MakeMaker/CLI issues then surfaced. This patch fixes:

- ExtUtils::MakeMaker:
  * Set @my::ISA = ('PerlOnJava::MM::Installed') so user `package MY`
    method overrides can chain to defaults via MY::SUPER::*.
  * Add default no-op postamble/libscan/constants/depend/.../top_targets
    on PerlOnJava::MM::Installed for those SUPER:: calls to land on.
  * Emit standard MakeMaker macros (PERLRUN, FULLPERLRUN, MKPATH, MV,
    INST_LIBDIR, etc.) in the generated Makefile so postamble rules
    that reference them (LaTeXML's MathGrammar/REVISION rules,
    Win32::Console::ANSI's $(NOECHO), ...) actually run.
  * Honor user-supplied `macro => { ... }` from WriteMakefile and emit
    those as Makefile macro definitions (LaTeXML uses this for
    REVISION_BASE, REVISION_FILE, RECORD_REVISION, ...).

- ArgumentParser (jperl -M/-m):
  * Wrap synthetic `-MModule` use-statement injection in `#line 0` /
    `#line 1` directives so `caller()` inside the module's `import`
    reports line 0 (matching real Perl). Parse::RecDescent's
    precompiler mode (`perl -MParse::RecDescent - grammar class`)
    relies on this exact signal to decide whether to precompile the
    grammar; before this fix it silently exited and produced no
    .pm output.

- ErrorMessageUtil:
  * Allow `#line 0 "file"` directives. The previous `>= 1` guard
    silently ignored line 0, which meant the new `-M` injection
    above couldn't reach line 0 either.

After this patch `jcpan -t LaTeXML` reaches the test phase. Remaining
LaTeXML test failures are due to the missing XML::LibXML XS module
(PerlOnJava has no Java implementation for it yet), which is a
separate, much larger porting effort.

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@fglock fglock force-pushed the fix/jcpan-latexml-makemaker branch from 5dadaca to bc3266b Compare April 30, 2026 13:48
@fglock fglock merged commit 0416ffb into master Apr 30, 2026
2 checks passed
@fglock fglock deleted the fix/jcpan-latexml-makemaker branch April 30, 2026 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant