homebrew-core/Formula/cairo.rb
2015-08-05 19:47:23 +01:00

81 lines
2.3 KiB
Ruby

class Cairo < Formula
desc "Vector graphics library with cross-device output support"
homepage "http://cairographics.org/"
url "http://cairographics.org/releases/cairo-1.14.2.tar.xz"
mirror "https://www.mirrorservice.org/sites/ftp.netbsd.org/pub/pkgsrc/distfiles/cairo-1.14.2.tar.xz"
sha256 "c919d999ddb1bbbecd4bbe65299ca2abd2079c7e13d224577895afa7005ecceb"
revision 1
bottle do
revision 2
sha256 "3307b2b8c32b21af9f9ccd78ab3f798a12a864a2165371782c757db575232824" => :yosemite
sha256 "53d24aab616e3040bec8f2caf736c5b7b1c137d10479596624c5331be61a8a8b" => :mavericks
sha256 "da209992941c375d2d8ba135393546dc181219fa7210bd2d0e0eda80cdf0cfdf" => :mountain_lion
end
keg_only :provided_pre_mountain_lion
option :universal
depends_on "pkg-config" => :build
depends_on "freetype"
depends_on "fontconfig"
depends_on "libpng"
depends_on "pixman"
depends_on "glib"
def install
ENV.universal_binary if build.universal?
args = %W[
--disable-dependency-tracking
--prefix=#{prefix}
--enable-gobject=yes
--enable-svg=yes
--enable-tee=yes
--enable-xlib=no
--enable-xlib-xrender=no
--enable-quartz-image
]
args << "--enable-xcb=no" if MacOS.version <= :leopard
system "./configure", *args
system "make", "install"
end
test do
(testpath/"test.c").write <<-EOS.undent
#include <cairo.h>
int main(int argc, char *argv[]) {
cairo_surface_t *surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 600, 400);
cairo_t *context = cairo_create(surface);
return 0;
}
EOS
fontconfig = Formula["fontconfig"]
freetype = Formula["freetype"]
gettext = Formula["gettext"]
glib = Formula["glib"]
libpng = Formula["libpng"]
pixman = Formula["pixman"]
flags = (ENV.cflags || "").split + (ENV.cppflags || "").split + (ENV.ldflags || "").split
flags += %W[
-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}/cairo
-I#{libpng.opt_include}/libpng16
-I#{pixman.opt_include}/pixman-1
-L#{lib}
-lcairo
]
system ENV.cc, "test.c", "-o", "test", *flags
system "./test"
end
end