homebrew-core/Formula/fontforge.rb
2017-05-07 21:19:24 -07:00

96 lines
3.1 KiB
Ruby

class Fontforge < Formula
desc "Command-line outline and bitmap font editor/converter"
homepage "https://fontforge.github.io"
url "https://github.com/fontforge/fontforge/archive/20161012.tar.gz"
sha256 "a5f5c2974eb9109b607e24f06e57696d5861aaebb620fc2c132bdbac6e656351"
revision 1
head "https://github.com/fontforge/fontforge.git"
bottle do
sha256 "57809a9c61afc72a933fa905464d80de5b8fe59749cadb962e861749698e4453" => :sierra
sha256 "8d2501b45449f86695410f21da449aa5a7f80b15efb74fb975e0d40f6eeb8974" => :el_capitan
sha256 "77aacdcdc740df564b186c043890f433459122b34b3225bdbe3952172f466dd7" => :yosemite
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 "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
resource "gnulib" do
url "https://git.savannah.gnu.org/git/gnulib.git",
:revision => "29ea6d6fe2a699a32edbe29f44fe72e0c253fcee"
end
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"
# Bootstrap in every build: https://github.com/fontforge/fontforge/issues/1806
resource("gnulib").fetch
system "./bootstrap",
"--gnulib-srcdir=#{resource("gnulib").cached_download}",
"--skip-git"
system "./configure", *args
system "make"
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"
ENV.append_path "PYTHONPATH", lib+"python2.7/site-packages"
system "python", "-c", "import fontforge"
end
end