Issue #1584: Provide options to override default search paths for Tcl and Tk
when building _tkinter. configure has two new options; if used, both must be specified: ./configure \ --with-tcltk-includes="-I/opt/local/include" \ --with-tcltk-libs="-L/opt/local/lib -ltcl8.5 -ltk8.5" In addition, the options can be overridden with make: make \ TCLTK_INCLUDES="-I/opt/local/include" \ TCLTK_LIBS="-L/opt/local/lib -ltcl8.6 -ltk8.6"
This commit is contained in:
parent
d80f7be580
commit
d819b931f3
|
@ -207,6 +207,10 @@ _PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@
|
||||||
BUILD_GNU_TYPE= @build@
|
BUILD_GNU_TYPE= @build@
|
||||||
HOST_GNU_TYPE= @host@
|
HOST_GNU_TYPE= @host@
|
||||||
|
|
||||||
|
# Tcl and Tk config info from --with-tcltk-includes and -libs options
|
||||||
|
TCLTK_INCLUDES= @TCLTK_INCLUDES@
|
||||||
|
TCLTK_LIBS= @TCLTK_LIBS@
|
||||||
|
|
||||||
# The task to run while instrument when building the profile-opt target
|
# The task to run while instrument when building the profile-opt target
|
||||||
PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
|
PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
|
||||||
#PROFILE_TASK= $(srcdir)/Lib/test/regrtest.py
|
#PROFILE_TASK= $(srcdir)/Lib/test/regrtest.py
|
||||||
|
@ -535,6 +539,7 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt
|
||||||
*) quiet="";; \
|
*) quiet="";; \
|
||||||
esac; \
|
esac; \
|
||||||
$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
|
$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
|
||||||
|
_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
|
||||||
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
|
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
|
||||||
|
|
||||||
# Build static library
|
# Build static library
|
||||||
|
|
|
@ -219,6 +219,12 @@ Documentation
|
||||||
- Issue #18783: Removed existing mentions of Python long type in docstrings,
|
- Issue #18783: Removed existing mentions of Python long type in docstrings,
|
||||||
error messages and comments.
|
error messages and comments.
|
||||||
|
|
||||||
|
Build
|
||||||
|
-----
|
||||||
|
|
||||||
|
- Issue #1584: Provide configure options to override default search paths for
|
||||||
|
Tcl and Tk when building _tkinter.
|
||||||
|
|
||||||
Tools/Demos
|
Tools/Demos
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
|
|
|
@ -646,6 +646,8 @@ LDLAST
|
||||||
USE_THREAD_MODULE
|
USE_THREAD_MODULE
|
||||||
SIGNAL_OBJS
|
SIGNAL_OBJS
|
||||||
USE_SIGNAL_MODULE
|
USE_SIGNAL_MODULE
|
||||||
|
TCLTK_LIBS
|
||||||
|
TCLTK_INCLUDES
|
||||||
LIBFFI_INCLUDEDIR
|
LIBFFI_INCLUDEDIR
|
||||||
PKG_CONFIG
|
PKG_CONFIG
|
||||||
SHLIBS
|
SHLIBS
|
||||||
|
@ -795,6 +797,8 @@ with_system_expat
|
||||||
with_system_ffi
|
with_system_ffi
|
||||||
with_system_libmpdec
|
with_system_libmpdec
|
||||||
enable_loadable_sqlite_extensions
|
enable_loadable_sqlite_extensions
|
||||||
|
with_tcltk_includes
|
||||||
|
with_tcltk_libs
|
||||||
with_dbmliborder
|
with_dbmliborder
|
||||||
with_signal_module
|
with_signal_module
|
||||||
with_threads
|
with_threads
|
||||||
|
@ -1467,6 +1471,10 @@ Optional Packages:
|
||||||
--with-system-ffi build _ctypes module using an installed ffi library
|
--with-system-ffi build _ctypes module using an installed ffi library
|
||||||
--with-system-libmpdec build _decimal module using an installed libmpdec
|
--with-system-libmpdec build _decimal module using an installed libmpdec
|
||||||
library
|
library
|
||||||
|
--with-tcltk-includes='-I...'
|
||||||
|
override search for Tcl and Tk include files
|
||||||
|
--with-tcltk-libs='-L...'
|
||||||
|
override search for Tcl and Tk libs
|
||||||
--with-dbmliborder=db1:db2:...
|
--with-dbmliborder=db1:db2:...
|
||||||
order to check db backends for dbm. Valid value is a
|
order to check db backends for dbm. Valid value is a
|
||||||
colon separated string with the backend names
|
colon separated string with the backend names
|
||||||
|
@ -9237,6 +9245,46 @@ fi
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_loadable_sqlite_extensions" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_loadable_sqlite_extensions" >&5
|
||||||
$as_echo "$enable_loadable_sqlite_extensions" >&6; }
|
$as_echo "$enable_loadable_sqlite_extensions" >&6; }
|
||||||
|
|
||||||
|
# Check for --with-tcltk-includes=path and --with-tcltk-libs=path
|
||||||
|
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-tcltk-includes" >&5
|
||||||
|
$as_echo_n "checking for --with-tcltk-includes... " >&6; }
|
||||||
|
|
||||||
|
# Check whether --with-tcltk-includes was given.
|
||||||
|
if test "${with_tcltk_includes+set}" = set; then :
|
||||||
|
withval=$with_tcltk_includes;
|
||||||
|
else
|
||||||
|
with_tcltk_includes="default"
|
||||||
|
fi
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_tcltk_includes" >&5
|
||||||
|
$as_echo "$with_tcltk_includes" >&6; }
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-tcltk-libs" >&5
|
||||||
|
$as_echo_n "checking for --with-tcltk-libs... " >&6; }
|
||||||
|
|
||||||
|
# Check whether --with-tcltk-libs was given.
|
||||||
|
if test "${with_tcltk_libs+set}" = set; then :
|
||||||
|
withval=$with_tcltk_libs;
|
||||||
|
else
|
||||||
|
with_tcltk_libs="default"
|
||||||
|
fi
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_tcltk_libs" >&5
|
||||||
|
$as_echo "$with_tcltk_libs" >&6; }
|
||||||
|
if test "x$with_tcltk_includes" = xdefault || test "x$with_tcltk_libs" = xdefault
|
||||||
|
then
|
||||||
|
if test "x$with_tcltk_includes" != "x$with_tcltk_libs"
|
||||||
|
then
|
||||||
|
as_fn_error $? "use both --with-tcltk-includes='...' and --with-tcltk-libs='...' or neither" "$LINENO" 5
|
||||||
|
fi
|
||||||
|
TCLTK_INCLUDES=""
|
||||||
|
TCLTK_LIBS=""
|
||||||
|
else
|
||||||
|
TCLTK_INCLUDES="$with_tcltk_includes"
|
||||||
|
TCLTK_LIBS="$with_tcltk_libs"
|
||||||
|
fi
|
||||||
|
|
||||||
# Check for --with-dbmliborder
|
# Check for --with-dbmliborder
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-dbmliborder" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-dbmliborder" >&5
|
||||||
$as_echo_n "checking for --with-dbmliborder... " >&6; }
|
$as_echo_n "checking for --with-dbmliborder... " >&6; }
|
||||||
|
|
28
configure.ac
28
configure.ac
|
@ -2282,6 +2282,34 @@ AC_ARG_ENABLE(loadable-sqlite-extensions,
|
||||||
|
|
||||||
AC_MSG_RESULT($enable_loadable_sqlite_extensions)
|
AC_MSG_RESULT($enable_loadable_sqlite_extensions)
|
||||||
|
|
||||||
|
# Check for --with-tcltk-includes=path and --with-tcltk-libs=path
|
||||||
|
AC_SUBST(TCLTK_INCLUDES)
|
||||||
|
AC_SUBST(TCLTK_LIBS)
|
||||||
|
AC_MSG_CHECKING(for --with-tcltk-includes)
|
||||||
|
AC_ARG_WITH(tcltk-includes,
|
||||||
|
AS_HELP_STRING([--with-tcltk-includes='-I...'], [override search for Tcl and Tk include files]),
|
||||||
|
[],
|
||||||
|
[with_tcltk_includes="default"])
|
||||||
|
AC_MSG_RESULT($with_tcltk_includes)
|
||||||
|
AC_MSG_CHECKING(for --with-tcltk-libs)
|
||||||
|
AC_ARG_WITH(tcltk-libs,
|
||||||
|
AS_HELP_STRING([--with-tcltk-libs='-L...'], [override search for Tcl and Tk libs]),
|
||||||
|
[],
|
||||||
|
[with_tcltk_libs="default"])
|
||||||
|
AC_MSG_RESULT($with_tcltk_libs)
|
||||||
|
if test "x$with_tcltk_includes" = xdefault || test "x$with_tcltk_libs" = xdefault
|
||||||
|
then
|
||||||
|
if test "x$with_tcltk_includes" != "x$with_tcltk_libs"
|
||||||
|
then
|
||||||
|
AC_MSG_ERROR([use both --with-tcltk-includes='...' and --with-tcltk-libs='...' or neither])
|
||||||
|
fi
|
||||||
|
TCLTK_INCLUDES=""
|
||||||
|
TCLTK_LIBS=""
|
||||||
|
else
|
||||||
|
TCLTK_INCLUDES="$with_tcltk_includes"
|
||||||
|
TCLTK_LIBS="$with_tcltk_libs"
|
||||||
|
fi
|
||||||
|
|
||||||
# Check for --with-dbmliborder
|
# Check for --with-dbmliborder
|
||||||
AC_MSG_CHECKING(for --with-dbmliborder)
|
AC_MSG_CHECKING(for --with-dbmliborder)
|
||||||
AC_ARG_WITH(dbmliborder,
|
AC_ARG_WITH(dbmliborder,
|
||||||
|
|
43
setup.py
43
setup.py
|
@ -1545,6 +1545,41 @@ class PyBuildExt(build_ext):
|
||||||
|
|
||||||
return missing
|
return missing
|
||||||
|
|
||||||
|
def detect_tkinter_explicitly(self):
|
||||||
|
# Build _tkinter using explicit locations for Tcl/Tk.
|
||||||
|
#
|
||||||
|
# This is enabled when both arguments are given to ./configure:
|
||||||
|
#
|
||||||
|
# --with-tcltk-includes="-I/path/to/tclincludes \
|
||||||
|
# -I/path/to/tkincludes"
|
||||||
|
# --with-tcltk-libs="-L/path/to/tcllibs -ltclm.n \
|
||||||
|
# -L/path/to/tklibs -ltkm.n"
|
||||||
|
#
|
||||||
|
# These values can also be specified or overriden via make:
|
||||||
|
# make TCLTK_INCLUDES="..." TCLTK_LIBS="..."
|
||||||
|
#
|
||||||
|
# This can be useful for building and testing tkinter with multiple
|
||||||
|
# versions of Tcl/Tk. Note that a build of Tk depends on a particular
|
||||||
|
# build of Tcl so you need to specify both arguments and use care when
|
||||||
|
# overriding.
|
||||||
|
|
||||||
|
# The _TCLTK variables are created in the Makefile sharedmods target.
|
||||||
|
tcltk_includes = os.environ.get('_TCLTK_INCLUDES')
|
||||||
|
tcltk_libs = os.environ.get('_TCLTK_LIBS')
|
||||||
|
if not (tcltk_includes and tcltk_libs):
|
||||||
|
# Resume default configuration search.
|
||||||
|
return 0
|
||||||
|
|
||||||
|
extra_compile_args = tcltk_includes.split()
|
||||||
|
extra_link_args = tcltk_libs.split()
|
||||||
|
ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
|
||||||
|
define_macros=[('WITH_APPINIT', 1)],
|
||||||
|
extra_compile_args = extra_compile_args,
|
||||||
|
extra_link_args = extra_link_args,
|
||||||
|
)
|
||||||
|
self.extensions.append(ext)
|
||||||
|
return 1
|
||||||
|
|
||||||
def detect_tkinter_darwin(self, inc_dirs, lib_dirs):
|
def detect_tkinter_darwin(self, inc_dirs, lib_dirs):
|
||||||
# The _tkinter module, using frameworks. Since frameworks are quite
|
# The _tkinter module, using frameworks. Since frameworks are quite
|
||||||
# different the UNIX search logic is not sharable.
|
# different the UNIX search logic is not sharable.
|
||||||
|
@ -1634,10 +1669,16 @@ class PyBuildExt(build_ext):
|
||||||
self.extensions.append(ext)
|
self.extensions.append(ext)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
||||||
def detect_tkinter(self, inc_dirs, lib_dirs):
|
def detect_tkinter(self, inc_dirs, lib_dirs):
|
||||||
# The _tkinter module.
|
# The _tkinter module.
|
||||||
|
|
||||||
|
# Check whether --with-tcltk-includes and --with-tcltk-libs were
|
||||||
|
# configured or passed into the make target. If so, use these values
|
||||||
|
# to build tkinter and bypass the searches for Tcl and TK in standard
|
||||||
|
# locations.
|
||||||
|
if self.detect_tkinter_explicitly():
|
||||||
|
return
|
||||||
|
|
||||||
# Rather than complicate the code below, detecting and building
|
# Rather than complicate the code below, detecting and building
|
||||||
# AquaTk is a separate method. Only one Tkinter will be built on
|
# AquaTk is a separate method. Only one Tkinter will be built on
|
||||||
# Darwin - either AquaTk, if it is found, or X11 based Tk.
|
# Darwin - either AquaTk, if it is found, or X11 based Tk.
|
||||||
|
|
Loading…
Reference in New Issue