homebrew-core/Formula/pango.rb

90 lines
2.7 KiB
Ruby

class Pango < Formula
desc "Framework for layout and rendering of i18n text"
homepage "https://www.pango.org/"
url "https://download.gnome.org/sources/pango/1.48/pango-1.48.5.tar.xz"
sha256 "501e74496173c02dcd024ded7fbb3f09efd37e2a488e248aa40799424dbb3b2a"
license "LGPL-2.0-or-later"
head "https://gitlab.gnome.org/GNOME/pango.git"
bottle do
sha256 cellar: :any, arm64_big_sur: "9f6e9e61202b9487e03250a5fef359f20aec9e8e8e44d43d6b9d8837fa182c5f"
sha256 cellar: :any, big_sur: "cabbacd4559bb2c843f6e4965f65c6baf5e66a554f127ee2341ac8919fd6e6e7"
sha256 cellar: :any, catalina: "e520248233b721ffdec92cffd18d4cffff6c1d2fb5f2e072ee4568e69d5d1e9d"
sha256 cellar: :any, mojave: "8dd0f1794a0a882b928c7fbfa003210811396bb376a7e55833586473a21a5bab"
end
depends_on "gobject-introspection" => :build
depends_on "meson" => :build
depends_on "ninja" => :build
depends_on "pkg-config" => :build
depends_on "cairo"
depends_on "fontconfig"
depends_on "fribidi"
depends_on "glib"
depends_on "harfbuzz"
def install
mkdir "build" do
system "meson", *std_meson_args,
"-Ddefault_library=both",
"-Dintrospection=enabled",
"-Duse_fontconfig=true",
".."
system "ninja", "-v"
system "ninja", "install", "-v"
end
end
test do
system "#{bin}/pango-view", "--version"
(testpath/"test.c").write <<~EOS
#include <pango/pangocairo.h>
int main(int argc, char *argv[]) {
PangoFontMap *fontmap;
int n_families;
PangoFontFamily **families;
fontmap = pango_cairo_font_map_get_default();
pango_font_map_list_families (fontmap, &families, &n_families);
g_free(families);
return 0;
}
EOS
cairo = Formula["cairo"]
fontconfig = Formula["fontconfig"]
freetype = Formula["freetype"]
gettext = Formula["gettext"]
glib = Formula["glib"]
harfbuzz = Formula["harfbuzz"]
libpng = Formula["libpng"]
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#{harfbuzz.opt_include}/harfbuzz
-I#{include}/pango-1.0
-I#{libpng.opt_include}/libpng16
-I#{pixman.opt_include}/pixman-1
-D_REENTRANT
-L#{cairo.opt_lib}
-L#{gettext.opt_lib}
-L#{glib.opt_lib}
-L#{lib}
-lcairo
-lglib-2.0
-lgobject-2.0
-lpango-1.0
-lpangocairo-1.0
]
on_macos do
flags << "-lintl"
end
system ENV.cc, "test.c", "-o", "test", *flags
system "./test"
end
end