homebrew-core/Formula/kpcli.rb

135 lines
4.8 KiB
Ruby

require "language/perl"
class Kpcli < Formula
include Language::Perl::Shebang
desc "Command-line interface to KeePass database files"
homepage "https://kpcli.sourceforge.io/"
url "https://downloads.sourceforge.net/project/kpcli/kpcli-3.8.1.pl"
sha256 "6c84f8639245799bf9b2d5ce297c41b5d4ec0789f7f5fa9e8767556816ea472c"
license any_of: ["Artistic-1.0-Perl", "GPL-1.0-or-later"]
livecheck do
url :stable
regex(%r{url=.*?/kpcli[._-]v?(\d+(?:\.\d+)+)\.pl}i)
end
bottle do
sha256 cellar: :any, arm64_monterey: "3e5541f5e3c1031e77cbce3f2953f5e6d9865a24afb83cb39827a6f89874d9e7"
sha256 cellar: :any, arm64_big_sur: "e29f7d4ceba1334bbbd57b110628eb655ca3a5ee076cc74fc32935d50fdb2ab1"
sha256 cellar: :any, monterey: "ad7799e6aacc9bcd1c76e308758036e3eadf1fbc652e7d9c95e28a2b0291d3c6"
sha256 cellar: :any, big_sur: "d5c9ca1dee1bf7965ddf8e47d386192f72f1565c98cf5ab21fea51eb18f2c4d6"
sha256 cellar: :any, catalina: "165749beb5e97fe99a928abe2ed0e42c85110fc78b06f7c8560664217f7e64df"
sha256 cellar: :any_skip_relocation, x86_64_linux: "1f6d692a8118172a86bf4f09e37b3b8102c83799ef4d32b6bbaae647c018f6f3"
end
depends_on "readline"
uses_from_macos "perl"
resource "Mac::Pasteboard" do
on_macos do
url "https://cpan.metacpan.org/authors/id/W/WY/WYANT/Mac-Pasteboard-0.103.tar.gz"
sha256 "2f5e8dd2db0d6445558484ca6d42d839c5a97ee8aa1b250e694d67d5b7f6634c"
end
end
resource "Clone" do
on_linux do
url "https://cpan.metacpan.org/authors/id/A/AT/ATOOMIC/Clone-0.45.tar.gz"
sha256 "cbb6ee348afa95432e4878893b46752549e70dc68fe6d9e430d1d2e99079a9e6"
end
end
resource "TermReadKey" do
on_linux do
url "https://cpan.metacpan.org/authors/id/J/JS/JSTOWE/TermReadKey-2.38.tar.gz"
sha256 "5a645878dc570ac33661581fbb090ff24ebce17d43ea53fd22e105a856a47290"
end
end
resource "Module::Build" do
url "https://cpan.metacpan.org/authors/id/L/LE/LEONT/Module-Build-0.4231.tar.gz"
sha256 "7e0f4c692c1740c1ac84ea14d7ea3d8bc798b2fb26c09877229e04f430b2b717"
end
resource "File::KeePass" do
url "https://cpan.metacpan.org/authors/id/R/RH/RHANDOM/File-KeePass-2.03.tar.gz"
sha256 "c30c688027a52ff4f58cd69d6d8ef35472a7cf106d4ce94eb73a796ba7c7ffa7"
end
resource "Crypt::Rijndael" do
url "https://cpan.metacpan.org/authors/id/L/LE/LEONT/Crypt-Rijndael-1.16.tar.gz"
sha256 "6540085e3804b82a6f0752c1122cf78cadd221990136dd6fd4c097d056c84d40"
end
resource "Sort::Naturally" do
url "https://cpan.metacpan.org/authors/id/B/BI/BINGOS/Sort-Naturally-1.03.tar.gz"
sha256 "eaab1c5c87575a7826089304ab1f8ffa7f18e6cd8b3937623e998e865ec1e746"
end
resource "Term::ShellUI" do
url "https://cpan.metacpan.org/authors/id/B/BR/BRONSON/Term-ShellUI-0.92.tar.gz"
sha256 "3279c01c76227335eeff09032a40f4b02b285151b3576c04cacd15be05942bdb"
end
resource "Term::ReadLine::Gnu" do
url "https://cpan.metacpan.org/authors/id/H/HA/HAYASHI/Term-ReadLine-Gnu-1.42.tar.gz"
sha256 "3c5f1281da2666777af0f34de0289564e6faa823aea54f3945c74c98e95a5e73"
end
resource "Data::Password" do
url "https://cpan.metacpan.org/authors/id/R/RA/RAZINF/Data-Password-1.12.tar.gz"
sha256 "830cde81741ff384385412e16faba55745a54a7cc019dd23d7ed4f05d551a961"
end
resource "Clipboard" do
url "https://cpan.metacpan.org/authors/id/S/SH/SHLOMIF/Clipboard-0.28.tar.gz"
sha256 "9e8d79015194263357c25a0f5d094800fff43bdbf9f8601ec3b0ed5eb0966d26"
end
resource "Capture::Tiny" do
url "https://cpan.metacpan.org/authors/id/D/DA/DAGOLDEN/Capture-Tiny-0.48.tar.gz"
sha256 "6c23113e87bad393308c90a207013e505f659274736638d8c79bac9c67cc3e19"
end
def install
ENV.prepend_create_path "PERL5LIB", libexec/"lib/perl5"
ENV.prepend_path "PERL5LIB", libexec/"lib"
res = resources.map(&:name).to_set - ["Clipboard", "Term::Readline::Gnu"]
res.each do |r|
resource(r).stage do
system "perl", "Makefile.PL", "INSTALL_BASE=#{libexec}"
system "make", "install"
end
end
resource("Clipboard").stage do
system "perl", "Build.PL", "--install_base", libexec
system "./Build"
system "./Build", "install"
end
resource("Term::ReadLine::Gnu").stage do
# Prevent the Makefile to try and build universal binaries
ENV.refurbish_args
system "perl", "Makefile.PL", "INSTALL_BASE=#{libexec}",
"--includedir=#{Formula["readline"].opt_include}",
"--libdir=#{Formula["readline"].opt_lib}"
system "make", "install"
end
rewrite_shebang detected_perl_shebang, "kpcli-#{version}.pl"
libexec.install "kpcli-#{version}.pl" => "kpcli"
chmod 0755, libexec/"kpcli"
(bin/"kpcli").write_env_script(libexec/"kpcli", PERL5LIB: ENV["PERL5LIB"])
end
test do
system bin/"kpcli", "--help"
end
end