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://pango.gnome.org"
url "https://download.gnome.org/sources/pango/1.50/pango-1.50.4.tar.xz"
sha256 "f4ad63e87dc2b145300542a4fb004d07a9f91b34152fae0ddbe50ecdd851c162"
license "LGPL-2.0-or-later"
head "https://gitlab.gnome.org/GNOME/pango.git", branch: "main"
bottle do
sha256 cellar: :any, arm64_monterey: "df36e5f3b64895adf6a5a5de39ef71b01c99c6bda6a8ac45e6a5ef527d0a40e0"
sha256 cellar: :any, arm64_big_sur: "bb0263479f72d47a46483706990208fbe7c29594989599d0fe8157110f834022"
sha256 cellar: :any, monterey: "cebb0e2360cbbe60e56afef30d4cbb3563d436037d0e3c8e78a81b22eda3e70c"
sha256 cellar: :any, big_sur: "19694d3771d06baed767faca055c7f22d7f1133c463f0b1525c035ff637e8629"
sha256 cellar: :any, catalina: "d99bc31f59a189ae413e5978f2870cc5c7424185506c13bfd5995c3fb7911c7b"
sha256 x86_64_linux: "0a5499b66788373a8914b87eff41b5f60444836ca162aa31999bf6164c9f3e5e"
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