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.66/libsoup-2.66.1.tar.xz" sha256 "4a2cb6c1174540af13661636035992c2b179dfcb39f4d3fa7bee3c7e355c43ff" bottle do sha256 "b68fd7503d210b957a668cbb66d4135eb0def9549782f28bfba83880d8a861e8" => :mojave sha256 "97f1f5bea2a1f10215ec9dcea01bfc9e07b11877d23dd0d116bab301c0dcb795" => :high_sierra sha256 "f0936e609170f3c6c3b88110fdce8cc0e1c83557011de74724c1e73308d2ae75" => :sierra end depends_on "gobject-introspection" => :build depends_on "meson" => :build depends_on "ninja" => :build depends_on "pkg-config" => :build depends_on "glib-networking" depends_on "gnutls" depends_on "libpsl" depends_on "vala" def install mkdir "build" do system "meson", "--prefix=#{prefix}", ".." system "ninja", "-v" system "ninja", "install", "-v" end end test do # if this test start failing, the problem might very well be in glib-networking instead of libsoup (testpath/"test.c").write <<~EOS #include int main(int argc, char *argv[]) { SoupMessage *msg = soup_message_new("GET", "https://brew.sh"); SoupSession *session = soup_session_new(); soup_session_send_message(session, msg); // blocks g_assert_true(SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)); g_object_unref(msg); g_object_unref(session); 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