fix: unblock jcpan -t LaTeXML configure phase#641
Merged
Conversation
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>
5dadaca to
bc3266b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
./jcpan -t LaTeXMLwas failing immediately at the configure phase with:LaTeXML's
Makefile.PLdeclarespackage MY;and chains its overrides via$self->MY::SUPER::postamble(@rules)/$self->MY::SUPER::libscan($path).Our
ExtUtils::MakeMakershim never set up@MY::ISA, so this dispatchdied.
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@MY::ISA = ('PerlOnJava::MM::Installed')so userpackage MYoverrides can chain to defaults via
MY::SUPER::*.postamble/libscan/constants/depend/dist_core/install/realclean/clean/test/top_targetsonPerlOnJava::MM::Installedfor thoseSUPER::calls to land on (instead of relying on
AUTOLOAD, which doesn'treturn the empty string the call sites concatenate with).
PERLRUN,FULLPERLRUN,PERLRUNINST,MKPATH,MV,CP,RM_F,INST_ARCHLIB,INST_LIBDIR,INST_ARCHLIBDIR,SHELL,TEST_VERBOSE,MOD_INSTALL,UNINSTALL, ...) in the generatedMakefile. Userpostamble rules (LaTeXML's
MathGrammar/REVISION, etc.) referencethese and silently produced empty commands before.
macro => { ... }fromWriteMakefileand emitthose as Makefile macro definitions (LaTeXML uses this for
REVISION_BASE,REVISION_FILE,RECORD_REVISION, ...).ArgumentParser.java(jperl -M/-minjection)use Module;injection in#line 0 "<script>"/#line 1 "<script>"directives socaller()inside the module'simportreports line0(matching real Perl).Parse::RecDescent's precompiler mode(
perl -MParse::RecDescent - grammar class) relies on this exactsignal to decide whether to precompile the grammar; before this fix
it silently exited and produced no
.pmoutput, so the nextMakefile rule (
mv MathGrammar.pm blib/lib/...) failed.ErrorMessageUtil.java#line 0 "file"directives. The previousdirectiveLine >= 1guard silently ignored line
0, which meant the new-Minjectioncouldn't reach line
0either.Test plan
make(all unit tests pass)./jcpan -t LaTeXMLno longer dies at the configure phaseMakefile.PLfor LaTeXML now reports-- OK$(PERLRUN),$(MKPATH),$(INST_LIBDIR)etc. correctlyParse::RecDescentprecompiler mode (-MParse::RecDescent -)now generates
MathGrammar.pmcaller()inside a module'simportreports line0for-Minvocations (verified with a small repro)
Remaining LaTeXML test failures are caused by the missing
XML::LibXMLXS module (PerlOnJava has no Java implementation for it yet), which is a
separate, much larger porting effort.
Generated with Devin