homebrew-core/Formula/libpsl.rb

49 lines
1.4 KiB
Ruby
Raw Normal View History

2018-09-03 15:43:57 +00:00
class Libpsl < Formula
desc "C library for the Public Suffix List"
homepage "https://rockdaboot.github.io/libpsl"
url "https://github.com/rockdaboot/libpsl/releases/download/libpsl-0.20.2/libpsl-0.20.2.tar.gz"
sha256 "f8fd0aeb66252dfcc638f14d9be1e2362fdaf2ca86bde0444ff4d5cc961b560f"
2019-02-09 19:53:24 +00:00
revision 2
2018-09-03 15:43:57 +00:00
2018-09-03 16:39:42 +00:00
bottle do
cellar :any
2019-02-09 20:55:18 +00:00
sha256 "98c946ebba06f2f0841c5927a8cf40e26cd0a6b93b22f6e8882eb51aa33f962c" => :mojave
sha256 "8e6d078082a3db2ba057ff8b83ce8f443e59723cf3d5488d0efd453b0670745b" => :high_sierra
sha256 "e6b5a1ce50ba7a587f1df6be12128bc651eff278faae5e7aab470b8aaff5a7d2" => :sierra
2018-09-03 16:39:42 +00:00
end
2018-09-03 15:43:57 +00:00
depends_on "pkg-config" => :build
depends_on "libidn2"
def install
system "./configure", "--disable-silent-rules",
"--prefix=#{prefix}"
system "make", "install"
end
test do
(testpath/"test.c").write <<~EOS
#include <stdio.h>
#include <libpsl.h>
#include <assert.h>
int main(void)
{
const char *domain = ".eu";
const char *cookie_domain = ".eu";
const psl_ctx_t *psl = psl_builtin();
assert(psl_is_public_suffix(psl, domain));
psl_free(psl);
return 0;
}
EOS
system ENV.cc, "-o", "test", "test.c", "-I#{include}",
"-L#{lib}", "-lpsl"
system "./test"
system "#{bin}/psl", "--help"
end
end