class Gtkx3 < Formula homepage "http://gtk.org/" url "http://ftp.gnome.org/pub/gnome/sources/gtk+/3.16/gtk+-3.16.2.tar.xz" sha256 "a03963a61c9f5253a8d4003187190be165d92f95acf97ca783735071a8781cfa" bottle do sha256 "3b301ff711350f37f99556603e4d1b74e720ef2ff3f037c3164645c17973599a" => :yosemite sha256 "54c17fb91c52356ffae69438865d1fe0f018bc075d1e803c29c84ac975acd4a8" => :mavericks sha256 "15bcce7131b628d66fdf15797281975b95d33ad72cd704e050d6e8c1c576201d" => :mountain_lion end option :universal depends_on "pkg-config" => :build depends_on "gdk-pixbuf" depends_on "jasper" => :optional depends_on "atk" depends_on "gobject-introspection" depends_on "libepoxy" depends_on "gsettings-desktop-schemas" => :recommended depends_on "pango" depends_on "glib" def install ENV.universal_binary if build.universal? args = %W[ --disable-debug --disable-dependency-tracking --prefix=#{prefix} --disable-glibtest --enable-introspection=yes --disable-schemas-compile --enable-quartz-backend --enable-quartz-relocation --disable-x11-backend ] system "./configure", *args # necessary to avoid gtk-update-icon-cache not being found during make install bin.mkpath ENV.prepend_path "PATH", "#{bin}" system "make", "install" # Prevent a conflict between this and Gtk+2 mv bin/"gtk-update-icon-cache", bin/"gtk3-update-icon-cache" end def post_install system "#{Formula["glib"].opt_bin}/glib-compile-schemas", "#{HOMEBREW_PREFIX}/share/glib-2.0/schemas" end test do (testpath/"test.c").write <<-EOS.undent #include int main(int argc, char *argv[]) { gtk_disable_setlocale(); return 0; } EOS system ENV.cc, "-I#{HOMEBREW_PREFIX}/include/gtk-3.0", "-I#{HOMEBREW_PREFIX}/include", "-I#{HOMEBREW_PREFIX}/include/gio-unix-2.0/", "-I#{HOMEBREW_PREFIX}/include/cairo", "-I#{HOMEBREW_PREFIX}/include", "-I#{HOMEBREW_PREFIX}/include/pango-1.0", "-I#{HOMEBREW_PREFIX}/include/atk-1.0", "-I#{HOMEBREW_PREFIX}/include/cairo", "-I#{HOMEBREW_PREFIX}/include/pixman-1", "-I#{HOMEBREW_PREFIX}/include", "-I#{HOMEBREW_PREFIX}/include/freetype2", "-I#{HOMEBREW_PREFIX}/include/libpng16", "-I#{HOMEBREW_PREFIX}/include/gdk-pixbuf-2.0", "-I#{HOMEBREW_PREFIX}/include/libpng16", "-I#{HOMEBREW_PREFIX}/include/glib-2.0", "-I#{HOMEBREW_PREFIX}/lib/glib-2.0/include", "-I#{HOMEBREW_PREFIX}/opt/gettext/include", "-I/opt/X11/include", "test.c", "-L#{HOMEBREW_PREFIX}/lib", "-L#{HOMEBREW_PREFIX}/lib", "-L#{HOMEBREW_PREFIX}/lib", "-L#{HOMEBREW_PREFIX}/lib", "-L#{HOMEBREW_PREFIX}/lib", "-L#{HOMEBREW_PREFIX}/lib", "-L#{HOMEBREW_PREFIX}/opt/gettext/lib", "-lgtk-3", "-lgdk-3", "-lpangocairo-1.0", "-lpango-1.0", "-latk-1.0", "-lcairo-gobject", "-lcairo", "-lgdk_pixbuf-2.0", "-lgio-2.0", "-lgobject-2.0", "-lglib-2.0", "-lintl", "-o", "test" system "./test" end end