[Image-SIG] PIL builds for Mac OS X

Bill Janssen janssen at parc.com
Fri Apr 4 20:05:28 CEST 2008

Here's a fuller excerpt from my build script, in case it's helpful to
someone.  This is part of how I build the Mac installer for UpLib --
one of the side-effects of installing UpLib on a Mac is a full-fledged
PIL installation in the system Python.

I unpack PIL and all the prereq packages in /tmp, and go to work.
${distdir} could be "/usr/local"; for UpLib I use
"/Library/UpLib/<VERSION>".  I'm omitting large chunks; I also build
Lucene, xpdf, htmldoc, etc.


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

cd ../jpeg*
./configure --prefix=${distdir}
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 ../jbig2dec*
./configure --prefix=${distdir}
make install

cd ../ghostscript-8*
ln -s ../jpeg-6b ./jpeg
# Macs may not have X11, so make sure not to link it in by accident
./configure --without-x --prefix=${distdir}
make install

cd ../fonts
install -m 444 * ${distdir}/share/ghostscript/fonts

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

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

cd ../t1lib-5.*
./configure --without-x --without-athena --prefix=${distdir}
make without_doc
make install

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

More information about the Image-SIG mailing list