class GlibNetworking < Formula desc "Network related modules for glib" homepage "https://launchpad.net/glib-networking" url "https://download.gnome.org/sources/glib-networking/2.60/glib-networking-2.60.0.1.tar.xz" sha256 "674e8b062c0639c274848d40b8308f8fb2ecd8b82e7eb6fe805d1aca7deb983c" bottle do sha256 "8ebdb6d98c8b33fcc65be98775c8427c78946e409f6744ae8732f9aea36e1951" => :mojave sha256 "3ac98032519cb7a9f8362a600bd5354aff890f5efe307a4f59a1b22640f3526b" => :high_sierra sha256 "c5e903fa68084991448ac8f1ed7a214d83c2d987cfa68709b5b7592c1939372b" => :sierra end depends_on "meson" => :build depends_on "ninja" => :build depends_on "pkg-config" => :build depends_on "python" => :build depends_on "glib" depends_on "gnutls" depends_on "gsettings-desktop-schemas" link_overwrite "lib/gio/modules" def install # stop meson_post_install.py from doing what needs to be done in the post_install step ENV["DESTDIR"] = "/" mkdir "build" do system "meson", "--prefix=#{prefix}", "-Dlibproxy=disabled", "-Dopenssl=disabled", "-Dgnome_proxy=disabled", ".." system "ninja", "-v" system "ninja", "install", "-v" end end def post_install system Formula["glib"].opt_bin/"gio-querymodules", HOMEBREW_PREFIX/"lib/gio/modules" end test do (testpath/"gtls-test.c").write <<~EOS #include int main (int argc, char *argv[]) { if (g_tls_backend_supports_tls (g_tls_backend_get_default())) return 0; else return 1; } EOS # From `pkg-config --cflags --libs gio-2.0` flags = [ "-D_REENTRANT", "-I#{HOMEBREW_PREFIX}/include/glib-2.0", "-I#{HOMEBREW_PREFIX}/lib/glib-2.0/include", "-I#{HOMEBREW_PREFIX}/opt/gettext/include", "-L#{HOMEBREW_PREFIX}/lib", "-L#{HOMEBREW_PREFIX}/opt/gettext/lib", "-lgio-2.0", "-lgobject-2.0", "-lglib-2.0" ] system ENV.cc, "gtls-test.c", "-o", "gtls-test", *flags system "./gtls-test" end end