homebrew-core/Formula/gobject-introspection.rb

61 lines
2.1 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.66/gobject-introspection-1.66.1.tar.xz"
sha256 "dd44a55ee5f426ea22b6b89624708f9e8d53f5cc94e5485c15c87cb30e06161d"
license all_of: ["GPL-2.0-or-later", "LGPL-2.0-or-later", "MIT"]
revision 1
livecheck do
url :stable
end
bottle do
sha256 "e5894b5eec0b33c9d00d0b7b1159cdfe6a2947fcf9ac9ade5ff621f2df7932df" => :big_sur
sha256 "3e85468a3324cb560775e024c6fd52212af73994898b381faff9aad5baa2fdb6" => :catalina
sha256 "1d42d9c900dab307aefddffe723140ec2dfa25201426b4426c76cca28a4c46fa" => :mojave
sha256 "e22482d7c20cefd6c020eb7bb3406a9da8e159a128a700fa9d13983c3da426e7" => :high_sierra
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"
resource "tutorial" do
url "https://gist.github.com/7a0023656ccfe309337a.git",
revision: "499ac89f8a9ad17d250e907f74912159ea216416"
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", ".."
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