cairomm test cleanup

Part of the tasks set out in Homebrew/homebrew#39584

Closes Homebrew/homebrew#39635.

Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
Tom Schoonjans 2015-05-12 14:34:14 +08:00 committed by Xu Cheng
parent 83fab2104f
commit 234e919c2b

View file

@ -30,6 +30,7 @@ class Cairomm < Formula
"--prefix=#{prefix}"
system "make", "install"
end
test do
(testpath/"test.cpp").write <<-EOS.undent
#include <cairomm/cairomm.h>
@ -41,7 +42,36 @@ class Cairomm < Formula
return 0;
}
EOS
system ENV.cxx, "-I#{HOMEBREW_PREFIX}/include/cairomm-1.0", "-I#{HOMEBREW_PREFIX}/lib/cairomm-1.0/include", "-I#{HOMEBREW_PREFIX}/include/cairo", "-I#{HOMEBREW_PREFIX}/include/glib-2.0", "-I#{HOMEBREW_PREFIX}/lib/glib-2.0/include", "-I#{HOMEBREW_PREFIX}/opt/gettext/include", "-I#{HOMEBREW_PREFIX}/include/pixman-1", "-I#{HOMEBREW_PREFIX}/include", "-I#{HOMEBREW_PREFIX}/include/freetype2", "-I#{HOMEBREW_PREFIX}/include/libpng16", "-I#{HOMEBREW_PREFIX}/include/sigc++-2.0", "-I#{HOMEBREW_PREFIX}/lib/sigc++-2.0/include", "test.cpp", "-L#{HOMEBREW_PREFIX}/lib", "-L#{HOMEBREW_PREFIX}/lib", "-L#{HOMEBREW_PREFIX}/lib", "-lcairomm-1.0", "-lcairo", "-lsigc-2.0", "-o", "test"
cairo = Formula["cairo"]
fontconfig = Formula["fontconfig"]
freetype = Formula["freetype"]
gettext = Formula["gettext"]
glib = Formula["glib"]
libpng = Formula["libpng"]
libsigcxx = Formula["libsigc++"]
pixman = Formula["pixman"]
flags = (ENV.cflags || "").split + (ENV.cppflags || "").split + (ENV.ldflags || "").split
flags += %W[
-I#{cairo.opt_include}/cairo
-I#{fontconfig.opt_include}
-I#{freetype.opt_include}/freetype2
-I#{gettext.opt_include}
-I#{glib.opt_include}/glib-2.0
-I#{glib.opt_lib}/glib-2.0/include
-I#{include}/cairomm-1.0
-I#{libpng.opt_include}/libpng16
-I#{libsigcxx.opt_include}/sigc++-2.0
-I#{libsigcxx.opt_lib}/sigc++-2.0/include
-I#{lib}/cairomm-1.0/include
-I#{pixman.opt_include}/pixman-1
-L#{cairo.opt_lib}
-L#{libsigcxx.opt_lib}
-L#{lib}
-lcairo
-lcairomm-1.0
-lsigc-2.0
]
system ENV.cxx, "test.cpp", "-o", "test", *flags
system "./test"
end
end