class Fontforge < Formula desc "Command-line outline and bitmap font editor/converter" homepage "https://fontforge.github.io" url "https://github.com/fontforge/fontforge/releases/download/20170731/fontforge-dist-20170731.tar.xz" sha256 "840adefbedd1717e6b70b33ad1e7f2b116678fa6a3d52d45316793b9fd808822" revision 2 bottle do sha256 "ebadbf1cfd49acf9e93a4aae4ac55d1c414f10a6d51c08c01ae4de5ff9b843f7" => :high_sierra sha256 "743eddfc980dac38a3879e471c61761d2f1e77e7bb3c7b9c0b0335979e01c0d5" => :sierra sha256 "357ce3d76f1b77e7a427e97560c15e0df246d5fe68ade404ba1a9b7ababea9b0" => :el_capitan end option "with-giflib", "Build with GIF support" option "with-extra-tools", "Build with additional font tools" deprecated_option "with-gif" => "with-giflib" depends_on "pkg-config" => :build depends_on "libtool" => :run depends_on "gettext" depends_on "pango" depends_on "cairo" depends_on "fontconfig" depends_on "libpng" depends_on "jpeg" => :recommended depends_on "libtiff" => :recommended depends_on "giflib" => :optional depends_on "libspiro" => :optional depends_on "libuninameslist" => :optional depends_on :python if MacOS.version <= :snow_leopard def install ENV["PYTHON_CFLAGS"] = `python-config --cflags`.chomp ENV["PYTHON_LIBS"] = `python-config --ldflags`.chomp args = %W[ --prefix=#{prefix} --disable-silent-rules --disable-dependency-tracking --without-x ] 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" args << "--without-libuninameslist" if build.without? "libuninameslist" # Fix header includes to avoid crash at runtime: # https://github.com/fontforge/fontforge/pull/3147 inreplace "fontforgeexe/startnoui.c", "#include \"fontforgevw.h\"", "#include \"fontforgevw.h\"\n#include \"encoding.h\"" system "./configure", *args system "make", "install" # The app here is not functional. # If you want GUI/App support, check the caveats to see how to get it. (pkgshare/"osx/FontForge.app").rmtree if build.with? "extra-tools" cd "contrib/fonttools" do system "make" bin.install Dir["*"].select { |f| File.executable? f } end end end def caveats; <<-EOS.undent This formula only installs the command line utilities. FontForge.app can be downloaded directly from the website: https://fontforge.github.io Alternatively, install with Homebrew-Cask: brew cask install fontforge EOS end test do system bin/"fontforge", "-version" system bin/"fontforge", "-lang=py", "-c", "import fontforge; fontforge.font()" ENV.append_path "PYTHONPATH", lib+"python2.7/site-packages" system "python", "-c", "import fontforge; fontforge.font()" end end