diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index 3c1e6ea4..a1fecf2b 100755 --- a/plugins/python-build/bin/python-build +++ b/plugins/python-build/bin/python-build @@ -1887,19 +1887,12 @@ use_homebrew_tcltk() { for tcltk in ${PYTHON_BUILD_TCLTK_FORMULA:-tcl-tk@8 tcl-tk}; do local tcltk_libdir="$(brew --prefix "${tcltk}" 2>/dev/null || true)" if [ -d "$tcltk_libdir" ]; then - echo "python-build: use tcl-tk from homebrew" - local tcltk_version="$(sh -c '. '"$tcltk_libdir"'/lib/tclConfig.sh; echo $TCL_VERSION')" - local tcltk_includes tcltk_libs + echo "python-build: use ${PYTHON_BUILD_TCLTK_FORMULA} from homebrew" # In Homebrew Tcl/Tk 8.6.13, headers have been moved to the 'tcl-tk' subdir. - # We're not using tclConfig.sh here 'cuz it produces the version-specific path to /Cellar - # and we'd rather have rpath set to /opt/<...> to allow micro release upgrades without rebuilding - # XXX: do use tclConfig.sh and translate the paths if more shenanigans appear in later releases - if [ -d "$tcltk_libdir/include/tcl-tk" ]; then - tcltk_includes="-I$tcltk_libdir/include/tcl-tk" - else - tcltk_includes="-I$tcltk_libdir/include" - fi - tcltk_libs="-L$tcltk_libdir/lib -ltcl$tcltk_version -ltk$tcltk_version" + local tcltk_includes="$(sh -c '. '"$tcltk_libdir"'/lib/tkConfig.sh; echo "$TCL_INCLUDE_SPEC $TK_INCLUDE_SPEC"')" + # Tcl/Tk is not keg-only so it's safe to use -L with Cellar path; rpath would be of Homebrew + # and would not break with version upgrades + local tcltk_libs="$(sh -c '. '"$tcltk_libdir"'/lib/tkConfig.sh; echo "$TCL_LIB_SPEC $TK_LIB_SPEC"')" # Since 2.7.6, 3.3.3, 3.4.0 (Issue #1584): --with-tcltk-includes + --with-tcltk-libs Configure options # Since 3.11.0 (bpo-45847): `pkg-config` call, TCLTK_CFLAGS + TCLTK_LIBS override if [[ -n "$PYTHON_BUILD_TCLTK_USE_PKGCONFIG" ]]; then