homebrew-core/Formula/gegl.rb

90 lines
2.9 KiB
Ruby

class Gegl < Formula
desc "Graph based image processing framework"
homepage "https://www.gegl.org/"
url "https://download.gimp.org/pub/gegl/0.4/gegl-0.4.36.tar.xz"
sha256 "6fd58a0cdcc7702258adaeffb573a389228ae8f0eff47578efda2309b61b2ca6"
license all_of: ["LGPL-3.0-or-later", "GPL-3.0-or-later", "BSD-3-Clause", "MIT"]
head "https://gitlab.gnome.org/GNOME/gegl.git", branch: "master"
livecheck do
url "https://download.gimp.org/pub/gegl/0.4/"
regex(/href=.*?gegl[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 arm64_monterey: "a91f3f6b32deacfc1c91169b4e5183929e9b82430bef2fdbf3e4da4663d188c4"
sha256 arm64_big_sur: "f8bf081e087a3e5b470e9a327ff50047cf17c9ebb9f7570f530cab92a7736a0c"
sha256 monterey: "a04deb788626f77457cde16d421839eda775f45afaa11d7fc48eb038a8d27be8"
sha256 big_sur: "d59252856cebc4916eb25f2af230cda980c56594d63cc5e91084cc4936f6d966"
sha256 catalina: "b5018fc41c0a7cb2ba44812798790b51014ff51b0c10e9535bea53ac8f476ac3"
sha256 x86_64_linux: "4dbaf182578d98e5048bc3cd3eacdfdf0e1b0de787a6e97457ae5b6e05d016dc"
end
depends_on "glib" => :build
depends_on "gobject-introspection" => :build
depends_on "meson" => :build
depends_on "ninja" => :build
depends_on "pkg-config" => :build
depends_on "python@3.10" => :build
depends_on "babl"
depends_on "gettext"
depends_on "glib"
depends_on "jpeg"
depends_on "json-glib"
depends_on "libpng"
on_linux do
depends_on "cairo"
end
conflicts_with "coreutils", because: "both install `gcut` binaries"
def install
args = std_meson_args + %w[
-Ddocs=false
-Dcairo=disabled
-Djasper=disabled
-Dumfpack=disabled
-Dlibspiro=disabled
--force-fallback-for=libnsgif,poly2tri-c
]
### Temporary Fix ###
# Temporary fix for a meson bug
# Upstream appears to still be deciding on a permanent fix
# See: https://gitlab.gnome.org/GNOME/gegl/-/issues/214
inreplace "subprojects/poly2tri-c/meson.build",
"libpoly2tri_c = static_library('poly2tri-c',",
"libpoly2tri_c = static_library('poly2tri-c', 'EMPTYFILE.c',"
touch "subprojects/poly2tri-c/EMPTYFILE.c"
### END Temporary Fix ###
mkdir "build" do
system "meson", *args, ".."
system "ninja", "-v"
system "ninja", "install", "-v"
end
end
test do
(testpath/"test.c").write <<~EOS
#include <gegl.h>
gint main(gint argc, gchar **argv) {
gegl_init(&argc, &argv);
GeglNode *gegl = gegl_node_new ();
gegl_exit();
return 0;
}
EOS
system ENV.cc,
"-I#{Formula["babl"].opt_include}/babl-0.1",
"-I#{Formula["glib"].opt_include}/glib-2.0",
"-I#{Formula["glib"].opt_lib}/glib-2.0/include",
"-L#{Formula["glib"].opt_lib}", "-lgobject-2.0", "-lglib-2.0",
testpath/"test.c",
"-I#{include}/gegl-0.4", "-L#{lib}", "-lgegl-0.4",
"-o", testpath/"test"
system "./test"
end
end