On Nov 14, 2007, at 11:11 AM, Jeremy Conlin wrote:
Mr. Waters,I read on the matplotlib mailing lists that you have compiled matplotlib on Leopard using libpng, freetype, etc. that are included with Leopard. I am trying to do the same, but have so far been unsuccessful. I could install those libraries from source, but would rather not. Would you mind sharing what you did to compile matplotlib with the included libraries?
I did this with a MacPorts build system. It checks out the matplotlib from subversion, applies some patches, then builds.
Ah, I built with Apple's pre-release GCC 4.2 for Leopard, which is available for ADC members... I have also built this with a "stock" GCC 4.2.1, so you might be able to just get that compiler. And almost certainly it would work with Apple's GCC 4.0, but you'll have to remove the CFLAGS settings (see below).
Oh yes... I also didn't like the flags that Apple used to build Python; distutils has no way of overriding these and it breaks GCC 4.2.x. So I used a 'fake' gcc that strips off the offending flags and then calls the 'real' compiler:
I used MacPorts to do all this. But here is a way that might work with a bash shell -- I'm just writing this down as an example, I haven't tested it, but this is sort of what I have in mind:
### ;;;;;;;;;;;;;;;;;;;;;;;;;;; cut here mkdir mpl-devel cd mpl-devel cat > gccflt-4.2 <<EOF #!/usr/bin/env python # test with this at the command line # ./gccflt-4.2 -v -x c -E -mtune=native /dev/null -o /dev/null 2>&1 import sys import os realprog = "/usr/bin/gcc-4.2" options_to_remove = set(['-no-cpp-precomp', '-Wno-long-double', '-mno-fused-madd', '-faltivec', ]) args = [a for a in sys.argv[1:] if a not in options_to_remove] args.insert(0, '-fno-strict-aliasing') print args os.execvp(realprog, [realprog] + args) EOF sed -e 's,gcc-4.2,g++-4.2' < gccflt > g++flt chmod +x gccflt chmod +x g++fltsvn co http://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/matplotlib -r '{2007-10-25}'
; export CPPFLAGS=$(/usr/X11R6/bin/freetype-config --cflags) export LDFLAGS=$(/usr/X11R6/bin/freetype-config --libs ) export ARCHFLAGS='-arch i386' cd matplotlib patch -p0 < ~/Desktop/patch-setupext.py patch -p0 < ~/Desktop/patch-stdc++ python setup.py build python setup.pu install #;;;;;;;;;;;;;;;;;;; #================================= end shell scriptOne of my targets is to make a "developer" build available - which means that my boss will be gently reminding me to provide this.
I was granted commit permissions on MacPorts, but have so far failed to commit my things back upstream to them; before Leopard I had really torn up their Python modules so that everything is deployed in a single /opt/local... tree. (I didn't put things in /Library).
With Leopard, if you want to use the system (Apple) Python, then I put things in /Library/Python/2.5/site-packages. I'm not sure that's the best thing to do. Initially it seems like no problem but we *always* run into conflicts, or want to have multiple versions available simultaneously...
Portfile
Description: Binary data
--- setupext.py.orig 2006-10-26 07:26:40.000000000 -0600 +++ setupext.py 2007-02-28 17:04:56.000000000 -0700 @@ -48,7 +48,7 @@ 'linux2' : ['/usr/local', '/usr',], 'linux' : ['/usr/local', '/usr',], 'cygwin' : ['/usr/local', '/usr',], - 'darwin' : ['/sw/lib/freetype2', '/sw/lib/freetype219', '/usr/local', + 'darwin' : ['@@DPORTS_PREFIX@@', '/usr/X11R6/lib', '/sw/lib/freetype219', '/usr/local', '/usr', '/sw'], 'freebsd4' : ['/usr/local', '/usr'], 'freebsd5' : ['/usr/local', '/usr'], @@ -132,6 +132,7 @@ [os.path.join(p, 'lib64') for p in basedir[sys.platform] ] ) module.include_dirs.extend(incdirs) + module.include_dirs.extend(['/usr/X11R6/include', '/usr/X11R6/include/freetype2', '/usr/X11R6/include/libpng']) module.include_dirs.append('.') module.library_dirs.extend(libdirs) @@ -458,7 +459,7 @@ # complicated search, this is a hard-coded path. It could bail out # if X11 libs are not found... # tk_include_dirs.append('/usr/X11R6/include') - frameworks = ['-framework', 'Tcl', '-framework', 'Tk'] + frameworks = ['-framework', 'Tcl', '-framework', 'Tk', '-framework', 'Carbon', '-framework', 'Python'] module.include_dirs.extend(tk_include_dirs) module.extra_link_args.extend(frameworks) module.extra_compile_args.extend(frameworks)
patch-stdc++
Description: Binary data
Hope this helps!Oh, shoot... I didn't tell you how to build IPython with readline support... this email is too long already, but search the IPython dev list or I can send along a patch.
- boyd Boyd Waters http://www.aoc.nrao.edu/~bwaters
------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel