From 3722f77ef416ebaa6ccbf3bf3d7cc6e1859706e6 Mon Sep 17 00:00:00 2001 From: Tom Schoonjans Date: Tue, 12 May 2015 14:35:38 +0800 Subject: [PATCH] atk test cleanup Closes Homebrew/homebrew#39637. Signed-off-by: Xu Cheng --- Formula/atk.rb | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Formula/atk.rb b/Formula/atk.rb index 6065f6c5db..b5d4803ea4 100644 --- a/Formula/atk.rb +++ b/Formula/atk.rb @@ -23,6 +23,7 @@ class Atk < Formula system "make" system "make", "install" end + test do (testpath/"test.c").write <<-EOS.undent #include @@ -32,7 +33,23 @@ class Atk < Formula return 0; } EOS - system ENV.cc, "-I#{HOMEBREW_PREFIX}/include/atk-1.0", "-I#{HOMEBREW_PREFIX}/include/glib-2.0", "-I#{HOMEBREW_PREFIX}/lib/glib-2.0/include", "-I#{HOMEBREW_PREFIX}/opt/gettext/include", "test.c", "-L#{HOMEBREW_PREFIX}/lib", "-L#{HOMEBREW_PREFIX}/lib", "-L#{HOMEBREW_PREFIX}/opt/gettext/lib", "-latk-1.0", "-lgobject-2.0", "-lglib-2.0", "-lintl", "-o", "test" + 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}/atk-1.0 + -L#{gettext.opt_lib} + -L#{glib.opt_lib} + -L#{lib} + -latk-1.0 + -lglib-2.0 + -lgobject-2.0 + -lintl + ] + system ENV.cc, "test.c", "-o", "test", *flags system "./test" end end