Skip to content

Commit

Permalink
perl-build: avoid env script for plenv- scripts
Browse files Browse the repository at this point in the history
This allows `plenv help` to work correctly. Only `perl-build` script
needs the Perl modules. `plenv-install` runs `perl-build` while
`plenv-uninstall` is just a bash script that runs `rm` and `plenv`.

Also expose `perl-build.1` man page.
  • Loading branch information
cho-m committed Jan 18, 2025
1 parent 60aea1b commit ca64821
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions Formula/p/perl-build.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ def install
ENV.prepend_create_path "PERL5LIB", libexec/"lib/perl5"

# Ensure we don't install the pre-packed script
(buildpath/"perl-build").unlink
# Remove this apparently dead symlink.
(buildpath/"bin/perl-build").unlink
rm(["perl-build", "bin/perl-build"])

build_pl = ["Module::Build::Tiny", "CPAN::Perl::Releases::MetaCPAN"]
resources.each do |r|
Expand All @@ -118,16 +116,14 @@ def install
end
end

ENV.prepend_path "PATH", libexec/"bin"
system "perl", "Build.PL", "--install_base", libexec
system "perl", "Build.PL", "--install_base", libexec, "--install_path", "bindoc=#{man1}"
# Replace the dead symlink we removed earlier.
(buildpath/"bin").install_symlink buildpath/"script/perl-build"
system "./Build"
system "./Build", "install"

%w[perl-build plenv-install plenv-uninstall].each do |cmd|
(bin/cmd).write_env_script(libexec/"bin/#{cmd}", PERL5LIB: ENV["PERL5LIB"])
end
bin.install libexec/"bin/plenv-install", libexec/"bin/plenv-uninstall"
(bin/"perl-build").write_env_script(libexec/"bin/perl-build", PERL5LIB: ENV["PERL5LIB"])

# Replace cellar path to perl with opt path.
if OS.linux?
Expand Down

0 comments on commit ca64821

Please sign in to comment.