For reference and possible critique, I wrote up notes on how I built a Universal matplotlib dist.

# Build instructions for a matplotlib distribution on OSX
# Using python-2.5 package from python.org

# Getting starting
quaternion:mpl-build cmoad$ pwd
/usr/local/src/mpl-build
quaternion:mpl-build cmoad$ ll
total 11408
-rw-r--r--@ 1 cmoad  staff   1.2M Jul  2 18:06 freetype-2.3.5.tar.bz2
-rw-r--r--@ 1 cmoad  staff   600K Nov  9 07:31 libpng-1.2.23.tar.bz2
-rw-r--r--  1 cmoad  wheel   3.8M Nov 29 21:47 matplotlib-0.91.1.tar.gz

# Setup environment for Universal builds of libpng and freetype
quaternion:mpl-build cmoad$ export MACOSX_DEPLOYMENT_TARGET=10.4
quaternion:mpl-build cmoad$ export CFLAGS="-arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk"
quaternion:mpl-build cmoad$ export LDFLAGS="-arch i386 -arch ppc -syslibroot,/Developer/SDKs/MacOSX10.4u.sdk"

# Starting with libpng
quaternion:mpl-build cmoad$ tar -xjf libpng-1.2.23.tar.bz2 
quaternion:mpl-build cmoad$ cd libpng-1.2.23

# To avoid errors with "-M" flags and Universal builds, pass "--disable-dependency-tracking" to configure
quaternion:libpng-1.2.23 cmoad$ ./configure --disable-dependency-tracking
quaternion:libpng-1.2.23 cmoad$ make -j3

# To make sure we don't link against the dynamic libs, copy the static library to the libpng source root
quaternion:libpng-1.2.23 cmoad$ cp .libs/libpng.a ./

# To prove we have a Universal binary
quaternion:libpng-1.2.23 cmoad$ file libpng.a 
libpng.a: Mach-O universal binary with 2 architectures
libpng.a (for architecture i386):       current ar archive random library
libpng.a (for architecture ppc):        current ar archive random library

# Next to freetype
quaternion:libpng-1.2.23 cmoad$ cd ../
quaternion:mpl-build cmoad$ tar -xjf freetype-2.3.5.tar.bz2 
quaternion:mpl-build cmoad$ cd freetype-2.3.5
quaternion:freetype-2.3.5 cmoad$ ./configure
quaternion:freetype-2.3.5 cmoad$ make -j3

# Copy the freetype static lib to its source root as well
quaternion:freetype-2.3.5 cmoad$ cp objs/.libs/libfreetype.a ./

# To prove we have a Universal binary
quaternion:freetype-2.3.5 cmoad$ file libfreetype.a 
libfreetype.a: Mach-O universal binary with 2 architectures
libfreetype.a (for architecture i386):  current ar archive random library
libfreetype.a (for architecture ppc):   current ar archive random library

# Finally to matplotlib
quaternion:freetype-2.3.5 cmoad$ cd ../

# This OSX package from python.org will build Universal python extensions without our help
quaternion:mpl-build cmoad$ unset MACOSX_DEPLOYMENT_TARGET
quaternion:mpl-build cmoad$ unset CFLAGS 
quaternion:mpl-build cmoad$ unset LDFLAGS

# Point gcc to our new Universal builds of libpng and freetype
quaternion:mpl-build cmoad$ export CFLAGS="-arch ppc -arch i386 -I/usr/local/src/mpl-build/libpng-1.2.23 -I/usr/local/src/mpl-build/freetype-2.3.5/include"
quaternion:mpl-build cmoad$ export LDFLAGS="-arch ppc -arch i386 -L/usr/local/src/mpl-build/libpng-1.2.23 -L/usr/local/src/mpl-build/freetype-2.3.5"

# Now we are ready to build matplotlib
quaternion:mpl-build cmoad$ tar -xzf matplotlib-0.91.1.tar.gz 
quaternion:mpl-build cmoad$ cd matplotlib-0.91.1

# Matplotlib's detected environment for those interested (I already installed numpy)
quaternion:matplotlib-0.91.1 cmoad$ python setupegg.py 
============================================================================
BUILDING MATPLOTLIB
            matplotlib: 0.91.1
                python: 2.5.1 (r251:54869, Apr 18 2007, 22:08:04)  [GCC
                        4.0.1 (Apple Computer, Inc. build 5367)]
              platform: darwin

