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.68/libsoup-2.68.2.tar.xz" sha256 "51ad3001a946fe3bcf29b692dc9ffe05cdf702ea6ca0ee8c3099a99a2f4e3933" bottle do sha256 "6af3460f1ffd83077cc3808399330ab7ed6ad64be838d66be2e3cec367e752e5" => :catalina sha256 "c338380f43951970c0d8a44bc4555939e61d8711f6d981897cdb0a264500824a" => :mojave sha256 "4f407f54985809962b82f6a7c6e48f8898ef45a8415aa8a7155d57716c07b0a3" => :high_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