[Image-SIG] Mac support for PIL

Bill Janssen janssen at parc.com
Sat May 8 23:48:50 CEST 2010


Here's the fragment of my csh script which builds PIL.  I unpack PIL, libpng,
libjpeg, libfreetype, and libtiff in a directory, then build them with
this.  Note that the key in building PIL is to replace the reference to "/sw"
with the pointer to where you want to install it, in this example "/usr/local".
You may need to run this as sudo, depending on what else you've done to your
Python installation -- this one's keyed to the standard /usr/bin/python.

Bill

================================================================================

setenv distdir /usr/local

cd libpng-*
./configure --prefix=${distdir}
make
make install

cd ../jpeg*
./configure --prefix=${distdir}
make
make install
make install-lib
make install-headers
ranlib ${distdir}/lib/libjpeg.a

setenv CPPFLAGS "-I${distdir}/include"
setenv LDFLAGS "-L${distdir}/lib"
setenv CXXFLAGS "-I${distdir}/include"

cd ../tiff-*
./configure --prefix=${distdir} --without-x
make
make install

cd ../freetype-2.*
# first, get rid of erroneous mac flag
cp include/freetype/config/ftconfig.h /tmp/build-mac-uplib-tmp-$$
rm -f include/freetype/config/ftconfig.h
sed -e 's/#define FT_MACINTOSH 1/#undef FT_MACINTOSH/' < /tmp/build-mac-uplib-tmp-$$ > include/freetype/config/ftconfig.h
# next, enable the bytecode interpreter
rm -f /tmp/build-mac-uplib-tmp-$$
cp include/freetype/config/ftoption.h /tmp/build-mac-uplib-tmp-$$
rm -f include/freetype/config/ftoption.h
sed -e 's;/\* #define  TT_CONFIG_OPTION_BYTECODE_INTERPRETER \*/;#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER;' < /tmp/build-mac-uplib-tmp-$$ > include/freetype/config/ftoption.h
# now build
./configure --prefix=${distdir}
make
make install
cp ${distdir}/include/ft2build.h ${distdir}/include/freetype2/

cd ../Imaging-1.1.*
rm -f /tmp/build-mac-uplib-tmp-$$
cp setup.py /tmp/build-mac-uplib-tmp-$$
sed -e "s;/sw;${distdir};" < /tmp/build-mac-uplib-tmp-$$ > setup.py
/usr/bin/python setup.py build
/usr/bin/python setup.py install

================================================================================


More information about the Image-SIG mailing list