homebrew-core/Formula/pango.rb

101 lines
2.7 KiB
Ruby

class Pango < Formula
desc "Framework for layout and rendering of i18n text"
homepage "http://www.pango.org/"
url "https://download.gnome.org/sources/pango/1.40/pango-1.40.5.tar.xz"
sha256 "24748140456c42360b07b2c77a1a2e1216d07c056632079557cd4e815b9d01c9"
bottle do
sha256 "d6062a0999467c8316d9b15a436ba8ef62c46294feadb47fc1e73e72d211f585" => :sierra
sha256 "d9cd6b2ebb90bf42167f6ddf70311ac11dbdd7d133c48639f7a511433a098c43" => :el_capitan
sha256 "f8b34e7f18afa1b992a7e3d4d9308314e51b56c6886ab847fe0e2f8dc50834ce" => :yosemite
end
head do
url "https://git.gnome.org/browse/pango.git"
depends_on "automake" => :build
depends_on "autoconf" => :build
depends_on "libtool" => :build
depends_on "gtk-doc" => :build
end
depends_on "pkg-config" => :build
depends_on :x11 => :optional
depends_on "glib"
depends_on "cairo"
depends_on "harfbuzz"
depends_on "fontconfig"
depends_on "gobject-introspection"
def install
args = %W[
--disable-dependency-tracking
--disable-silent-rules
--prefix=#{prefix}
--enable-man
--with-html-dir=#{share}/doc
--enable-introspection=yes
--enable-static
]
if build.with? "x11"
args << "--with-xft"
else
args << "--without-xft"
end
system "./autogen.sh" if build.head?
system "./configure", *args
system "make"
system "make", "install"
end
test do
system "#{bin}/pango-view", "--version"
(testpath/"test.c").write <<-EOS.undent
#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"]
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#{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
-lintl
-lpango-1.0
-lpangocairo-1.0
]
system ENV.cc, "test.c", "-o", "test", *flags
system "./test"
end
end