homebrew-core/Formula/innotop.rb

73 lines
3.1 KiB
Ruby

class Innotop < Formula
desc "Top clone for MySQL"
homepage "https://github.com/innotop/innotop/"
url "https://github.com/innotop/innotop/archive/v1.13.0.tar.gz"
sha256 "6ec91568e32bda3126661523d9917c7fbbd4b9f85db79224c01b2a740727a65c"
license any_of: ["GPL-2.0-only", "Artistic-1.0-Perl"]
revision 2
head "https://github.com/innotop/innotop.git"
bottle do
sha256 cellar: :any, arm64_monterey: "45a9b49284646d65f952a15670eb9e3bb0a471365daae7f57d101377a4c7f252"
sha256 cellar: :any, arm64_big_sur: "c974c0178ce90162a6a417b00bb1576b49941bf07caf382d2bde7ff0ad556eb7"
sha256 cellar: :any, monterey: "3f0158957c8a7188425a28da90e9f2839b8ab501a4f886d3e0c755eff247ceb8"
sha256 cellar: :any, big_sur: "22a308935fcd0931a72e0812b2a5b8ed75953106c57130b5d519cc6f56602ca9"
sha256 cellar: :any, catalina: "550b3ac3cf0736304172e83c35419585e7caffd3803201a0ba03694e570099c8"
sha256 cellar: :any_skip_relocation, x86_64_linux: "a4653b6f4bc93efa58c34f86fa479a40cc48127ea9d083360cac334add7bfb09"
end
depends_on "mysql-client"
depends_on "openssl@1.1"
uses_from_macos "perl"
resource "Devel::CheckLib" do
url "https://cpan.metacpan.org/authors/id/M/MA/MATTN/Devel-CheckLib-1.14.tar.gz"
sha256 "f21c5e299ad3ce0fdc0cb0f41378dca85a70e8d6c9a7599f0e56a957200ec294"
end
resource "DBI" do
url "https://cpan.metacpan.org/authors/id/T/TI/TIMB/DBI-1.643.tar.gz"
sha256 "8a2b993db560a2c373c174ee976a51027dd780ec766ae17620c20393d2e836fa"
end
resource "DBD::mysql" do
url "https://cpan.metacpan.org/authors/id/D/DV/DVEEDEN/DBD-mysql-4.050.tar.gz"
sha256 "4f48541ff15a0a7405f76adc10f81627c33996fbf56c95c26c094444c0928d78"
end
resource "TermReadKey" do
url "https://cpan.metacpan.org/authors/id/J/JS/JSTOWE/TermReadKey-2.38.tar.gz"
sha256 "5a645878dc570ac33661581fbb090ff24ebce17d43ea53fd22e105a856a47290"
end
def install
ENV.prepend_create_path "PERL5LIB", libexec/"lib/perl5"
resources.each do |r|
r.stage do
system "perl", "Makefile.PL", "INSTALL_BASE=#{libexec}"
# Work around restriction on 10.15+ where .bundle files cannot be loaded
# from a relative path -- while in the middle of our build we need to
# refer to them by their full path. Workaround adapted from:
# https://github.com/fink/fink-distributions/issues/461#issuecomment-563331868
inreplace "Makefile", "blib/", "$(shell pwd)/blib/" if OS.mac? && r.name == "TermReadKey"
system "make", "install"
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 "make", "install"
share.install prefix/"man"
bin.env_script_all_files(libexec/"bin", PERL5LIB: ENV["PERL5LIB"])
end
test do
# Calling commands throws up interactive GUI, which is a pain.
assert_match version.to_s, shell_output("#{bin}/innotop --version")
end
end