Skip to content

Commit e68884b

Browse files
committed
unix: support building tk on macOS
pkg-config isn't available. So we have to tweak CFLAGS and LDFLAGS manually. Also, we need to disable X11 and use aqua.
1 parent d019e67 commit e68884b

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

cpython-unix/build-tk.sh

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,22 @@ export PKG_CONFIG_PATH=${TOOLS_PATH}/deps/share/pkgconfig:${TOOLS_PATH}/deps/lib
1313
tar -xf tk${TK_VERSION}-src.tar.gz
1414
pushd tk8.6.9/unix
1515

16-
CFLAGS="-fPIC" ./configure \
16+
CFLAGS="-fPIC"
17+
LDFLAGS=""
18+
19+
if [ "${PYBUILD_PLATFORM}" = "macos" ]; then
20+
CFLAGS="${CFLAGS} -I${TOOLS_PATH}/deps/include"
21+
LDFLAGS="-L${TOOLS_PATH}/deps/lib"
22+
EXTRA_CONFIGURE_FLAGS="--enable-aqua=yes --without-x"
23+
else
24+
EXTRA_CONFIGURE_FLAGS="--x-includes=${TOOLS_PATH}/deps/include --x-libraries=${TOOLS_PATH}/deps/lib"
25+
fi
26+
27+
CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" ./configure \
1728
--prefix=/tools/deps \
18-
--x-includes=${TOOLS_PATH}/deps/include \
19-
--x-libraries=${TOOLS_PATH}/deps/lib \
2029
--with-tcl=${TOOLS_PATH}/deps/lib \
21-
--enable-shared=no
30+
--enable-shared=no \
31+
${EXTRA_CONFIGURE_FLAGS}
2232

2333
# For some reason musl isn't link libXau and libxcb. So we hack the Makefile
2434
# to do what we want.

0 commit comments

Comments
 (0)