diff options
Diffstat (limited to '0048-allow-static-tcltk.patch')
-rw-r--r-- | 0048-allow-static-tcltk.patch | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/0048-allow-static-tcltk.patch b/0048-allow-static-tcltk.patch new file mode 100644 index 000000000000..328021e72e4b --- /dev/null +++ b/0048-allow-static-tcltk.patch @@ -0,0 +1,87 @@ +From 6777f17ccae090e6687d6317b4dafcb0c8899f8f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9?= + <alexey.pawlow@gmail.com> +Date: Thu, 17 Jun 2021 18:51:54 +0530 +Subject: [PATCH 048/N] allow static tcltk +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Co-authored-by: Алексей <alexey.pawlow@gmail.com> +--- + setup.py | 35 +++++++++++++++++++++++++---------- + 1 file changed, 25 insertions(+), 10 deletions(-) + +diff --git a/setup.py b/setup.py +index 55c7382..d8fc413 100644 +--- a/setup.py ++++ b/setup.py +@@ -783,7 +783,7 @@ class PyBuildExt(build_ext): + if HOST_PLATFORM == 'hp-ux11': + self.lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32'] + +- if MACOS: ++ if MACOS or MS_WINDOWS: + # This should work on any unixy platform ;-) + # If the user has bothered specifying additional -I and -L flags + # in OPT and LDFLAGS we might as well use them here. +@@ -793,6 +793,8 @@ class PyBuildExt(build_ext): + # directories with whitespace in the name to store libraries. + cflags, ldflags = sysconfig.get_config_vars( + 'CFLAGS', 'LDFLAGS') ++ cflags = cflags + ' ' + ('',os.environ.get('CC'))[os.environ.get('CC') != None] ++ ldflags = ldflags + ' ' + ('',os.environ.get('LDSHARED'))[os.environ.get('LDSHARED') != None] + for item in cflags.split(): + if item.startswith('-I'): + self.inc_dirs.append(item[2:]) +@@ -2042,14 +2044,19 @@ class PyBuildExt(build_ext): + # The versions with dots are used on Unix, and the versions without + # dots on Windows, for detection by cygwin. + tcllib = tklib = tcl_includes = tk_includes = None +- for version in ['8.6', '86', '8.5', '85', '8.4', '84', '8.3', '83', +- '8.2', '82', '8.1', '81', '8.0', '80']: +- tklib = self.compiler.find_library_file(self.lib_dirs, +- 'tk' + version) +- tcllib = self.compiler.find_library_file(self.lib_dirs, +- 'tcl' + version) +- if tklib and tcllib: +- # Exit the loop when we've found the Tcl/Tk libraries ++ tcltk_suffix = None ++ for suffix in ['', 's']: ++ for version in ['8.6', '86', '8.5', '85', '8.4', '84', '8.3', '83', ++ '8.2', '82', '8.1', '81', '8.0', '80', '']: ++ tklib = self.compiler.find_library_file(self.lib_dirs, ++ 'tk' + version + suffix) ++ tcllib = self.compiler.find_library_file(self.lib_dirs, ++ 'tcl' + version + suffix) ++ if tklib and tcllib: ++ # Exit the loop when we've found the Tcl/Tk libraries ++ tcltk_suffix = suffix ++ break ++ if tcltk_suffix != None: + break + + # Now check for the header files +@@ -2120,10 +2127,18 @@ class PyBuildExt(build_ext): + # Add the Tcl/Tk libraries + libs.append('tk'+ version) + libs.append('tcl'+ version) ++ libs.append('tk'+ version + tcltk_suffix) ++ libs.append('tcl'+ version + tcltk_suffix) ++ if MS_WINDOWS: ++ for winlib in ['ws2_32','gdi32','comctl32','comdlg32','imm32','uuid','oleaut32','ole32']: ++ libs.append( winlib ) + + # Finally, link with the X11 libraries (not appropriate on cygwin) +- if not CYGWIN: ++ # ...on those platforms, define STATIC_BUILD if linking to static tcl/tk. ++ if not CYGWIN and not MS_WINDOWS: + libs.append('X11') ++ elif tcllib.endswith('s.a'): ++ defs.append( ('STATIC_BUILD',1) ) + + # XXX handle these, but how to detect? + # *** Uncomment and edit for PIL (TkImaging) extension only: +-- +2.32.0 + |