class Fontforge < Formula desc "Outline and bitmap font editor/converter for many formats" homepage "https://fontforge.github.io" url "https://github.com/fontforge/fontforge/archive/20150430.tar.gz" sha256 "430c6d02611c7ca948df743e9241994efe37eda25f81a94aeadd9b6dd286ff37" head "https://github.com/fontforge/fontforge.git" revision 3 bottle do sha256 "32351316ee4effb89c199a7a8abe3c2cab1782d326abe506b92d61b004590a9d" => :yosemite sha256 "0e012b84e88ac322de40fb26d54b8135edfc52cf6f05067c9d3fbd13a15f5bfc" => :mavericks sha256 "a17e8b4989bc0a523d77d6d79c2a035cb1da57ca359e2c5fab6f0601f51ec0c0" => :mountain_lion end option "with-giflib", "Build with GIF support" option "with-extra-tools", "Build with additional font tools" deprecated_option "with-gif" => "with-giflib" # Autotools are required to build from source in all releases. depends_on "autoconf" => :build depends_on "automake" => :build depends_on "pkg-config" => :build depends_on "libtool" => :run depends_on "gettext" depends_on "pango" depends_on "zeromq" depends_on "czmq" depends_on "cairo" depends_on "libpng" => :recommended depends_on "jpeg" => :recommended depends_on "libtiff" => :recommended depends_on "giflib" => :optional depends_on "libspiro" => :optional depends_on :python if MacOS.version <= :snow_leopard # This may be causing font-display glitches and needs further isolation & fixing. # https://github.com/fontforge/fontforge/issues/2083 # https://github.com/Homebrew/homebrew/issues/37803 depends_on "fontconfig" fails_with :llvm do build 2336 cause "Compiling cvexportdlg.c fails with error: initializer element is not constant" end def install if MacOS.version <= :snow_leopard || !build.bottle? pydir = `python-config --prefix`.chomp else pydir = `/usr/bin/python-config --prefix`.chomp end args = %W[ --prefix=#{prefix} --disable-silent-rules --disable-dependency-tracking --with-pythonbinary=#{pydir}/bin/python2.7 --without-x ] args << "--without-libpng" if build.without? "libpng" args << "--without-libjpeg" if build.without? "jpeg" args << "--without-libtiff" if build.without? "libtiff" args << "--without-giflib" if build.without? "giflib" args << "--without-libspiro" if build.without? "libspiro" # Fix linker error; see: https://trac.macports.org/ticket/25012 ENV.append "LDFLAGS", "-lintl" # Reset ARCHFLAGS to match how we build ENV["ARCHFLAGS"] = "-arch #{MacOS.preferred_arch}" # And for finding the correct Python, not always Homebrew's. ENV.prepend "CFLAGS", "-I#{pydir}/include" ENV.prepend "LDFLAGS", "-L#{pydir}/lib" ENV.prepend_path "PKG_CONFIG_PATH", "#{pydir}/lib/pkgconfig" # Bootstrap in every build: https://github.com/fontforge/fontforge/issues/1806 system "./bootstrap" system "./configure", *args system "make" system "make", "install" if build.with? "extra-tools" cd "contrib/fonttools" do system "make" bin.install Dir["*"].select { |f| File.executable? f } end end end test do system bin/"fontforge", "-version" end end