diff --git a/Formula/p/percona-toolkit.rb b/Formula/p/percona-toolkit.rb index f2901ac83e8ac..9d296f95f6951 100644 --- a/Formula/p/percona-toolkit.rb +++ b/Formula/p/percona-toolkit.rb @@ -21,28 +21,10 @@ class PerconaToolkit < Formula end depends_on "go" => :build - depends_on "mysql-client" + depends_on "perl-dbd-mysql" uses_from_macos "perl" - # Should be installed before DBD::mysql - resource "Devel::CheckLib" do - url "https://cpan.metacpan.org/authors/id/M/MA/MATTN/Devel-CheckLib-1.16.tar.gz" - sha256 "869d38c258e646dcef676609f0dd7ca90f085f56cf6fd7001b019a5d5b831fca" - end - - resource "DBI" do - on_linux do - url "https://cpan.metacpan.org/authors/id/H/HM/HMBRAND/DBI-1.645.tgz" - sha256 "e38b7a5efee129decda12383cf894963da971ffac303f54cc1b93e40e3cf9921" - end - end - - resource "DBD::mysql" do - url "https://cpan.metacpan.org/authors/id/D/DV/DVEEDEN/DBD-mysql-5.010.tar.gz" - sha256 "2ca2ff39d93e89d4f7446e5f0faf03805e9167ee9b8a04ba7cb246e2cb46eee7" - end - resource "JSON" do on_linux do url "https://cpan.metacpan.org/authors/id/I/IS/ISHIGAKI/JSON-4.10.tar.gz" @@ -51,43 +33,21 @@ class PerconaToolkit < Formula end def install - ENV.prepend_create_path "PERL5LIB", buildpath/"build_deps/lib/perl5" + ENV.prepend_path "PERL5LIB", Formula["perl-dbd-mysql"].opt_libexec/"lib/perl5" ENV.prepend_create_path "PERL5LIB", libexec/"lib/perl5" - build_only_deps = %w[Devel::CheckLib] resources.each do |r| r.stage do - install_base = if build_only_deps.include? r.name - buildpath/"build_deps" - else - libexec - end - - # Skip installing man pages for libexec perl modules to reduce disk usage - system "perl", "Makefile.PL", "INSTALL_BASE=#{install_base}", + system "perl", "Makefile.PL", "INSTALL_BASE=#{libexec}", "INSTALLMAN1DIR=none", "INSTALLMAN3DIR=none", "NO_PERLLOCAL=1", "NO_PACKLIST=1" - - make_args = [] - if OS.mac? && r.name == "DBD::mysql" - # Reduce overlinking on macOS - make_args << "OTHERLDFLAGS=-Wl,-dead_strip_dylibs" - # Work around macOS DBI generating broken Makefile - inreplace "Makefile" do |s| - old_dbi_instarch_dir = s.get_make_var("DBI_INSTARCH_DIR") - new_dbi_instarch_dir = "#{MacOS.sdk_path_if_needed}#{old_dbi_instarch_dir}" - s.change_make_var! "DBI_INSTARCH_DIR", new_dbi_instarch_dir - s.gsub! " #{old_dbi_instarch_dir}/Driver_xst.h", " #{new_dbi_instarch_dir}/Driver_xst.h" - end - end - - system "make", "install", *make_args + system "make", "install" end end system "perl", "Makefile.PL", "INSTALL_BASE=#{prefix}", "INSTALLSITEMAN1DIR=#{man1}" system "make", "install" - bin.env_script_all_files(libexec/"bin", PERL5LIB: libexec/"lib/perl5") + bin.env_script_all_files(libexec/"bin", PERL5LIB: ENV["PERL5LIB"]) end test do