82 lines
2.4 KiB
Ruby
82 lines
2.4 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.4.tar.xz"
|
|
mirror "https://www.mirrorservice.org/sites/ftp.netbsd.org/pub/pkgsrc/distfiles/cairo-1.14.4.tar.xz"
|
|
sha256 "f6ec9c7c844db9ec011f0d66b57ef590c45adf55393d1fc249003512522ee716"
|
|
|
|
bottle do
|
|
sha256 "a919a8e47b4405bf6b0a614a1f0b17fa3a224e6b10d6bf6e8f182919b1f40640" => :el_capitan
|
|
sha256 "6268e7a3e1d68f04250064ca380a939b114e6394affec53b70c034b5e73594a5" => :yosemite
|
|
sha256 "04f0b2caa48871a13f4e74e411b5bd6dda8aa511475ad3d1ade79a2d1c42766d" => :mavericks
|
|
end
|
|
|
|
keg_only :provided_pre_mountain_lion
|
|
|
|
option :universal
|
|
|
|
depends_on "pkg-config" => :build
|
|
depends_on :x11 => :optional if MacOS.version > :leopard
|
|
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-quartz-image
|
|
]
|
|
|
|
if build.with? "x11"
|
|
args << "--enable-xcb=yes" << "--enable-xlib=yes" << "--enable-xlib-xrender=yes"
|
|
else
|
|
args << "--enable-xcb=no" << "--enable-xlib=no" << "--enable-xlib-xrender=no"
|
|
end
|
|
|
|
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
|