Created
April 13, 2014 17:34
-
-
Save Troush/10593942 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "formula" | |
class Fontforge < Formula | |
homepage "http://fontforge.github.io/" | |
stable do | |
url "https://github.com/fontforge/fontforge/archive/2.0.20140101.tar.gz" | |
sha1 "abce297e53e8b6ff6f08871e53d1eb0be5ab82e7" | |
end | |
head do | |
url 'https://github.com/fontforge/fontforge.git' | |
sha1 "abce297e53e8b6ff6f08871e53d1eb0be5ab82e7" | |
end | |
depends_on :autoconf | |
depends_on :automake | |
depends_on :libtool | |
depends_on 'pkg-config' => :build | |
depends_on 'gettext' | |
depends_on 'glib' | |
depends_on 'freetype' | |
depends_on 'pango' | |
depends_on 'cairo' | |
depends_on 'readline' | |
depends_on 'bdw-gc' | |
depends_on :python => :recommended | |
depends_on 'giflib' => :recommended | |
depends_on :libpng => :recommended | |
depends_on 'jpeg' => :recommended | |
depends_on 'libtiff' => :recommended | |
depends_on 'libxml2' => :recommended | |
depends_on 'libspiro' => :recommended | |
depends_on 'bdw-gc'=> :recommended | |
option "with-x", "Build with X11 support, including FontForge.app" | |
depends_on :x11 if build.with? 'x' | |
depends_on 'czmq' => :optional | |
depends_on 'zeromq' => :optional | |
def install | |
args = ["--prefix=#{prefix}", | |
"--disable-freetype-debugger", | |
"--without-libuninameslist", | |
"--without-libunicodenames"] | |
args << "--without-giflib" if build.without? 'giflib' | |
args << "--without-libpng" if build.without? 'libpng' | |
args << "--without-libjpeg" if build.without? 'jpeg' | |
args << "--without-libtiff" if build.without? 'libtiff' | |
args << "--without-libxml2" if build.without? 'libxml2' | |
args << "--without-libspiro" if build.without? 'libspiro' | |
args << "--with-x" if build.with? 'x' | |
if build.with? 'python' | |
args << "--enable-python-scripting" | |
args << "--enable-python-extension" | |
# This is required because pkg-config cannot find the python package. | |
ENV["PYTHON_CFLAGS"] = `/usr/bin/python-config --cflags`.strip | |
ENV["PYTHON_LIBS"] = `/usr/bin/python-config --libs`.strip | |
else | |
args << "--disable-python-scripting" | |
args << "--disable-python-extension" | |
end | |
# Add environment variables for system libs | |
ENV["ZLIB_CFLAGS"] = "-I/usr/include" | |
ENV["ZLIB_LIBS"] = "-L/usr/lib -lz" | |
system "git clone git://git.savannah.gnu.org/gnulib.git" | |
system "./bootstrap --gnulib-srcdir=gnulib" | |
system "./configure", *args | |
system "make" | |
system "make install" | |
# Move the .app to the prefix to be detected by brew linkapps. | |
prefix.install share/"fontforge_package_name/osx/FontForge.app" | |
end | |
test do | |
system "#{bin}/fontforge", "-version" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment