Using Apple's freetype2 for mpl on OS X

Hi folks-

I'd like to report a possible way for OS X mpl users to use Apple's freetype2
(in their X11), to see if there are any problems with it I may need to be
aware of, and if not, to offer it as a possible solution to others installing
mpl from source on OS X. I know Apple's freetype2 was "broken" in Panther,
but it's possible things are different with Tiger.

The basic issue is that Apple's X11 installs a version of freetype2 under
/usr/X11R6/ which might be usable by mpl, and which can conflict with other
copies users might install to build mpl.

With Panther (10.3), I followed mpl build instructions and installed my own
freetype2. I tried two different methods: using i-Installer, and directly
from source (into /usr/local/). Both approaches worked fine with mpl.
However, using either version led to problems with other X11 software I tried
to install. The issues I remember had to do with GTK (i.e., installing PyGTK
and an unrelated GTK app, geda, from source). There were troublesome issues
having to do with freetype2 and some other X11 libs. According to some
anecdotal reports I found online, it appears Apple did something strange to
the freetype version (at least in Panther versions of X11), so gcc/ld would
link against it even if a more recent version was in /usr/local/, but then
there would be freetype issues at runtime. My eventual solution involved
removing various parts of Apple's X11, and putting links in /usr/X11R6/ to the
new installs in /usr/local/. (I have a script to do this, if anyone needs
it.)

This was such a headache that when I just upgraded to Tiger (10.4; a clean
install), I thought I'd see if mpl could be installed using the new freetype2
in Apple's X11. (I also did not install zlib, since 10.4 includes it in
/usr/lib/.) To do so, I had to modify "add_ft2font_flags" in setupext.py,
adding this to the top:

    # Added to provide access to Apple's freetype2 when their X11 is installed
    if sys.platform=='darwin':
        # Add paths to Apple's X11R6.
        module.library_dirs.extend(
            ['/usr/X11R6/lib'])

        module.include_dirs.extend(
            ['/usr/X11R6/include'])

(Also, the docstring is incorrect and should be fixed to refer to freetype2
rather than gd.) With this change, mpl built without any errors, and as far
as I can tell so far, is working just fine. I've come across a few missing
font/font replacement warnings, but I don't know whether installing a new
freetype2 would have avoided these.

If anyone can see a problem with this procedure, please let me know.
Otherwise, it means that Tiger users who have installed Apple's X11 need to
install just one library (libpng) before installing mpl, so long as the above
change is made to setupext.py. I don't know if the change would have any
ramifications for those who don't install X11 or who do install it and *also*
install freetype2 in /usr/local/. If no problems are anticipated, perhaps
the change can be incorporated into mpl.

Thanks for any feedback on this.

-Tom

···

-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/