homebrew-core/Formula/glib-networking.rb

74 lines
2.3 KiB
Ruby

class GlibNetworking < Formula
desc "Network related modules for glib"
homepage "https://gitlab.gnome.org/GNOME/glib-networking"
url "https://download.gnome.org/sources/glib-networking/2.68/glib-networking-2.68.0.tar.xz"
sha256 "0b235e85ad26b3c0d12255d0963c460e5a639c4722f78e2a03e969e224b29f6e"
license "LGPL-2.1-or-later"
bottle do
sha256 arm64_big_sur: "09ef99c0205b593e08ad92dd5e351cd8080b86fff388dcfaf9c0f3091ac36b0f"
sha256 cellar: :any, big_sur: "2b4e055e29296598c3e85fe68b0445c23cf87cd96d9f0703cb181079a745c577"
sha256 cellar: :any, catalina: "28112a720b0fb9a934d3c14f171f2670e6480d01b0910136e2d3e494f682fd77"
sha256 cellar: :any, mojave: "309920b64e42f8211b5b00d7c2439e7325165db1295246afb0d8af3bbc6ed3cf"
end
depends_on "meson" => :build
depends_on "ninja" => :build
depends_on "pkg-config" => :build
depends_on "glib"
depends_on "gnutls"
depends_on "gsettings-desktop-schemas"
on_linux do
depends_on "libidn"
end
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", *std_meson_args,
"-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 <gio/gio.h>
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