homebrew-core/Formula/pango.rb

90 lines
3.0 KiB
Ruby

class Pango < Formula
desc "Framework for layout and rendering of i18n text"
homepage "https://pango.gnome.org"
url "https://download.gnome.org/sources/pango/1.50/pango-1.50.11.tar.xz"
sha256 "8800f812d89ee61388188703203f3a7878963c22f8695aaf1fa0a1a1428d17ae"
license "LGPL-2.0-or-later"
head "https://gitlab.gnome.org/GNOME/pango.git", branch: "main"
bottle do
sha256 cellar: :any, arm64_monterey: "8cc6d2c73bd319cd8598a9eb350d7aee05cd56b8f27d66dc533b24bf9b2d734a"
sha256 cellar: :any, arm64_big_sur: "4113394e7d48d042ca1f88faf4aab5e61fa822f472d6285d9915934cddf00af9"
sha256 cellar: :any, monterey: "ebac20ef65acd412a6c9c088026f5ae959b959f7ac6d9546bf86d0c30464b985"
sha256 cellar: :any, big_sur: "e07eac47453ab4d48fd32dcda61ac0891564c1018b0817bb264a600929acf294"
sha256 cellar: :any, catalina: "c0c17233eb077043c7e74e82f466ad463f19c7a4437130fa46b0edd4dcbb73e0"
sha256 x86_64_linux: "55da0de4b67966ee6e4555caa4a7d546f8af1b8d65594b2066563196d078cbf4"
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 "freetype"
depends_on "fribidi"
depends_on "glib"
depends_on "harfbuzz"
def install
system "meson", *std_meson_args, "build",
"-Ddefault_library=both",
"-Dintrospection=enabled",
"-Dfontconfig=enabled",
"-Dcairo=enabled",
"-Dfreetype=enabled"
system "meson", "compile", "-C", "build", "-v"
system "meson", "install", "-C", "build"
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
]
flags << "-lintl" if OS.mac?
system ENV.cc, "test.c", "-o", "test", *flags
system "./test"
end
end