class Cairomm < Formula desc "Vector graphics library with cross-device output support" homepage "https://cairographics.org/cairomm/" url "https://cairographics.org/releases/cairomm-1.16.0.tar.xz" sha256 "7e881492c5f9f546688c31160deb742c166fc4c68b6b8eb9920c00a0f0f144f9" license "LGPL-2.0-or-later" livecheck do url "https://cairographics.org/releases/?C=M&O=D" regex(/href=.*?cairomm[._-]v?(\d+\.\d*[02468](?:\.\d+)*)\.t/i) end bottle do cellar :any sha256 "6177df22ea052d3e7ccd44d621d24837478340ea0d1385ef401a069414f893f1" => :big_sur sha256 "cad19588b9a033b690cd2f1b73cb75282e017e1d32dfd39e29f7a35e2e8d3d91" => :catalina sha256 "b90f4177caced79c28888be8b38150c22d9a147eaa96493810ddbdf3fee87bf4" => :mojave end depends_on "meson" => :build depends_on "ninja" => :build depends_on "pkg-config" => :build depends_on "cairo" depends_on "libpng" depends_on "libsigc++" def install ENV.cxx11 mkdir "build" do system "meson", *std_meson_args, ".." system "ninja" system "ninja", "install" end end test do (testpath/"test.cpp").write <<~EOS #include int main(int argc, char *argv[]) { Cairo::RefPtr surface = Cairo::ImageSurface::create(Cairo::Surface::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.16 -I#{libpng.opt_include}/libpng16 -I#{libsigcxx.opt_include}/sigc++-3.0 -I#{libsigcxx.opt_lib}/sigc++-3.0/include -I#{lib}/cairomm-1.16/include -I#{pixman.opt_include}/pixman-1 -L#{cairo.opt_lib} -L#{libsigcxx.opt_lib} -L#{lib} -lcairo -lcairomm-1.16 -lsigc-3.0 ] system ENV.cxx, "-std=c++17", "test.cpp", "-o", "test", *flags system "./test" end end