class Lcov < Formula desc "Graphical front-end for GCC's coverage testing tool (gcov)" homepage "https://github.com/linux-test-project/lcov" url "https://github.com/linux-test-project/lcov/releases/download/v2.4/lcov-2.4.tar.gz" sha256 "3457825c6b2fe4ef77c782b82a23875c84a3c955243823f05d8f2dec0d455820" license "GPL-2.0-or-later" head "https://github.com/linux-test-project/lcov.git", branch: "master" bottle do sha256 cellar: :any_skip_relocation, arm64_tahoe: "b7210caf0b04cda530db6c93fd52dbed8333ecdeb17e61c84a00a3441c1ba5c1" sha256 cellar: :any_skip_relocation, arm64_sequoia: "957f7ed44824c8d7280a5ee0b48a29bab7fa563b5a9e7c19a0357f1b02916a53" sha256 cellar: :any_skip_relocation, arm64_sonoma: "df933707ae40a2f12ca5b7a0880ca740307e287c78af80939199937c0868808e" sha256 cellar: :any_skip_relocation, sonoma: "c7fd14bcfc0a695e8a28bdca9b403ef5221152c652d64c46f9a6cc4994812a18" sha256 cellar: :any_skip_relocation, arm64_linux: "5b85756eccae76fddab7df7070a9ab168d631a28756fb70350d7631aaa636115" sha256 cellar: :any_skip_relocation, x86_64_linux: "e299faf4cf042e1397c728f2ab91ab8b38a436aac185dbc03753fa37053cffe1" end uses_from_macos "perl" uses_from_macos "zlib" on_linux do resource "Capture::Tiny" do url "https://cpan.metacpan.org/authors/id/D/DA/DAGOLDEN/Capture-Tiny-0.50.tar.gz" sha256 "ca6e8d7ce7471c2be54e1009f64c367d7ee233a2894cacf52ebe6f53b04e81e5" end resource "Specio::Exporter" do url "https://cpan.metacpan.org/authors/id/D/DR/DROLSKY/Specio-0.53.tar.gz" sha256 "0d0eecfb9e89bd0f5f710fac42e1200a882d513a862f98497eaef5927ac6c183" end resource "File::ShareDir::Install" do url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/File-ShareDir-Install-0.14.tar.gz" sha256 "8f9533b198f2d4a9a5288cbc7d224f7679ad05a7a8573745599789428bc5aea0" end resource "DateTime" do url "https://cpan.metacpan.org/authors/id/D/DR/DROLSKY/DateTime-1.66.tar.gz" sha256 "afabd686fb83d3ebf49ee453974f9122f3eec9b25ff8d2ddf4f12de92af1e5e2" end resource "DateTime::Locale" do url "https://cpan.metacpan.org/authors/id/D/DR/DROLSKY/DateTime-Locale-1.45.tar.gz" sha256 "1bc56dc2ff4b3152612e1d474ca65071ae2c00912e3fa4bc6f5a99e5e7a1da68" end resource "DateTime::TimeZone" do url "https://cpan.metacpan.org/authors/id/D/DR/DROLSKY/DateTime-TimeZone-2.66.tar.gz" sha256 "6fbd61b2d5d7563a8e738341c3790e0d4302dffd4a879b9c268812fe44b54dc1" end resource "namespace::autoclean" do url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/namespace-autoclean-0.31.tar.gz" sha256 "d3b32c82e1d2caa9d58b8c8075965240e6cab66ab9350bd6f6bea4ca07e938d6" end resource "namespace::clean" do url "https://cpan.metacpan.org/authors/id/R/RI/RIBASUSHI/namespace-clean-0.27.tar.gz" sha256 "8a10a83c3e183dc78f9e7b7aa4d09b47c11fb4e7d3a33b9a12912fd22e31af9d" end resource "B::Hooks::EndOfScope" do url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/B-Hooks-EndOfScope-0.28.tar.gz" sha256 "edac77a17fc36620c8324cc194ce1fad2f02e9fcbe72d08ad0b2c47f0c7fd8ef" end resource "Module::Implementation" do url "https://cpan.metacpan.org/authors/id/D/DR/DROLSKY/Module-Implementation-0.09.tar.gz" sha256 "c15f1a12f0c2130c9efff3c2e1afe5887b08ccd033bd132186d1e7d5087fd66d" end resource "Module::Runtime" do url "https://cpan.metacpan.org/authors/id/H/HA/HAARG/Module-Runtime-0.018.tar.gz" sha256 "0bf77ef68e53721914ff554eada20973596310b4e2cf1401fc958601807de577" end resource "Try::Tiny" do url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/Try-Tiny-0.32.tar.gz" sha256 "ef2d6cab0bad18e3ab1c4e6125cc5f695c7e459899f512451c8fa3ef83fa7fc0" end resource "Variable::Magic" do url "https://cpan.metacpan.org/authors/id/V/VP/VPIT/Variable-Magic-0.64.tar.gz" sha256 "9f7853249c9ea3b4df92fb6b790c03a60680fc029f44c8bf9894dccf019516bd" end resource "Sub::Exporter::Progressive" do url "https://cpan.metacpan.org/authors/id/F/FR/FREW/Sub-Exporter-Progressive-0.001013.tar.gz" sha256 "d535b7954d64da1ac1305b1fadf98202769e3599376854b2ced90c382beac056" end resource "Package::Stash" do url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/Package-Stash-0.40.tar.gz" sha256 "5a9722c6d9cb29ee133e5f7b08a5362762a0b5633ff5170642a5b0686e95e066" end resource "Module::Build" do url "https://cpan.metacpan.org/authors/id/L/LE/LEONT/Module-Build-0.4234.tar.gz" sha256 "66aeac6127418be5e471ead3744648c766bd01482825c5b66652675f2bc86a8f" end resource "Params::Validate" do url "https://cpan.metacpan.org/authors/id/D/DR/DROLSKY/Params-Validate-1.31.tar.gz" sha256 "1bf2518ef2c4869f91590e219f545c8ef12ed53cf313e0eb5704adf7f1b2961e" end resource "Sub::Identify" do url "https://cpan.metacpan.org/authors/id/R/RG/RGARCIA/Sub-Identify-0.14.tar.gz" sha256 "068d272086514dd1e842b6a40b1bedbafee63900e5b08890ef6700039defad6f" end resource "Class::Singleton" do url "https://cpan.metacpan.org/authors/id/S/SH/SHAY/Class-Singleton-1.6.tar.gz" sha256 "27ba13f0d9512929166bbd8c9ef95d90d630fc80f0c9a1b7458891055e9282a4" end resource "MRO::Compat" do url "https://cpan.metacpan.org/authors/id/H/HA/HAARG/MRO-Compat-0.15.tar.gz" sha256 "0d4535f88e43babd84ab604866215fc4d04398bd4db7b21852d4a31b1c15ef61" end resource "Role::Tiny" do url "https://cpan.metacpan.org/authors/id/H/HA/HAARG/Role-Tiny-2.002004.tar.gz" sha256 "d7bdee9e138a4f83aa52d0a981625644bda87ff16642dfa845dcb44d9a242b45" end resource "Eval::Closure" do url "https://cpan.metacpan.org/authors/id/D/DO/DOY/Eval-Closure-0.14.tar.gz" sha256 "ea0944f2f5ec98d895bef6d503e6e4a376fea6383a6bc64c7670d46ff2218cad" end resource "Devel::StackTrace" do url "https://cpan.metacpan.org/authors/id/D/DR/DROLSKY/Devel-StackTrace-2.05.tar.gz" sha256 "63cb6196e986a7e578c4d28b3c780e7194835bfc78b68eeb8f00599d4444888c" end resource "Params::ValidationCompiler" do url "https://cpan.metacpan.org/authors/id/D/DR/DROLSKY/Params-ValidationCompiler-0.31.tar.gz" sha256 "7b6497173f1b6adb29f5d51d8cf9ec36d2f1219412b4b2410e9d77a901e84a6d" end resource "Exception::Class" do url "https://cpan.metacpan.org/authors/id/D/DR/DROLSKY/Exception-Class-1.45.tar.gz" sha256 "5482a77ef027ca1f9f39e1f48c558356e954936fc8fbbdee6c811c512701b249" end resource "Class::Data::Inheritable" do url "https://cpan.metacpan.org/authors/id/R/RS/RSHERER/Class-Data-Inheritable-0.10.tar.gz" sha256 "aa1ae68a611357b7bfd9a2f64907cc196ddd6d047cae64ef9d0ad099d98ae54a" end resource "File::ShareDir" do url "https://cpan.metacpan.org/authors/id/R/RE/REHSACK/File-ShareDir-1.118.tar.gz" sha256 "3bb2a20ba35df958dc0a4f2306fc05d903d8b8c4de3c8beefce17739d281c958" end resource "Class::Inspector" do url "https://cpan.metacpan.org/authors/id/P/PL/PLICEASE/Class-Inspector-1.36.tar.gz" sha256 "cc295d23a472687c24489d58226ead23b9fdc2588e522f0b5f0747741700694e" end resource "Clone" do url "https://cpan.metacpan.org/authors/id/A/AT/ATOOMIC/Clone-0.47.tar.gz" sha256 "4c2c0cb9a483efbf970cb1a75b2ca75b0e18cb84bcb5c09624f86e26b09c211d" end resource "Clone::PP" do url "https://cpan.metacpan.org/authors/id/N/NE/NEILB/Clone-PP-1.08.tar.gz" sha256 "57203094a5d8574b6a00951e8f2399b666f4e74f9511d9c9fb5b453d5d11f578" end end resource "JSON" do url "https://cpan.metacpan.org/authors/id/I/IS/ISHIGAKI/JSON-4.10.tar.gz" sha256 "df8b5143d9a7de99c47b55f1a170bd1f69f711935c186a6dc0ab56dd05758e35" end resource "PerlIO::gzip" do url "https://cpan.metacpan.org/authors/id/N/NW/NWCLARK/PerlIO-gzip-0.20.tar.gz" sha256 "4848679a3f201e3f3b0c5f6f9526e602af52923ffa471a2a3657db786bd3bdc5" end def install ENV.prepend_create_path "PERL5LIB", libexec/"lib/perl5" resources.each do |r| r.stage do 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 system "make", "PREFIX=#{prefix}", "install" bin.env_script_all_files(libexec/"bin", PERL5LIB: ENV["PERL5LIB"]) end test do (testpath/"hello.c").write <<~C #include int main() { puts("hello world"); return 0; } C system ENV.cc, "-g", "-O2", "--coverage", "-o", "hello", "hello.c" system "./hello" # gcov must match the c compiler version, which is gcc-12 on linux gcov = if OS.linux? ENV.cc.sub("gcc", "gcov") else "gcov" end system bin/"lcov", "--gcov-tool", gcov, "--directory", ".", "--capture", "--output-file", "all_coverage.info" assert_path_exists testpath/"all_coverage.info" assert_includes (testpath/"all_coverage.info").read, testpath/"hello.c" end end