class Gmime < Formula desc "MIME mail utilities" homepage "https://spruce.sourceforge.io/gmime/" url "https://download.gnome.org/sources/gmime/3.0/gmime-3.0.2.tar.xz" sha256 "0deb460111ffa2ec672677da339b82dedeb28b258ccdb216daa21c81a9472fb2" bottle do sha256 "8f172a988df04d7449e3cc1bbc4f07abaf4dd155d17e0b90faf13dcdfdcd6b5f" => :sierra sha256 "9e170caa6b46e8a4520f8a7579787eb838b81c1e935a68c6563acf4845623923" => :el_capitan sha256 "c2840c86dc753074a450cc7dd9ccb5ae8aaeaac7fe7e0375e5bdc22abca0ab6c" => :yosemite end depends_on "pkg-config" => :build depends_on "gobject-introspection" => :recommended depends_on "glib" def install args = %W[ --disable-dependency-tracking --prefix=#{prefix} --enable-largefile --disable-vala --disable-glibtest ] 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 #include int main (int argc, char **argv) { g_mime_init(); if (gmime_major_version>=3) { return 0; } else { return 1; } } EOS gettext = Formula["gettext"] glib = Formula["glib"] pcre = Formula["pcre"] 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}/gmime-3.0 -I#{pcre.opt_include} -D_REENTRANT -L#{gettext.opt_lib} -L#{glib.opt_lib} -L#{lib} -lgio-2.0 -lglib-2.0 -lgmime-3.0 -lgobject-2.0 -lintl ] system ENV.cc, "-o", "test", "test.c", *flags system "./test" end end