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
|
|
|
homepage 'http://www.pythonware.com/products/pil/'
|
2013-06-26 17:39:24 +00:00
|
|
|
url 'http://effbot.org/media/downloads/Imaging-1.1.7.tar.gz'
|
2012-09-03 18:33:56 +00:00
|
|
|
sha1 '76c37504251171fda8da8e63ecb8bc42a69a5c81'
|
2010-02-14 12:06:37 +00:00
|
|
|
|
2012-10-21 16:58:30 +00:00
|
|
|
depends_on :freetype
|
2013-01-21 09:33:56 +00:00
|
|
|
depends_on :python
|
2010-02-14 12:06:37 +00:00
|
|
|
depends_on 'jpeg' => :recommended
|
2013-01-27 02:49:47 +00:00
|
|
|
depends_on 'little-cms' => :optional
|
2012-10-20 13:43:57 +00:00
|
|
|
|
|
|
|
# The patch is to fix a core dump in Bug in PIL's quantize() with 64 bit architectures.
|
|
|
|
# http://mail.python.org/pipermail/image-sig/2012-June/007047.html
|
|
|
|
def patches
|
|
|
|
DATA
|
|
|
|
end
|
2010-02-14 12:06:37 +00:00
|
|
|
|
2013-07-14 03:56:45 +00:00
|
|
|
def freetype_prefix
|
|
|
|
MacOS.version >= :mountain_lion ? HOMEBREW_PREFIX/"opt/freetype" : MacOS::X11.prefix
|
|
|
|
end
|
|
|
|
|
2010-02-14 12:06:37 +00:00
|
|
|
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.
|
2013-01-21 09:33:56 +00:00
|
|
|
archs = archs_for_command(python.binary)
|
2011-04-05 14:20:35 +00:00
|
|
|
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-10-21 16:58:30 +00:00
|
|
|
"add_directory(include_dirs, \"#{freetype_prefix}/include\")"
|
2010-02-14 12:06:37 +00:00
|
|
|
|
|
|
|
s.gsub! 'add_directory(include_dirs, "/sw/lib/freetype2/include")',
|
2012-10-21 16:58:30 +00:00
|
|
|
"add_directory(library_dirs, \"#{freetype_prefix}/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
|
|
|
|
|
2013-01-21 09:33:56 +00:00
|
|
|
python do
|
|
|
|
system python, "setup.py", "install" ,"--prefix=#{prefix}"
|
|
|
|
end
|
2010-02-14 12:06:37 +00:00
|
|
|
end
|
2012-12-13 18:55:53 +00:00
|
|
|
|
2010-02-14 12:06:37 +00:00
|
|
|
end
|
2012-10-20 13:43:57 +00:00
|
|
|
|
|
|
|
__END__
|
|
|
|
--- a/libImaging/Quant.c
|
|
|
|
+++ b/libImaging/Quant.c
|
|
|
|
@@ -914,7 +914,7 @@
|
|
|
|
unsigned long bestdist,bestmatch,dist;
|
|
|
|
unsigned long initialdist;
|
|
|
|
HashTable h2;
|
|
|
|
- int pixelVal;
|
|
|
|
+ unsigned long pixelVal;
|
|
|
|
|
|
|
|
h2=hashtable_new(unshifted_pixel_hash,unshifted_pixel_cmp);
|
|
|
|
for (i=0;i<nPixels;i++) {
|