homebrew-core/Formula/pango.rb

95 lines
3.1 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.50/pango-1.50.2.tar.xz"
sha256 "5de9b7ebeaac20b0ea3a194d69b5381bc5589570da596746acb699a3eb62b3de"
license "LGPL-2.0-or-later"
head "https://gitlab.gnome.org/GNOME/pango.git", branch: "main"
bottle do
sha256 cellar: :any, arm64_monterey: "c9ceaec5102b5b9431d0d6cf15dfc93d78efe09c853e24cac316648953176078"
sha256 cellar: :any, arm64_big_sur: "7ce09087ec1491510a76ecc8feda0ddf749be6ee241e96507c064fc545133004"
sha256 cellar: :any, monterey: "d3d5525b900640454104c8728f641e7db03fcbf7685334d25f197895c74e50ff"
sha256 cellar: :any, big_sur: "0ea56caa19aed39987cc82b5587c36943ca56c54d81e68746f1a3566f942381f"
sha256 cellar: :any, catalina: "0ea052ee0df82c6775d29ba0c0a713cfb48d148d9538e9f33eb6f25ecf7a6d6e"
sha256 x86_64_linux: "67fae52cf6695dec136d7f3632e81ae2e602d35daa230701840c47436bffbd1f"
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
mkdir "build" do
system "meson", *std_meson_args,
"-Ddefault_library=both",
"-Dintrospection=enabled",
"-Dfontconfig=enabled",
"-Dcairo=enabled",
"-Dfreetype=enabled",
".."
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