class Libhttpseverywhere < Formula desc "Bring HTTPSEverywhere to desktop apps" homepage "https://github.com/gnome/libhttpseverywhere" url "https://download.gnome.org/sources/libhttpseverywhere/0.4/libhttpseverywhere-0.4.0.tar.xz" sha256 "b5d2e923bb079074115312ebb4788410adf4f15b9c81b1d3d9579c91c95fa38f" bottle do cellar :any sha256 "f64c54f827c1b30144b12764f8a5f1e74613dcc7ba09347cded8dbbaffdd14b4" => :sierra sha256 "604406795bdbc3566067896059fa84470c3a5fbfd56decff3e61a0c0f602eff8" => :el_capitan sha256 "5c8cf29d00042a692373ff1cbf513ddfaf765aff59b28e8d81fc1ba205b13181" => :yosemite 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" # Remove for > 0.4.0 # Fix "Tried to form an absolute path to a source dir." # Upstream commit from 25 Mar 2017 "meson: Fix building with Meson 0.39.0" patch do url "https://git.gnome.org/browse/libhttpseverywhere/patch/?id=7075c895b6cd9f255fc5f42cea5d3d3ab6d12f4f" sha256 "92938341ea09b55a87350b12557c7108a80112f09dfcd04a7c44af6badc9a910" end 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.undent #include 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.4 -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.4 -lintl -ljson-glib-1.0 -lsoup-2.4 -lxml2 ] system ENV.cc, "test.c", "-o", "test", *flags system "./test" end end