From 810f10b4a1fbeac0b799070a1ffcdab426fc7243 Mon Sep 17 00:00:00 2001 From: Michael Cho Date: Fri, 17 Jan 2025 18:52:53 -0500 Subject: [PATCH] perl-build: avoid env script for plenv- scripts 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. --- Formula/p/perl-build.rb | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/Formula/p/perl-build.rb b/Formula/p/perl-build.rb index 6337313b1433a7..666ef47fd99291 100644 --- a/Formula/p/perl-build.rb +++ b/Formula/p/perl-build.rb @@ -95,39 +95,30 @@ 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| r.stage do - next if build_pl.include? r.name - - system "perl", "Makefile.PL", "INSTALL_BASE=#{libexec}" - system "make" - system "make", "install" + if File.exist? "Makefile.PL" + system "perl", "Makefile.PL", "INSTALL_BASE=#{libexec}" + system "make" + system "make", "install" + else + system "perl", "Build.PL", "--install_base", libexec + system "./Build" + system "./Build", "install" + end end end - build_pl.each do |name| - resource(name).stage do - system "perl", "Build.PL", "--install_base", libexec - system "./Build" - system "./Build", "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?