class Libsoup < Formula desc "HTTP client/server library for GNOME" homepage "https://live.gnome.org/LibSoup" url "https://download.gnome.org/sources/libsoup/2.62/libsoup-2.62.1.tar.xz" sha256 "f037ddac2e0f9b1c842a0060fa6119bea1d3b349a2c901283c961247e45883d7" bottle do sha256 "181dfea9c06ecf949f92ef1b0fc3605fefd2a4a370df7e0cd41f39d561d81571" => :high_sierra sha256 "3a6652330dd89a70a0bfb69b26116d9dbe5c1bc75fbd4cc9fdd03c1761487534" => :sierra sha256 "d39d7013a6153b7b8e3d425509e30d3637881bab45521b8cbe24415ced2e88d5" => :el_capitan end depends_on "gobject-introspection" => :build depends_on "pkg-config" => :build depends_on "intltool" => :build depends_on "python" => :build depends_on "glib-networking" depends_on "gnutls" depends_on "vala" def install args = %W[ --disable-debug --disable-dependency-tracking --disable-silent-rules --prefix=#{prefix} --disable-tls-check --enable-introspection=yes ] # ensures that the vala files remain within the keg inreplace "libsoup/Makefile.in", "VAPIDIR = @VAPIDIR@", "VAPIDIR = @datadir@/vala/vapi" system "./configure", *args system "make", "install" end test do (testpath/"test.c").write <<~EOS #include int main(int argc, char *argv[]) { guint version = soup_get_major_version(); return 0; } EOS ENV.libxml2 gettext = Formula["gettext"] glib = Formula["glib"] flags = %W[ -I#{gettext.opt_include} -I#{glib.opt_include}/glib-2.0 -I#{glib.opt_lib}/glib-2.0/include -I#{include}/libsoup-2.4 -D_REENTRANT -L#{gettext.opt_lib} -L#{glib.opt_lib} -L#{lib} -lgio-2.0 -lglib-2.0 -lgobject-2.0 -lsoup-2.4 ] system ENV.cc, "test.c", "-o", "test", *flags system "./test" end end