From b8e150fc4d1ca976fa1873ea1b48308eeaaeed48 Mon Sep 17 00:00:00 2001 From: Tyler Sy Date: Fri, 3 Oct 2014 14:58:26 -0700 Subject: [PATCH] Use python-config to compile with latest Python version. For OS X systems without Python 2.5, runpython.c does not compile. Use python-config to get the paths for the latest version. --- src/ui-macos/bits/runpython.c | 2 +- src/ui-macos/bits/runpython.do | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/ui-macos/bits/runpython.c b/src/ui-macos/bits/runpython.c index 63de339..0795f5b 100644 --- a/src/ui-macos/bits/runpython.c +++ b/src/ui-macos/bits/runpython.c @@ -6,7 +6,7 @@ * NSApplicationMain() looks for Info.plist using the path in argv[0], which * goes wrong if your interpreter is /usr/bin/python. */ -#include +#include #include #include diff --git a/src/ui-macos/bits/runpython.do b/src/ui-macos/bits/runpython.do index a53247f..0fc1480 100644 --- a/src/ui-macos/bits/runpython.do +++ b/src/ui-macos/bits/runpython.do @@ -2,14 +2,19 @@ exec >&2 redo-ifchange runpython.c ARCHES="" printf "Platforms: " -for d in /usr/libexec/gcc/darwin/*; do - PLAT=$(basename "$d") - [ "$PLAT" != "ppc64" ] || continue # fails for some reason on my Mac - ARCHES="$ARCHES -arch $PLAT" - printf "$PLAT " -done +if [ -d /usr/libexec/gcc/darwin ]; then + for d in /usr/libexec/gcc/darwin/*; do + PLAT=$(basename "$d") + [ "$PLAT" != "ppc64" ] || continue # fails for some reason on my Mac + ARCHES="$ARCHES -arch $PLAT" + printf "$PLAT " + done +fi printf "\n" +PYTHON_LDFLAGS=$(python-config --ldflags) +PYTHON_INCLUDES=$(python-config --includes) gcc $ARCHES \ - -Wall -o $3 runpython.c \ - -I/usr/include/python2.5 \ - -lpython2.5 + -Wall -o $3 runpython.c \ + $PYTHON_INCLUDES \ + $PYTHON_LDFLAGS \ + -framework Python