class Cairomm < Formula desc "Vector graphics library with cross-device output support" homepage "https://cairographics.org/cairomm/" url "https://cairographics.org/releases/cairomm-1.12.2.tar.gz" sha256 "45c47fd4d0aa77464a75cdca011143fea3ef795c4753f6e860057da5fb8bd599" bottle do cellar :any sha256 "da41ea7c4cd90ab7183f4eba82f6921fd70b8a3ad0301054f2152214efe33373" => :sierra sha256 "4fec10a5e15cceceee0b93e11bf000d9f6365cfc1c97dbc255b4a4d7d7d6c8dd" => :el_capitan sha256 "ce58504dbe14cd1a27aeecd7eed1d95c6fa7819b8ff6ab451e02462cdc699e83" => :yosemite end needs :cxx11 depends_on "pkg-config" => :build depends_on "libsigc++" depends_on "libpng" depends_on "cairo" def install ENV.cxx11 system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}" system "make", "install" end test do (testpath/"test.cpp").write <<-EOS.undent #include int main(int argc, char *argv[]) { Cairo::RefPtr surface = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, 600, 400); Cairo::RefPtr cr = Cairo::Context::create(surface); return 0; } EOS 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 = %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, "-std=c++11", "test.cpp", "-o", "test", *flags system "./test" end end