REQUIRED DEPENDENCIES
                 numpy: 1.0.4
             freetype2: found, but unknown version (no pkg-config)

OPTIONAL BACKEND DEPENDENCIES
                libpng: found, but unknown version (no pkg-config)
               Tkinter: Tkinter: 50704, Tk: 8.4, Tcl: 8.4
              wxPython: no
                        * wxPython not found
                  Gtk+: no
                        * Building for Gtk+ requires pygtk; you must be able
                        * to "import gtk" in your build/install environment
                    Qt: no
                   Qt4: no
                 Cairo: no

OPTIONAL DATE/TIMEZONE DEPENDENCIES
              datetime: present, version unknown
              dateutil: matplotlib will provide
                  pytz: matplotlib will provide

OPTIONAL USETEX DEPENDENCIES
                dvipng: no
           ghostscript: /bin/sh: gs: command not found
                 latex: no

EXPERIMENTAL CONFIG PACKAGE DEPENDENCIES
             configobj: matplotlib will provide
      enthought.traits: matplotlib will provide

# Finally build the matplotlib egg
quaternion:matplotlib-0.91.1 cmoad$ python setupegg.py bdist_egg

# The resulting eggs which should be **cross fingers** 10.3+ compatible
quaternion:matplotlib-0.91.1 cmoad$ ll dist/
total 12184
-rw-r--r--  1 cmoad  wheel   5.9M Nov 29 23:03 matplotlib-0.91.1-py2.5-macosx-10.3-fat.egg

# END

Attached as well in case line breaks destroy the readability.

