class Libsoup < Formula desc "HTTP client/server library for GNOME" homepage "https://wiki.gnome.org/Projects/libsoup" url "https://download.gnome.org/sources/libsoup/2.64/libsoup-2.64.1.tar.xz" sha256 "359bd02a909bfd43f68712146e9c4f4c643bffa84e513d8b0af1be215a92e1f3" bottle do sha256 "a8a68640369d20daae4f50a1a9fc0614d64f7cfd253f71a6db601d9f8faaf1db" => :mojave sha256 "2f96dbdd1a7fb7f1129d31c29df5fa8d856d0cfd446352e540ba7fb926d7664a" => :high_sierra sha256 "eb3d99767f47892fad885729c6dd85e92798652cddaa32483e69fcdef6276ae0" => :sierra end depends_on "gobject-introspection" => :build depends_on "intltool" => :build depends_on "pkg-config" => :build depends_on "python" => :build depends_on "glib-networking" depends_on "gnutls" depends_on "libpsl" 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