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.10.tar.xz"
sha256 "7e5d2f1e40854d24a9a2c4d093bafe75dcdbeccdf1de43e4437332eabed64966"
license "LGPL-2.0-or-later"
head "https://gitlab.gnome.org/GNOME/pango.git", branch: "main"
bottle do
sha256 cellar: :any, arm64_monterey: "087371450d8bdc58766d87014d3529d2425454d686c682d061796fd5a4c24cc0"
sha256 cellar: :any, arm64_big_sur: "bca58c3e410a7efd6a3e42995fa171b2d70f4f66754c0f2c7274cdfada54de4f"
sha256 cellar: :any, monterey: "d95ba94cb331ac5e7b2f4a187224a7eecc421576e466ad0bc5011d8748a86e52"
sha256 cellar: :any, big_sur: "b5b785f0b3f9b87934c4c1551f2f117b1810a31a1e38e8d5527a3a8a2ad0d685"
sha256 cellar: :any, catalina: "cb4a67c5ba83e94e7bec28162d83c4c6eb7415ca105c3d11f22b36df878fd594"
sha256 x86_64_linux: "55022bcdbb06ba1b25309949236561f568adfd21c801812ecfece4aa7cc00a7f"
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