{\rtf1\ansi\ansicpg1252\cocoartf949
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww17580\viewh15060\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural

\f0\i\fs24 \cf0 # Build instructions for a matplotlib distribution on OSX\
# Using python-2.5 package from python.org
\i0 \
\

\i # Getting starting
\i0 \

\b quaternion:mpl-build cmoad$
\b0  pwd\
/usr/local/src/mpl-build\

\b quaternion:mpl-build cmoad$
\b0  ll\
total 11408\
-rw-r--r--@ 1 cmoad  staff   1.2M Jul  2 18:06 freetype-2.3.5.tar.bz2\
-rw-r--r--@ 1 cmoad  staff   600K Nov  9 07:31 libpng-1.2.23.tar.bz2\
-rw-r--r--  1 cmoad  wheel   3.8M Nov 29 21:47 matplotlib-0.91.1.tar.gz\
\

\i # Setup environment for Universal builds of libpng and freetype
\i0 \

\b quaternion:mpl-build cmoad$
\b0  export MACOSX_DEPLOYMENT_TARGET=10.4\

\b quaternion:mpl-build cmoad$
\b0  export CFLAGS="-arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk"\

\b quaternion:mpl-build cmoad$
\b0  export LDFLAGS="-arch i386 -arch ppc -syslibroot,/Developer/SDKs/MacOSX10.4u.sdk"\
\

\i # Starting with libpng
\i0 \

\b quaternion:mpl-build cmoad$
\b0  tar -xjf libpng-1.2.23.tar.bz2 \

\b quaternion:mpl-build cmoad$
\b0  cd libpng-1.2.23\
\

\i # To avoid errors with "-M" flags and Universal builds, pass "--disable-dependency-tracking" to configure
\i0 \

\b quaternion:libpng-1.2.23 cmoad$
\b0  ./configure --disable-dependency-tracking\

\b quaternion:libpng-1.2.23 cmoad$
\b0  make -j3\
\

\i # To make sure we don't link against the dynamic libs, copy the static library to the libpng source root
\i0 \

\b quaternion:libpng-1.2.23 cmoad$
\b0  cp .libs/libpng.a ./\
\

\i # To prove we have a Universal binary
\i0 \

\b quaternion:libpng-1.2.23 cmoad$
\b0  file libpng.a \
libpng.a: Mach-O universal binary with 2 architectures\
libpng.a (for architecture i386):       current ar archive random library\
libpng.a (for architecture ppc):        current ar archive random library\
\

\i # Next to freetype
\i0 \

\b quaternion:libpng-1.2.23 cmoad$
\b0  cd ../\

\b quaternion:mpl-build cmoad$
\b0  tar -xjf freetype-2.3.5.tar.bz2 \

\b quaternion:mpl-build cmoad$
\b0  cd freetype-2.3.5\

\b quaternion:freetype-2.3.5 cmoad$
\b0  ./configure\

\b quaternion:freetype-2.3.5 cmoad$
\b0  make -j3\
\

\i # Copy the freetype static lib to its source root as well
\i0 \

\b quaternion:freetype-2.3.5 cmoad$
\b0  cp objs/.libs/libfreetype.a ./\
\

\i # To prove we have a Universal binary\

\i0\b quaternion:freetype-2.3.5 cmoad$
\b0  file libfreetype.a \
libfreetype.a: Mach-O universal binary with 2 architectures\
libfreetype.a (for architecture i386):  current ar archive random library\
libfreetype.a (for architecture ppc):   current ar archive random library
\i \
\
# Finally to matplotlib\

\i0\b quaternion:freetype-2.3.5 cmoad$
\b0  cd ../\
\

\i # This OSX package from python.org will build Universal python extensions without our help
\i0 \

\b quaternion:mpl-build cmoad$
\b0  unset MACOSX_DEPLOYMENT_TARGET\

\b quaternion:mpl-build cmoad$
\b0  unset CFLAGS \

\b quaternion:mpl-build cmoad$
\b0  unset LDFLAGS\
\

\i # Point gcc to our new Universal builds of libpng and freetype
\i0 \

\b quaternion:mpl-build cmoad$
\b0  export CFLAGS="-arch ppc -arch i386 -I/usr/local/src/mpl-build/libpng-1.2.23 -I/usr/local/src/mpl-build/freetype-2.3.5/include"\

\b quaternion:mpl-build cmoad$
\b0  export LDFLAGS="-arch ppc -arch i386 -L/usr/local/src/mpl-build/libpng-1.2.23 -L/usr/local/src/mpl-build/freetype-2.3.5"\
\

\i # Now we are ready to build matplotlib
\i0 \

\b quaternion:mpl-build cmoad$
\b0  tar -xzf matplotlib-0.91.1.tar.gz \

\b quaternion:mpl-build cmoad$
\b0  cd matplotlib-0.91.1\
\

\i # Matplotlib's detected environment for those interested (I already installed numpy)
\i0 \

\b quaternion:matplotlib-0.91.1 cmoad$
\b0  python setupegg.py \
============================================================================\
BUILDING MATPLOTLIB\
            matplotlib: 0.91.1\
                python: 2.5.1 (r251:54869, Apr 18 2007, 22:08:04)  [GCC\
                        4.0.1 (Apple Computer, Inc. build 5367)]\
              platform: darwin\
\
REQUIRED DEPENDENCIES\
                 numpy: 1.0.4\
             freetype2: found, but unknown version (no pkg-config)\
\
OPTIONAL BACKEND DEPENDENCIES\
                libpng: found, but unknown version (no pkg-config)\
               Tkinter: Tkinter: 50704, Tk: 8.4, Tcl: 8.4\
              wxPython: no\
                        * wxPython not found\
                  Gtk+: no\
                        * Building for Gtk+ requires pygtk; you must be able\
                        * to "import gtk" in your build/install environment\
                    Qt: no\
                   Qt4: no\
                 Cairo: no\
\
OPTIONAL DATE/TIMEZONE DEPENDENCIES\
              datetime: present, version unknown\
              dateutil: matplotlib will provide\
                  pytz: matplotlib will provide\
\
OPTIONAL USETEX DEPENDENCIES\
                dvipng: no\
           ghostscript: /bin/sh: gs: command not found\
                 latex: no\
\
EXPERIMENTAL CONFIG PACKAGE DEPENDENCIES\
             configobj: matplotlib will provide\
      enthought.traits: matplotlib will provide\
\

\i # Finally build the matplotlib egg
\i0 \

\b quaternion:matplotlib-0.91.1 cmoad$
\b0  python setupegg.py bdist_egg\
\

\i # The resulting eggs which should be **cross fingers** 10.3+ compatible
\i0 \

\b quaternion:matplotlib-0.91.1 cmoad$
\b0  ll dist/\
total 12184\
-rw-r--r--  1 cmoad  wheel   5.9M Nov 29 23:03 matplotlib-0.91.1-py2.5-macosx-10.3-fat.egg\
}
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to