Skip to content

Instantly share code, notes, and snippets.

@rfc1459
Forked from ento/buildlibxml.diff
Created June 29, 2011 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rfc1459/1053805 to your computer and use it in GitHub Desktop.
Save rfc1459/1053805 to your computer and use it in GitHub Desktop.
Installing lxml on a Mac OS X 10.6 that has no PPC support (read: Xcode 4)
/lxml-*/
lxml-*.tar.gz
diff --git a/buildlibxml.py b/buildlibxml.py
index bfcf3e4..7bf36e5 100644
--- a/buildlibxml.py
+++ b/buildlibxml.py
@@ -188,8 +188,11 @@ def build_libxml2xslt(download_dir, build_dir,
})
else:
env.update({
- 'CFLAGS' : "-arch ppc -arch i386 -arch x86_64 -O2",
- 'LDFLAGS' : "-arch ppc -arch i386 -arch x86_64",
+ #'CFLAGS' : "-arch ppc -arch i386 -arch x86_64 -O2",
+ #'LDFLAGS' : "-arch ppc -arch i386 -arch x86_64",
+ # For Xcode 4.0
+ 'CFLAGS' : "-arch i386 -arch x86_64 -O2",
+ 'LDFLAGS' : "-arch i386 -arch x86_64",
'MACOSX_DEPLOYMENT_TARGET' : "10.6"
})
call_setup['env'] = env
#!/bin/bash
SRCFILE=lxml-2.2.8.tar.gz
if [ ! -f $SRCFILE ]; then
curl -O http://pypi.python.org/packages/source/l/lxml/${SRCFILE}
if [ $? -ne 0 ]; then
echo "Error while downloading ${SRCFILE}, aborting"
exit 128
fi
fi
# Verify integrity of downloaded file
shasum --check SHA-1
if [ $? -ne 0 ]; then
echo "File is corrupted, aborting"
exit 128
fi
# From now on, crap on each error
set -e
[ -d lxml-2.2.8 ] && rm -rf lxml-2.2.8
tar xfz ${SRCFILE}
cd lxml-2.2.8
# Xcode 4.0 doesn't support PPC so we need to exclude ppc from -arch
patch -p1 < ../buildlibxml.diff # apply the patch above to fix libxml2/libxslt build
# The following lines are needed to exclude ppc from lxml itself.
export CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64"
export CFLAGS="-isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64"
python setup.py build --static-deps --libxml2-version=2.7.8 --libxslt-version=1.1.26
# Install lxml system-wide
sudo python setup.py install
# Note: alternative is to install Xcode 3.2.6 along side Xcode 4
# http://www.cocoabuilder.com/archive/xcode/299924-no-ppc-from-xcode-4.html
9012ae676160d0d2fff980b07607084e26d53da7 lxml-2.2.8.tar.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment