2010-02-14 12:06:37 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Pil < Formula
|
2010-02-14 12:06:37 +00:00
|
|
|
url 'http://effbot.org/downloads/Imaging-1.1.7.tar.gz'
|
|
|
|
homepage 'http://www.pythonware.com/products/pil/'
|
|
|
|
md5 'fc14a54e1ce02a0225be8854bfba478e'
|
|
|
|
|
2012-06-07 01:35:12 +00:00
|
|
|
depends_on :x11
|
2010-02-14 12:06:37 +00:00
|
|
|
depends_on 'jpeg' => :recommended
|
|
|
|
depends_on 'little-cms' => :optional
|
|
|
|
|
|
|
|
def install
|
2011-04-05 14:20:35 +00:00
|
|
|
# Find the arch for the Python we are building against.
|
|
|
|
# We remove 'ppc' support, so we can pass Intel-optimized CFLAGS.
|
|
|
|
archs = archs_for_command("python")
|
|
|
|
archs.remove_ppc!
|
2011-09-02 00:10:31 +00:00
|
|
|
# Can't build universal on 32-bit hardware. See:
|
|
|
|
# https://github.com/mxcl/homebrew/issues/5844
|
2012-01-17 04:39:09 +00:00
|
|
|
archs.delete :x86_64 if Hardware.is_32_bit?
|
2011-04-05 14:20:35 +00:00
|
|
|
ENV['ARCHFLAGS'] = archs.as_arch_flags
|
2010-02-14 12:06:37 +00:00
|
|
|
|
|
|
|
inreplace "setup.py" do |s|
|
|
|
|
# Tell setup where Freetype2 is on 10.5/10.6
|
|
|
|
s.gsub! 'add_directory(include_dirs, "/sw/include/freetype2")',
|
2012-08-06 05:33:36 +00:00
|
|
|
"add_directory(include_dirs, \"#{MacOS::X11.include}\")"
|
2010-02-14 12:06:37 +00:00
|
|
|
|
|
|
|
s.gsub! 'add_directory(include_dirs, "/sw/lib/freetype2/include")',
|
2012-08-06 05:33:36 +00:00
|
|
|
"add_directory(library_dirs, \"#{MacOS::X11.lib}\")"
|
2010-02-14 12:06:37 +00:00
|
|
|
|
|
|
|
# Tell setup where our stuff is
|
|
|
|
s.gsub! 'add_directory(library_dirs, "/sw/lib")',
|
|
|
|
"add_directory(library_dirs, \"#{HOMEBREW_PREFIX}/lib\")"
|
|
|
|
|
|
|
|
s.gsub! 'add_directory(include_dirs, "/sw/include")',
|
|
|
|
"add_directory(include_dirs, \"#{HOMEBREW_PREFIX}/include\")"
|
|
|
|
end
|
|
|
|
|
|
|
|
system "python", "setup.py", "build_ext"
|
|
|
|
system "python", "setup.py", "install", "--prefix=#{prefix}"
|
|
|
|
end
|
|
|
|
|
2011-04-05 14:20:35 +00:00
|
|
|
def caveats; <<-EOS.undent
|
|
|
|
This formula installs PIL against whatever Python is first in your path.
|
|
|
|
This Python needs to have either setuptools or distribute installed or
|
|
|
|
the build will fail.
|
2010-02-14 12:06:37 +00:00
|
|
|
EOS
|
|
|
|
end
|
|
|
|
end
|