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.
This commit is contained in:
Tyler Sy 2014-10-03 14:58:26 -07:00
parent 36378efe5e
commit b8e150fc4d
2 changed files with 15 additions and 10 deletions

View File

@ -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 <Python.h>
#include <Python/Python.h>
#include <string.h>
#include <unistd.h>

View File

@ -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