Skip to content

Commit

Permalink
Merge pull request #197275 from Homebrew/innotop-use-macos-dbi
Browse files Browse the repository at this point in the history
innotop: use macOS DBI, remove unneeded files
  • Loading branch information
BrewTestBot authored Nov 11, 2024
2 parents e642c81 + 11db940 commit 83f14b4
Showing 1 changed file with 37 additions and 29 deletions.
66 changes: 37 additions & 29 deletions Formula/i/innotop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,37 @@ class Innotop < Formula
sha256 "6ec91568e32bda3126661523d9917c7fbbd4b9f85db79224c01b2a740727a65c"
license any_of: ["GPL-2.0-only", "Artistic-1.0-Perl"]
revision 10
head "https://github.com/innotop/innotop.git"
head "https://github.com/innotop/innotop.git", branch: "master"

bottle do
sha256 cellar: :any, arm64_sequoia: "a17005507753da73e8a13a96b378233d51dd27cc395eecbbf71fd7206bc40acf"
sha256 cellar: :any, arm64_sonoma: "49218a88a5c4b0bc005ca1dd974b408551dacad3514bf86c99635f96da787393"
sha256 cellar: :any, arm64_ventura: "cf8f414fe93aa6ab94e1b8f56abec847fce802bd9774d64eae50a1fc4dc6e1e3"
sha256 cellar: :any, sonoma: "df181fa1cebc759da9f19b1c67977842b505195301a3a37b82f745f8b7217753"
sha256 cellar: :any, ventura: "4ab714cc8fea0aa2936abe48a665f2e66ce0516e8dfff847be69b105402db2aa"
sha256 cellar: :any_skip_relocation, x86_64_linux: "c5983d9ca80837dcc86692cb8a9a17963543cd71ad3cb599887cbc47a600840e"
rebuild 1
sha256 cellar: :any, arm64_sequoia: "2cf3437f299eb15b2f9d8ece6b1c1b1374e4cc8eda2fe88c47a0e11369613a9d"
sha256 cellar: :any, arm64_sonoma: "390ca18492dc10b16ce2ec36c8a60d65379fa9016788e53031adac8473af4a27"
sha256 cellar: :any, arm64_ventura: "8aa57cd530906c93f6bf1b53cdfccbca76a6eae059fb999e5126e704fbbd2e79"
sha256 cellar: :any, sonoma: "0e4b35966c92c4e9fe82c91240aab1b285bbb63b48916326797becb2ce4b4e2b"
sha256 cellar: :any, ventura: "1644adc048383f4e30f415cdf1fdaf048153d9586ddcd919467b768b7b4b4e52"
sha256 cellar: :any_skip_relocation, x86_64_linux: "4297dcd2edc58800032abfba5b2a89c1983a9ce79b8ca00679343c7b3c34afc4"
end

depends_on "mysql-client"
depends_on "openssl@3"

uses_from_macos "perl"

on_macos do
on_intel do
depends_on "zstd"
end

depends_on "zlib"
end

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
url "https://cpan.metacpan.org/authors/id/T/TI/TIMB/DBI-1.643.tar.gz"
sha256 "8a2b993db560a2c373c174ee976a51027dd780ec766ae17620c20393d2e836fa"
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.008.tar.gz"
sha256 "a2324566883b6538823c263ec8d7849b326414482a108e7650edc0bed55bcd89"
url "https://cpan.metacpan.org/authors/id/D/DV/DVEEDEN/DBD-mysql-5.009.tar.gz"
sha256 "8552d90dfddee9ef36e7a696da126ee1b42a1a00fbf2c6f3ce43ca2c63a5b952"
end

resource "Term::ReadKey" do
Expand All @@ -52,22 +46,36 @@ class Innotop < Formula
end

def install
ENV.prepend_create_path "PERL5LIB", buildpath/"build_deps/lib/perl5"
ENV.prepend_create_path "PERL5LIB", libexec/"lib/perl5"

resources.each do |r|
r.stage do
system "perl", "Makefile.PL", "INSTALL_BASE=#{libexec}"
system "make", "install"
install_base = (r.name == "Devel::CheckLib") ? buildpath/"build_deps" : libexec

# Skip installing man pages for libexec perl modules to reduce disk usage
system "perl", "Makefile.PL", "INSTALL_BASE=#{install_base}", "INSTALLMAN1DIR=none", "INSTALLMAN3DIR=none"

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
end
end

# Disable dynamic selection of perl which may cause segfault when an
# incompatible perl is picked up.
inreplace "innotop", "#!/usr/bin/env perl", "#!/usr/bin/perl"

system "perl", "Makefile.PL", "INSTALL_BASE=#{prefix}"
system "perl", "Makefile.PL", "INSTALL_BASE=#{prefix}", "INSTALLSITEMAN1DIR=#{man1}"
system "make", "install"
share.install prefix/"man"
bin.env_script_all_files(libexec/"bin", PERL5LIB: ENV["PERL5LIB"])
bin.env_script_all_files(libexec/"bin", PERL5LIB: libexec/"lib/perl5")
end

test do
Expand Down

0 comments on commit 83f14b4

Please sign in to comment.