homebrew-core/Formula/glib-networking.rb
2015-08-23 22:33:32 +08:00

67 lines
2.3 KiB
Ruby

class GlibNetworking < Formula
desc "Network related modules for glib"
homepage "https://launchpad.net/glib-networking"
url "https://download.gnome.org/sources/glib-networking/2.44/glib-networking-2.44.0.tar.xz"
mirror "https://mirrors.kernel.org/debian/pool/main/g/glib-networking/glib-networking_2.44.0.orig.tar.xz"
sha256 "8f8a340d3ba99bfdef38b653da929652ea6640e27969d29f7ac51fbbe11a4346"
bottle do
cellar :any
sha256 "715679f9ff9cf23d4b0846638ac850bd62347081cbeaacab88632818b02ee501" => :yosemite
sha256 "147cad820da481a3c6db26927e8b07460f82e42809f1ec9557b462644bd5d3d0" => :mavericks
sha256 "5367f03c7b0af525c54483fd3bdf1ecc7322b5660a90a82c54dfe8857456274a" => :mountain_lion
end
depends_on "pkg-config" => :build
depends_on "intltool" => :build
depends_on "gettext"
depends_on "glib"
depends_on "gnutls"
depends_on "gsettings-desktop-schemas"
link_overwrite "lib/gio/modules"
def install
# Install files to `lib` instead of `HOMEBREW_PREFIX/lib`.
inreplace "configure", "$($PKG_CONFIG --variable giomoduledir gio-2.0)", lib/"gio/modules"
system "./configure", "--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}",
"--with-ca-certificates=#{etc}/openssl/cert.pem"
system "make", "install"
# Delete the cache, will regenerate it in post_install
rm lib/"gio/modules/giomodule.cache"
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.undent
#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", "-lintl"
]
system ENV.cc, "gtls-test.c", "-o", "gtls-test", *flags
system "./gtls-test"
end
end