homebrew-core/Formula/cairo.rb
2019-06-18 18:57:59 +02:00

80 lines
2.4 KiB
Ruby

class Cairo < Formula
desc "Vector graphics library with cross-device output support"
homepage "https://cairographics.org/"
url "https://cairographics.org/releases/cairo-1.16.0.tar.xz"
sha256 "5e7b29b3f113ef870d1e3ecf8adf21f923396401604bda16d44be45e66052331"
revision 2
bottle do
sha256 "fcda779381271541f623470a74b8b0164f1e83c9154b7b7f4ed23038aac3f5d6" => :mojave
sha256 "e9d0d9800f39390a379a2a8b86ab2222c6e21b03fe8b08a3ca6c493c2577255d" => :high_sierra
sha256 "77b1e651611de729ee08eb29037b8909e67603f3ab420a54ece1a893d4d449f5" => :sierra
end
head do
url "https://anongit.freedesktop.org/git/cairo", :using => :git
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
depends_on "pkg-config" => :build
depends_on "fontconfig"
depends_on "freetype"
depends_on "glib"
depends_on "libpng"
depends_on "lzo"
depends_on "pixman"
def install
if build.head?
ENV["NOCONFIGURE"] = "1"
system "./autogen.sh"
end
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}",
"--enable-gobject=yes",
"--enable-svg=yes",
"--enable-tee=yes",
"--enable-quartz-image",
"--enable-xcb=no",
"--enable-xlib=no",
"--enable-xlib-xrender=no"
system "make", "install"
end
test do
(testpath/"test.c").write <<~EOS
#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 = %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