Skip to content

Commit b8e150f

Browse files
author
Tyler Sy
committed
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.
1 parent 36378ef commit b8e150f

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

src/ui-macos/bits/runpython.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* NSApplicationMain() looks for Info.plist using the path in argv[0], which
77
* goes wrong if your interpreter is /usr/bin/python.
88
*/
9-
#include <Python.h>
9+
#include <Python/Python.h>
1010
#include <string.h>
1111
#include <unistd.h>
1212

src/ui-macos/bits/runpython.do

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@ exec >&2
22
redo-ifchange runpython.c
33
ARCHES=""
44
printf "Platforms: "
5-
for d in /usr/libexec/gcc/darwin/*; do
6-
PLAT=$(basename "$d")
7-
[ "$PLAT" != "ppc64" ] || continue # fails for some reason on my Mac
8-
ARCHES="$ARCHES -arch $PLAT"
9-
printf "$PLAT "
10-
done
5+
if [ -d /usr/libexec/gcc/darwin ]; then
6+
for d in /usr/libexec/gcc/darwin/*; do
7+
PLAT=$(basename "$d")
8+
[ "$PLAT" != "ppc64" ] || continue # fails for some reason on my Mac
9+
ARCHES="$ARCHES -arch $PLAT"
10+
printf "$PLAT "
11+
done
12+
fi
1113
printf "\n"
14+
PYTHON_LDFLAGS=$(python-config --ldflags)
15+
PYTHON_INCLUDES=$(python-config --includes)
1216
gcc $ARCHES \
13-
-Wall -o $3 runpython.c \
14-
-I/usr/include/python2.5 \
15-
-lpython2.5
17+
-Wall -o $3 runpython.c \
18+
$PYTHON_INCLUDES \
19+
$PYTHON_LDFLAGS \
20+
-framework Python

0 commit comments

Comments
 (0)