homebrew-core/Formula/libhttpseverywhere.rb

84 lines
2.4 KiB
Ruby

class Libhttpseverywhere < Formula
desc "Bring HTTPSEverywhere to desktop apps"
homepage "https://github.com/gnome/libhttpseverywhere"
url "https://download.gnome.org/sources/libhttpseverywhere/0.6/libhttpseverywhere-0.6.5.tar.xz"
sha256 "7fc8c7b3247de62b2e88aa77701ac11a53fc6a3b2414bf5b12314a2ff1364e4f"
bottle do
cellar :any
sha256 "1a437712025a9b0d61ee19551b301830e1139cf803b772e9f7b7d1a689972188" => :high_sierra
sha256 "17339c9d366b5e3d79b233dbce01d824bfe0da4c1360a56492cd3479e033548f" => :sierra
sha256 "974962147bf3919db1837e488593ba804eae84a0ea91c2d5fab829e3a57aa7ae" => :el_capitan
end
depends_on "meson" => :build
depends_on "ninja" => :build
depends_on "vala" => :build
depends_on "pkg-config" => :build
depends_on "glib"
depends_on "json-glib"
depends_on "libsoup"
depends_on "libgee"
depends_on "libarchive"
def install
mkdir "build" do
system "meson", "--prefix=#{prefix}", ".."
system "ninja"
system "ninja", "test"
system "ninja", "install"
end
end
test do
(testpath/"test.c").write <<~EOS
#include <httpseverywhere.h>
int main(int argc, char *argv[]) {
GType type = https_everywhere_context_get_type();
return 0;
}
EOS
ENV.libxml2
gettext = Formula["gettext"]
glib = Formula["glib"]
json_glib = Formula["json-glib"]
libarchive = Formula["libarchive"]
libgee = Formula["libgee"]
libsoup = Formula["libsoup"]
pcre = Formula["pcre"]
flags = (ENV.cflags || "").split + (ENV.cppflags || "").split + (ENV.ldflags || "").split
flags += %W[
-I#{gettext.opt_include}
-I#{glib.opt_include}/glib-2.0
-I#{glib.opt_lib}/glib-2.0/include
-I#{include}/httpseverywhere-0.6
-I#{json_glib.opt_include}/json-glib-1.0
-I#{libarchive.opt_include}
-I#{libgee.opt_include}/gee-0.8
-I#{libsoup.opt_include}/libsoup-2.4
-I#{pcre.opt_include}
-D_REENTRANT
-L#{gettext.opt_lib}
-L#{glib.opt_lib}
-L#{json_glib.opt_lib}
-L#{libarchive.opt_lib}
-L#{libgee.opt_lib}
-L#{libsoup.opt_lib}
-L#{lib}
-larchive
-lgee-0.8
-lgio-2.0
-lglib-2.0
-lgobject-2.0
-lhttpseverywhere-0.6
-lintl
-ljson-glib-1.0
-lsoup-2.4
-lxml2
]
system ENV.cc, "test.c", "-o", "test", *flags
system "./test"
end
end