class Libsoup < Formula desc "HTTP client/server library for GNOME" homepage "https://live.gnome.org/LibSoup" url "https://download.gnome.org/sources/libsoup/2.50/libsoup-2.50.0.tar.xz" sha256 "1e01365ac4af3817187ea847f9d3588c27eee01fc519a5a7cb212bb78b0f667b" bottle do sha256 "ee2c2f86d70ad5773bdd8163138f30b7dc9b362753a46080309e7824d465e13a" => :yosemite sha256 "844f476c44c391a4d8f4fdb3e6178cc12b4d8ba5a01dce7671f0cc6d27e0983c" => :mavericks sha256 "7f197f9fd8a36fa97d01830e3beb6973ba5dc2a654f924ee45e226a56be80574" => :mountain_lion end depends_on "pkg-config" => :build depends_on "intltool" => :build depends_on "glib-networking" depends_on "gnutls" depends_on "sqlite" depends_on "gobject-introspection" => :recommended def install args = [ "--disable-debug", "--disable-dependency-tracking", "--disable-silent-rules", "--prefix=#{prefix}", "--without-gnome", "--disable-tls-check" ] if build.with? "gobject-introspection" args << "--enable-introspection" else args << "--disable-introspection" end system "./configure", *args system "make", "install" end test do (testpath/"test.c").write <<-EOS.undent #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 = (ENV.cflags || "").split + (ENV.cppflags || "").split + (ENV.ldflags || "").split 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 -lintl -lsoup-2.4 ] system ENV.cc, "test.c", "-o", "test", *flags system "./test" end end