Browse Source

Review our python patches, so we dont need pre-build hacks

Signed-off-by: falkTX <falktx@falktx.com>
tags/v1.1
falkTX 4 years ago
parent
commit
f66f4e3613
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
3 changed files with 69 additions and 17 deletions
  1. +13
    -5
      patches/Python/win32/0750-builddir-fixes.patch
  2. +12
    -3
      patches/Python/win32/1800-link-win-resource-files-and-build-pythonw.patch
  3. +44
    -9
      patches/Python/win32/9001-pawpaw-needed-changes.patch

+ 13
- 5
patches/Python/win32/0750-builddir-fixes.patch View File

@@ -1,7 +1,8 @@
diff -Naur Python-3.8.0-orig/Makefile.pre.in Python-3.8.0/Makefile.pre.in
--- Python-3.8.0-orig/Makefile.pre.in 2019-10-22 10:03:21.368190400 +0300
+++ Python-3.8.0/Makefile.pre.in 2019-10-22 10:03:31.336607900 +0300
@@ -710,20 +710,20 @@
diff --git a/Makefile.pre.in b/Makefile.pre.in
index e2143a2..4ee959f 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -730,26 +730,26 @@ Programs/_testembed: Programs/_testembed.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
Programs/_freeze_importlib.o: Programs/_freeze_importlib.c Makefile
@@ -26,7 +27,14 @@ diff -Naur Python-3.8.0-orig/Makefile.pre.in Python-3.8.0/Makefile.pre.in
$(srcdir)/Lib/importlib/_bootstrap.py \
$(srcdir)/Python/importlib.h.new
$(UPDATE_FILE) $(srcdir)/Python/importlib.h $(srcdir)/Python/importlib.h.new
@@ -1781,7 +1781,7 @@
# Regenerate Python/importlib_zipimport.h from Lib/zipimport.py
# using _freeze_importlib
- ./Programs/_freeze_importlib zipimport \
+ ./Programs/_freeze_importlib$(EXE) zipimport \
$(srcdir)/Lib/zipimport.py \
$(srcdir)/Python/importlib_zipimport.h.new
$(UPDATE_FILE) $(srcdir)/Python/importlib_zipimport.h $(srcdir)/Python/importlib_zipimport.h.new
@@ -1807,7 +1807,7 @@ clean: pycremoval
find build -name '*.py[co]' -exec rm -f {} ';' || true
-rm -f pybuilddir.txt
-rm -f Lib/lib2to3/*Grammar*.pickle


+ 12
- 3
patches/Python/win32/1800-link-win-resource-files-and-build-pythonw.patch View File

@@ -9,6 +9,15 @@ diff -Naur Python-3.8.0-orig/Makefile.pre.in Python-3.8.0/Makefile.pre.in
PYTHON_FOR_REGEN=@PYTHON_FOR_REGEN@
UPDATE_FILE=@PYTHON_FOR_REGEN@ $(srcdir)/Tools/scripts/update_file.py
@@ -272,6 +272,8 @@ COVERAGE_INFO= $(abs_builddir)/coverage.info
COVERAGE_REPORT=$(abs_builddir)/lcov-report
COVERAGE_REPORT_OPTIONS=--no-branch-coverage --title "CPython lcov report"
+# tool to generate windows resource files
+WINDRES?= windres
# === Definitions added by makesetup ===
@@ -455,7 +456,7 @@
# Default target
@@ -29,13 +38,13 @@ diff -Naur Python-3.8.0-orig/Makefile.pre.in Python-3.8.0/Makefile.pre.in
+ @echo '#define PYTHON_DLL_NAME "$(DLLLIBRARY)"' >> $@
+
+python_exe.o: pythonnt_rc.h $(srcdir)/PC/python_exe.rc
+ windres -I$(srcdir)/Include -I$(srcdir)/PC -I. $(srcdir)/PC/python_exe.rc $@
+ $(WINDRES) -I$(srcdir)/Include -I$(srcdir)/PC -I. $(srcdir)/PC/python_exe.rc $@
+
+pythonw_exe.o: pythonnt_rc.h $(srcdir)/PC/pythonw_exe.rc
+ windres -I$(srcdir)/Include -I$(srcdir)/PC -I. $(srcdir)/PC/pythonw_exe.rc $@
+ $(WINDRES) -I$(srcdir)/Include -I$(srcdir)/PC -I. $(srcdir)/PC/pythonw_exe.rc $@
+
+python_nt.o: pythonnt_rc.h $(srcdir)/PC/python_nt.rc
+ windres -I$(srcdir)/Include -I$(srcdir)/PC -I. $(srcdir)/PC/python_nt.rc $@
+ $(WINDRES) -I$(srcdir)/Include -I$(srcdir)/PC -I. $(srcdir)/PC/python_nt.rc $@
+
+$(BUILDPYTHONW): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) pythonw_exe.o
+ $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -municode -mwindows -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) pythonw_exe.o


+ 44
- 9
patches/Python/win32/9001-pawpaw-needed-changes.patch View File

@@ -1,16 +1,40 @@
diff --git a/configure.ac b/configure.ac
index 6210e41..51432a8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1297,7 +1297,7 @@ if test $enable_shared = "yes"; then
*-*-mingw*)
LDLIBRARY='libpython$(LDVERSION).dll.a'
DLLLIBRARY='libpython$(LDVERSION).dll'
- BLDLIBRARY='-L. -lpython$(LDVERSION)'
+ BLDLIBRARY='-L. -Wl,-Bdynamic -lpython$(LDVERSION) -Wl,-Bstatic'
;;
esac
else # shared is disabled
diff --git a/Lib/distutils/ccompiler.py b/Lib/distutils/ccompiler.py
index 0ea9cfe..1a24d5b 100644
--- a/Lib/distutils/ccompiler.py
+++ b/Lib/distutils/ccompiler.py
@@ -1098,6 +1098,8 @@ def gen_lib_options (compiler, library_dirs, runtime_library_dirs, libraries):
else:
lib_opts.append(opt)
+ lib_opts.append("-Wl,-Bdynamic")
+
# XXX it's important that we *not* remove redundant library mentions!
# sometimes you really do have to say "-lfoo -lbar -lfoo" in order to
# resolve all symbols. I just hope we never have to say "-lfoo obj.o
@@ -1115,4 +1117,6 @@ def gen_lib_options (compiler, library_dirs, runtime_library_dirs, libraries):
"'%s' found (skipping)" % lib)
else:
lib_opts.append(compiler.library_option (lib))
+
+ lib_opts.append("-Wl,-Bstatic")
return lib_opts
diff --git a/Lib/distutils/cygwinccompiler.py b/Lib/distutils/cygwinccompiler.py
index dddf412..b0a18a7 100644
--- a/Lib/distutils/cygwinccompiler.py
+++ b/Lib/distutils/cygwinccompiler.py
@@ -263,6 +263,8 @@ class CygwinCCompiler(UnixCCompiler):
if not debug and not hasattr(sys, 'gettotalrefcount'):
extra_preargs.append("-s")
+ extra_preargs.append("-Wl,-Bdynamic")
+
UnixCCompiler.link(self, target_desc, objects, output_filename,
output_dir, libraries, library_dirs,
runtime_library_dirs,
@@ -413,6 +415,7 @@ def _find_exe_version(cmd):
out_string = out.read()
finally:
@@ -19,3 +43,14 @@ index dddf412..b0a18a7 100644
result = RE_VERSION.search(out_string)
if result is None:
return None
diff --git a/Misc/python.pc.in b/Misc/python.pc.in
index 3900190..8bdd635 100644
--- a/Misc/python.pc.in
+++ b/Misc/python.pc.in
@@ -9,5 +9,5 @@ Description: Build a C extension for Python
Requires:
Version: @VERSION@
Libs.private: @LIBS@
-Libs: -L${libdir} -lpython@VERSION@@ABIFLAGS@
+Libs: -L${libdir} -L${prefix}/bin -Wl,-Bdynamic -lpython@VERSION@@ABIFLAGS@ -Wl,-Bstatic
Cflags: -I${includedir}/python@VERSION@@ABIFLAGS@

Loading…
Cancel
Save