homebrew-core/Formula/deheader.rb

49 lines
1.2 KiB
Ruby

class Deheader < Formula
include Language::Python::Shebang
desc "Analyze C/C++ files for unnecessary headers"
homepage "http://www.catb.org/~esr/deheader/"
url "http://www.catb.org/~esr/deheader/deheader-1.8.tar.gz"
sha256 "ebf144b441cc12ff5003e3e36c16e772382a153968c44334d5d6a892b44cab06"
license "BSD-2-Clause"
head "https://gitlab.com/esr/deheader.git", branch: "master"
livecheck do
url :homepage
regex(/href=.*?deheader[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 cellar: :any_skip_relocation, all: "35fcae1dfb59ef0c9fce339453c212eabfc380c70b1820ca4b69275606cc2678"
end
depends_on "xmlto" => :build
depends_on "python@3.10"
on_linux do
depends_on "libarchive" => :build
end
def install
ENV["XML_CATALOG_FILES"] = "#{etc}/xml/catalog"
system "make"
bin.install "deheader"
man1.install "deheader.1"
rewrite_shebang detected_python_shebang, bin/"deheader"
end
test do
(testpath/"test.c").write <<~EOS
#include <stdio.h>
#include <string.h>
int main(void) {
printf("%s", "foo");
return 0;
}
EOS
assert_equal "121", shell_output("#{bin}/deheader test.c | tr -cd 0-9")
end
end