Skip to content

fix(makemaker): write Build proxy when Build.PL is present#584

Merged
fglock merged 1 commit intomasterfrom
fix/makemaker-build-proxy
Apr 28, 2026
Merged

fix(makemaker): write Build proxy when Build.PL is present#584
fglock merged 1 commit intomasterfrom
fix/makemaker-build-proxy

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented Apr 28, 2026

Summary

Fix jcpan -t/-i Data::Merger (and any other CPAN dist that ships a Module::Install–style stub Build.PL) failing with:

Alert: no Build file available for 'make ...'
Error: Unable to read file Build
  /jperl Build -- NOT OK

Root cause

Data::Utilities (which contains Data::Merger) ships a Build.PL whose only job is:

# Dear Distribution Packager. ...
require 'Makefile.PL';

CPAN.pm sees Build.PL, sets $self->{modulebuild} = 1, and from then on runs ./Build, ./Build test, ./Build install instead of make .... Our ExtUtils::MakeMaker shim only emitted a Makefile, so ./Build did not exist and the install aborted.

Fix

When WriteMakefile runs and detects a Build.PL in the cwd, also emit a thin ./Build perl script that proxies Module::Build subcommands (build, test, install, clean, realclean, distclean, config) to the matching make targets that _create_install_makefile already generates. Unknown subcommands pass through verbatim.

Touches only src/main/perl/lib/ExtUtils/MakeMaker.pm (plus the auto-injected Configuration.java commit id).

Test plan

  • make (full unit suite) passes
  • Clean-tree end-to-end run, all phases driven by CPAN.pm:
    rm -rf ~/.cpan/build/Data-Utilities-0.04-*
    ./jcpan -i Data::Merger
    
    • Build.PL -- OK
    • Build -- OK (5 files staged in ./blib)
    • Build test -- OK (Files=7, Tests=55, all pass)
    • Build install -- OK (5 files copied to ~/.perlonjava/lib)
  • Runtime smoke test: ./jperl -e 'use Data::Merger qw(merger); ...' merges hashes as expected.

No automated test was added — there are currently no tests in src/test/ for the MakeMaker shim or the jcpan flow to extend. Happy to add one (either a .t that exercises _create_build_script_proxy directly, or a make test-bundled-modules entry that runs jcpan -t Data::Merger) in a follow-up if desired.

Generated with Devin

Some CPAN distributions ship a Build.PL whose only job is to delegate
to Makefile.PL (Module::Install's "Dear Distribution Packager" trick,
e.g. Data::Utilities, which contains Data::Merger). CPAN.pm sees the
Build.PL, sets the dist's modulebuild flag, and then runs ./Build,
./Build test, ./Build install instead of make.

Until now PerlOnJava's ExtUtils::MakeMaker shim only emitted a
Makefile, so jcpan -t/-i Data::Merger died with:

    Alert: no Build file available for 'make ...'
    Error: Unable to read file Build
    /jperl Build -- NOT OK

Fix: when WriteMakefile detects a Build.PL in cwd, also write a thin
./Build perl script that maps Module::Build subcommands (build, test,
install, clean, realclean, distclean, config) to the matching make
targets generated by _create_install_makefile. Unknown subcommands
pass through verbatim.

Verified end-to-end on a clean tree:

    rm -rf ~/.cpan/build/Data-Utilities-0.04-*
    ./jcpan -i Data::Merger
    # -> Build.PL OK, Build OK, Build test OK (55/55), Build install OK
    ./jperl -e 'use Data::Merger qw(merger); ...'  # works

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

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@fglock fglock merged commit 435af2a into master Apr 28, 2026
2 checks passed
@fglock fglock deleted the fix/makemaker-build-proxy branch April 28, 2026 12:30
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