From charlesreid1

(Created page with "To install PyCairo on Mac OS X Lion: 1. download/unpack py2cairo 2. edit file <code>build_directory/c4che/_cache.py</code> to remove non-64 bit architectures (since these scre...")
 
No edit summary
Line 1: Line 1:
To install PyCairo on Mac OS X Lion:
# How To Install This Stupid Crap
 
To install PyCairo on Mac OS X Lion, you have to deal with yet another non-standard, pain-in-the-ass build tool. This one is called WAF.


1. download/unpack py2cairo  
1. download/unpack py2cairo  
Line 11: Line 13:
</pre>
</pre>


4. <code>cd /temp/py2cairo && ./waf configure </code>
4. <code>cd /temp/py2cairo && python waf configure </code>
 
5. <code>python waf build</code>
 
6. <code>python waf install</code>
 
7. Because WAF is too stupid and inflexible to enable you to specify basically any information without hacking everything horribly to death, and because WAF idiotically picks up conflicting information about which Python version to use and where to put libraries for that Python version, you have to hard code links from the Homebrew Python site-packages folder (which is where WAF installs everything) to the site-packages for your own Python (wherever that happens to be. Since I'm using my system Python, its in <code>/Library/Python/2.7/site-packages</code>.
 
The command I used was:
 
<pre>ln -fs /usr/local/lib/python2.7/site-packages/cairo/ /Library/Python/2.7/site-packages/cairo</pre>
 
# What Final Successful Output Looks Like


5. <code>./waf build</code>


6. <code>./waf install</code>


<pre>
<pre>

Revision as of 21:50, 23 June 2014

  1. How To Install This Stupid Crap

To install PyCairo on Mac OS X Lion, you have to deal with yet another non-standard, pain-in-the-ass build tool. This one is called WAF.

1. download/unpack py2cairo

2. edit file build_directory/c4che/_cache.py to remove non-64 bit architectures (since these screw up the build process)

3. modify the PKG_CONFIG_PATH environmental variable to include the path to your X11 pkg-config, not just the default pkg-config, using this command:

export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig:/opt/X11/libpkgconfig:/usr/X11/lib/pkgconfig:$PKG_CONFIG_PATH

4. cd /temp/py2cairo && python waf configure

5. python waf build

6. python waf install

7. Because WAF is too stupid and inflexible to enable you to specify basically any information without hacking everything horribly to death, and because WAF idiotically picks up conflicting information about which Python version to use and where to put libraries for that Python version, you have to hard code links from the Homebrew Python site-packages folder (which is where WAF installs everything) to the site-packages for your own Python (wherever that happens to be. Since I'm using my system Python, its in /Library/Python/2.7/site-packages.

The command I used was:

ln -fs /usr/local/lib/python2.7/site-packages/cairo/ /Library/Python/2.7/site-packages/cairo
  1. What Final Successful Output Looks Like


charlesreid @ mach - 28
(Mon Jun 23 14:31:06) /temp/py2cairo $ ./waf configure
  ./options()
Setting top to                           : /temp/py2cairo
Setting out to                           : /temp/py2cairo/build_directory
  ./configure()
Checking for 'gcc' (c compiler)          : ok
Checking for program python              : /usr/bin/python
Checking for python version              : (2, 7, 5, 'final', 0)
Checking for library python2.7           : yes
Checking for program python2.7-config    : /usr/bin/python2.7-config
Checking for header Python.h             : yes
Checking for program pkg-config          : /usr/local/bin/pkg-config
Checking for 'cairo' >= 1.10.2           : yes
Checking for 'xpyb' >= 1.3               : yes
Configuration:
PREFIX                                   : /usr/local
LIBDIR                                   : /usr/local/lib
'configure' finished successfully (0.847s)

charlesreid @ mach - 29
(Mon Jun 23 14:31:09) /temp/py2cairo $ ./waf build
  ./options()
Waf: Entering directory `/temp/py2cairo/build_directory'
  ./build()
  src/build()
[1/9] c: src/cairomodule.c -> build_directory/src/cairomodule.c.1.o
[2/9] c: src/context.c -> build_directory/src/context.c.1.o
[3/9] c: src/font.c -> build_directory/src/font.c.1.o
[4/9] c: src/path.c -> build_directory/src/path.c.1.o
clang: warning: argument unused during compilation: '-compatibility_version 1'
clang: warning: argument unused during compilation: '-current_version 1'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-compatibility_version 1'
clang: warning: argument unused during compilation: '-current_version 1'
clang: warning: argument unused during compilation: '-mno-fused-madd'
[5/9] c: src/pattern.c -> build_directory/src/pattern.c.1.o
[6/9] c: src/matrix.c -> build_directory/src/matrix.c.1.o
[7/9] c: src/surface.c -> build_directory/src/surface.c.1.o
clang: warning: argument unused during compilation: '-compatibility_version 1'
clang: warning: argument unused during compilation: '-current_version 1'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-compatibility_version 1'
clang: warning: argument unused during compilation: '-current_version 1'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-compatibility_version 1'
clang: warning: argument unused during compilation: '-current_version 1'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-compatibility_version 1'
clang: warning: argument unused during compilation: '-current_version 1'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-compatibility_version 1'
clang: warning: argument unused during compilation: '-current_version 1'
clang: warning: argument unused during compilation: '-mno-fused-madd'
[8/9] cshlib: build_directory/src/cairomodule.c.1.o build_directory/src/context.c.1.o build_directory/src/font.c.1.o build_directory/src/path.c.1.o build_directory/src/pattern.c.1.o build_directory/src/matrix.c.1.o build_directory/src/surface.c.1.o -> build_directory/src/_cairo.so
Waf: Leaving directory `/temp/py2cairo/build_directory'
'build' finished successfully (0.462s)

charlesreid @ mach - 30
(Mon Jun 23 14:31:13) /temp/py2cairo $ ./waf install
  ./options()
Waf: Entering directory `/temp/py2cairo/build_directory'
  ./build()
  src/build()
+ install /usr/local/lib/pkgconfig/pycairo.pc (from build_directory/pycairo.pc)
+ install /usr/local/include/pycairo/pycairo.h (from src/pycairo.h)
+ install /usr/local/lib/python2.7/site-packages/cairo/_cairo.so (from build_directory/src/_cairo.so)
Waf: Leaving directory `/temp/py2cairo/build_directory'
+ install /usr/local/lib/python2.7/site-packages/cairo/__init__.py (from src/__init__.py)
+ byte compiling '/usr/local/lib/python2.7/site-packages/cairo/__init__.py'
'install' finished successfully (0.445s)