MINGW-packages/mingw-w64-python/0059-build-Integrate-venvlauncher-build-installation-into.patch
2025-10-10 14:31:04 +02:00

77 lines
3.2 KiB
Diff

From 4e033763394be7fd3ffbd43c25a64118d0df4634 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Sun, 25 Jul 2021 16:53:35 +0200
Subject: [PATCH 059/N] build: Integrate venvlauncher build/installation into
the Makefile
This is required for venv creation on Windows.
Ideally this would use the venv specific launcher (PC/launcher.c),
but a copy of main binary seems to work as well for now.
---
Makefile.pre.in | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/Makefile.pre.in b/Makefile.pre.in
index fc1ea7d..073a770 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -170,6 +170,7 @@ BINLIBDEST= @BINLIBDEST@
LIBDEST= $(SCRIPTDIR)/python$(VERSION)
INCLUDEPY= $(INCLUDEDIR)/python$(LDVERSION)
CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(LDVERSION)
+VENVLAUNCHERDIR= $(BINLIBDEST)/venv/scripts/nt
# Symbols used for using shared libraries
SHLIB_SUFFIX= @SHLIB_SUFFIX@
@@ -290,6 +291,8 @@ LIBOBJS= @LIBOBJS@
PYTHON= python$(EXE)
BUILDPYTHON= python$(BUILDEXE)
BUILDPYTHONW= pythonw$(BUILDEXE)
+BUILDVENVLAUNCHER= venvlauncher$(BUILDEXE)
+BUILDVENVWLAUNCHER= venvwlauncher$(BUILDEXE)
HOSTRUNNER= @HOSTRUNNER@
@@ -630,7 +633,7 @@ all: @DEF_MAKE_ALL_RULE@
.PHONY: all
.PHONY: build_all
-build_all: check-clean-src $(BUILDPYTHON) $(BUILDPYTHONW) platform sharedmods \
+build_all: check-clean-src $(BUILDPYTHON) $(BUILDPYTHONW) $(BUILDVENVLAUNCHER) $(BUILDVENVWLAUNCHER) platform sharedmods \
gdbhooks Programs/_testembed scripts checksharedmods rundsymutil
.PHONY: build_wasm
@@ -813,6 +816,14 @@ $(BUILDPYTHONW): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) pythonw
$(BUILDPYTHON): Programs/python.o $(LINK_PYTHON_DEPS) python_exe.o
$(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -municode -o $@ Programs/python.o $(LINK_PYTHON_OBJS) $(LIBS) $(MODLIBS) $(SYSLIBS) python_exe.o
+# FIXME: build these from PC/launcher.c instead
+$(BUILDVENVLAUNCHER): $(BUILDPYTHON)
+ cp $(BUILDPYTHON) $(BUILDVENVLAUNCHER)
+
+# FIXME: build these from PC/launcher.c instead
+$(BUILDVENVWLAUNCHER): $(BUILDPYTHONW)
+ cp $(BUILDPYTHONW) $(BUILDVENVWLAUNCHER)
+
platform: $(PYTHON_FOR_BUILD_DEPS) pybuilddir.txt
$(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print("%s-%d.%d" % (get_platform(), *sys.version_info[:2]))' >platform
@@ -1988,7 +1999,7 @@ sharedinstall: all
# This goes into $(exec_prefix)
.PHONY: altbininstall
altbininstall: $(BUILDPYTHON) @FRAMEWORKPYTHONW@
- @for i in $(BINDIR) $(LIBDIR); \
+ @for i in $(BINDIR) $(LIBDIR) $(VENVLAUNCHERDIR); \
do \
if test ! -d $(DESTDIR)$$i; then \
echo "Creating directory $$i"; \
@@ -1999,6 +2010,8 @@ altbininstall: $(BUILDPYTHON) @FRAMEWORKPYTHONW@
if test "$(PYTHONFRAMEWORKDIR)" = "no-framework" ; then \
$(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(LDVERSION)$(EXE); \
$(INSTALL_PROGRAM) $(BUILDPYTHONW) $(DESTDIR)$(BINDIR)/python3w$(EXE); \
+ $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(VENVLAUNCHERDIR)/python$(EXE); \
+ $(INSTALL_PROGRAM) $(BUILDPYTHONW) $(DESTDIR)$(VENVLAUNCHERDIR)/pythonw$(EXE); \
else \
$(INSTALL_PROGRAM) $(STRIPFLAG) Mac/pythonw $(DESTDIR)$(BINDIR)/python$(LDVERSION)$(EXE); \
fi