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 * NSApplicationMain() looks for Info.plist using the path in argv[0], which
* goes wrong if your interpreter is /usr/bin/python. * goes wrong if your interpreter is /usr/bin/python.
*/ */
#include <Python.h> #include <Python/Python.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>

View File

@ -2,14 +2,19 @@ exec >&2
redo-ifchange runpython.c redo-ifchange runpython.c
ARCHES="" ARCHES=""
printf "Platforms: " printf "Platforms: "
for d in /usr/libexec/gcc/darwin/*; do if [ -d /usr/libexec/gcc/darwin ]; then
PLAT=$(basename "$d") for d in /usr/libexec/gcc/darwin/*; do
[ "$PLAT" != "ppc64" ] || continue # fails for some reason on my Mac PLAT=$(basename "$d")
ARCHES="$ARCHES -arch $PLAT" [ "$PLAT" != "ppc64" ] || continue # fails for some reason on my Mac
printf "$PLAT " ARCHES="$ARCHES -arch $PLAT"
done printf "$PLAT "
done
fi
printf "\n" printf "\n"
PYTHON_LDFLAGS=$(python-config --ldflags)
PYTHON_INCLUDES=$(python-config --includes)
gcc $ARCHES \ gcc $ARCHES \
-Wall -o $3 runpython.c \ -Wall -o $3 runpython.c \
-I/usr/include/python2.5 \ $PYTHON_INCLUDES \
-lpython2.5 $PYTHON_LDFLAGS \
-framework Python