One of the packages I wanted to install is ReportLab. Unfortunately, it kept building without Freetype support, so TrueType support was unavailable. This wasn't acceptable, so I started looking for ways to build it with FreeType support in.
According to this, I would have to download and build FreeType separately. That would not do (because I was being lazy, plus, I already had FreeType installed by Apple — I'd already tried to run brew install freetype, and Homebrew warned me that FreeType already comes with Lion in
/usr/X11/include
and /usr/X11/lib
.Initially, I tried adding the respective include and library paths in
setup.cfg
. Didn't work. Eventually, after trying seriously to grok the evil that is distutils code, I found that there is a class called inc_lib_dirs
, and in its implementation of __call__()
, it checks the platform, and makes a lot of calls to aDir()
, setting either an include path (first argument uppercase 'I', no quotes) or a library path (first argument uppercase 'L'; again, without the quotes). I simply added new lines for the appropriate include/library, saved and ran python setup.py build. This worked, so I ran Update: This post talks about building PIL on Snow Leopard with FreeType2 support, but the instructions also work for ReportLab. The tl;dr version is:
- download PIL (or ReportLab) source package
- unpack it
- change directory into the package folder
- create a new file called setup_site.py with the contents: FREETYPE_ROOT = "<freetype library path>", "<freetype header path>"
- run python setup.py build (or install)
1 comment:
Thanks for the post, it did put me in the right direction - but I'm only getting it to work by changing the actual setup.py to include the needed X11 dirs.
I could not make it work, though, by using this setup_site.py extra file. In fact, I don't understand its purpose - is it a standard name that setup.py should seek for? I couldn't find any documentation for it...
Post a Comment