homebrew-core/Formula/gobject-introspection.rb

70 lines
2.8 KiB
Ruby

class GobjectIntrospection < Formula
include Language::Python::Shebang
desc "Generate introspection data for GObject libraries"
homepage "https://gi.readthedocs.io/en/latest/"
url "https://download.gnome.org/sources/gobject-introspection/1.70/gobject-introspection-1.70.0.tar.xz"
sha256 "902b4906e3102d17aa2fcb6dad1c19971c70f2a82a159ddc4a94df73a3cafc4a"
license all_of: ["GPL-2.0-or-later", "LGPL-2.0-or-later", "MIT"]
revision 1
bottle do
sha256 arm64_monterey: "b3415581141e6a2dd35baf1065aef21bfa07cacd582c8f18a728606750904a0c"
sha256 arm64_big_sur: "743867fe7cd99538df90b4a233e36bbc50878f8d97758efa06403b650baaedd6"
sha256 monterey: "974fbe1764602c4e8a7611203bc6bd78d7a47f66531fdbd294138eaacc8f5dc0"
sha256 big_sur: "8f3959289f6ffde7c6e547ea9736dbb4346302a5ebd8bb9780fa044656fa61f5"
sha256 catalina: "140f94de2c097db9ac7f4a7de0293235a4354fd13f687df2791214d58b24e008"
sha256 mojave: "c7f254c243c5c225c3079616174a22ed507e62cdbb47f23b5fb0bf4a8ef45b2f"
sha256 x86_64_linux: "abbd5d8a9d3e17a05c24913da6ca16818453e8d79f0a7f873d86f8beebdeb67b"
end
depends_on "bison" => :build
depends_on "meson" => :build
depends_on "ninja" => :build
depends_on "cairo"
depends_on "glib"
depends_on "libffi"
depends_on "pkg-config"
depends_on "python@3.9"
uses_from_macos "flex" => :build
resource "tutorial" do
url "https://gist.github.com/7a0023656ccfe309337a.git",
revision: "499ac89f8a9ad17d250e907f74912159ea216416"
end
# Fix library search path on non-/usr/local installs (e.g. Apple Silicon)
# See: https://github.com/Homebrew/homebrew-core/issues/75020
# https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/273
patch do
url "https://gitlab.gnome.org/tschoonj/gobject-introspection/-/commit/a7be304478b25271166cd92d110f251a8742d16b.diff"
sha256 "740c9fba499b1491689b0b1216f9e693e5cb35c9a8565df4314341122ce12f81"
end
def install
ENV["GI_SCANNER_DISABLE_CACHE"] = "true"
inreplace "giscanner/transformer.py", "/usr/share", "#{HOMEBREW_PREFIX}/share"
inreplace "meson.build",
"config.set_quoted('GOBJECT_INTROSPECTION_LIBDIR', join_paths(get_option('prefix'), get_option('libdir')))",
"config.set_quoted('GOBJECT_INTROSPECTION_LIBDIR', '#{HOMEBREW_PREFIX}/lib')"
mkdir "build" do
system "meson", *std_meson_args,
"-Dpython=#{Formula["python@3.9"].opt_bin}/python3",
"-Dextra_library_paths=#{HOMEBREW_PREFIX}/lib",
".."
system "ninja", "-v"
system "ninja", "install", "-v"
bin.find { |f| rewrite_shebang detected_python_shebang, f }
end
end
test do
ENV.prepend_path "PKG_CONFIG_PATH", Formula["libffi"].opt_lib/"pkgconfig"
resource("tutorial").stage testpath
system "make"
assert_predicate testpath/"Tut-0.1.typelib", :exist?
end
end