homebrew-core/Formula/gtk+.rb
Tom Schoonjans f1a826ee6d gtk+ test cleanup
Closes Homebrew/homebrew#39628.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-05-12 15:01:07 +08:00

104 lines
3 KiB
Ruby

class Gtkx < Formula
homepage "http://gtk.org/"
url "https://download.gnome.org/sources/gtk+/2.24/gtk+-2.24.27.tar.xz"
sha256 "20cb10cae43999732a9af2e9aac4d1adebf2a9c2e1ba147050976abca5cd24f4"
bottle do
sha256 "ab144b55ebb1829ac4e01b9774c0293eb219e1564581e1f139d3eb48db7cd00e" => :yosemite
sha256 "e94e9a89a0f7c7026700cfd17e4468b08215056cf24e867e8f14198110fed2e5" => :mavericks
sha256 "98d5cd5c5635f5ee0aaf1376958e57a62f2ef72ff7ff6078e2dad25d0dcc6780" => :mountain_lion
end
depends_on "pkg-config" => :build
depends_on "gdk-pixbuf"
depends_on "jasper" => :optional
depends_on "atk"
depends_on "pango"
depends_on :x11 => ["2.3.6", :recommended]
depends_on "gobject-introspection"
fails_with :llvm do
build 2326
cause "Undefined symbols when linking"
end
def install
args = ["--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}",
"--disable-glibtest",
"--enable-introspection=yes",
"--disable-visibility"]
args << "--with-gdktarget=quartz" if build.without?("x11")
args << "--enable-quartz-relocation" if build.without?("x11")
system "./configure", *args
system "make", "install"
end
test do
(testpath/"test.c").write <<-EOS.undent
#include <gtk/gtk.h>
int main(int argc, char *argv[]) {
GtkWidget *label = gtk_label_new("Hello World!");
return 0;
}
EOS
atk = Formula["atk"]
cairo = Formula["cairo"]
fontconfig = Formula["fontconfig"]
freetype = Formula["freetype"]
gdk_pixbuf = Formula["gdk-pixbuf"]
gettext = Formula["gettext"]
glib = Formula["glib"]
harfbuzz = Formula["harfbuzz"]
libpng = Formula["libpng"]
pango = Formula["pango"]
pixman = Formula["pixman"]
flags = (ENV.cflags || "").split + (ENV.cppflags || "").split + (ENV.ldflags || "").split
flags += %W[
-I#{atk.opt_include}/atk-1.0
-I#{cairo.opt_include}/cairo
-I#{fontconfig.opt_include}
-I#{freetype.opt_include}/freetype2
-I#{gdk_pixbuf.opt_include}/gdk-pixbuf-2.0
-I#{gettext.opt_include}
-I#{glib.opt_include}/glib-2.0
-I#{glib.opt_lib}/glib-2.0/include
-I#{harfbuzz.opt_include}/harfbuzz
-I#{include}/gtk-2.0
-I#{libpng.opt_include}/libpng16
-I#{lib}/gtk-2.0/include
-I#{pango.opt_include}/pango-1.0
-I#{pixman.opt_include}/pixman-1
-D_REENTRANT
-L#{atk.opt_lib}
-L#{cairo.opt_lib}
-L#{fontconfig.opt_lib}
-L#{freetype.opt_lib}
-L#{gdk_pixbuf.opt_lib}
-L#{gettext.opt_lib}
-L#{glib.opt_lib}
-L#{lib}
-L#{pango.opt_lib}
-latk-1.0
-lcairo
-lfontconfig
-lfreetype
-lgdk-x11-2.0
-lgdk_pixbuf-2.0
-lgio-2.0
-lglib-2.0
-lgobject-2.0
-lgtk-x11-2.0
-lintl
-lpango-1.0
-lpangocairo-1.0
-lpangoft2-1.0
]
system ENV.cc, "test.c", "-o", "test", *flags
system "./test"
end
end