Skip to content

Instantly share code, notes, and snippets.

@piti118
Created September 27, 2011 06:42
Show Gist options
  • Save piti118/1244479 to your computer and use it in GitHub Desktop.
Save piti118/1244479 to your computer and use it in GitHub Desktop.
Hacked Makefile to compile py2cairo on osx 10.6 with libcairo from brew and python2.7
#py2cairo is notoriously broken under osx due to
#1) osx cairo version is too old
#2) waf is trying so hard to build a universal binary i386 and x86_64 and I found no way to override this
#replace Makefile in src/ with this one
#this will create _cairo.so
src = $(wildcard *.c)
#$(warning $(src))
obj = $(patsubst %.c,%.o,${src})
#$(warning $(obj))
lib: ${obj}
gcc -L/usr/local/Cellar/cairo/1.10.2/lib -lcairo -dynamiclib -undefined suppress -flat_namespace -o _cairo.so $^
${obj}: %.o : %.c
gcc -O2 -fPIC -I/usr/local/Cellar/cairo/1.10.2/include/cairo -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -fno-strict-aliasing -fno-common -arch x86_64 -g -O2 -c -o $@ $<
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment