summarylogtreecommitdiffstats
path: root/0109-build-Integrate-venvlauncher-build-installation-into.patch
blob: 33c151e75c45f876b61467a03eea0475328a8251 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
From f86fcd93f6748af7964e2875a890e3957ce3a2c4 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 109/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 7b8317a..6012869 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -161,6 +161,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@
@@ -264,6 +265,8 @@ LIBOBJS=	@LIBOBJS@
 PYTHON=		python$(EXE)
 BUILDPYTHON=	python$(BUILDEXE)
 BUILDPYTHONW=	pythonw$(BUILDEXE)
+BUILDVENVLAUNCHER=	venvlauncher$(BUILDEXE)
+BUILDVENVWLAUNCHER=	venvwlauncher$(BUILDEXE)
 
 PYTHON_FOR_REGEN?=@PYTHON_FOR_REGEN@
 UPDATE_FILE=@PYTHON_FOR_REGEN@ $(srcdir)/Tools/scripts/update_file.py
@@ -487,7 +490,7 @@ DTRACE_DEPS = \
 
 # Default target
 all:		@DEF_MAKE_ALL_RULE@
-build_all:	check-clean-src $(BUILDPYTHON) $(BUILDPYTHONW) oldsharedmods sharedmods gdbhooks \
+build_all:	check-clean-src $(BUILDPYTHON) $(BUILDPYTHONW) $(BUILDVENVLAUNCHER) $(BUILDVENVWLAUNCHER) oldsharedmods sharedmods gdbhooks \
 		Programs/_testembed python-config
 
 # Check that the source is clean when building out of source.
@@ -617,6 +620,14 @@ $(BUILDPYTHONW): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) pythonw
 $(BUILDPYTHON):	Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) python_exe.o
 	$(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -municode -o $@ Programs/python.o $(BLDLIBRARY) $(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: $(BUILDPYTHON) 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
 
@@ -1331,7 +1342,7 @@ $(DESTSHARED):
 # Install the interpreter with $(VERSION) affixed
 # This goes into $(exec_prefix)
 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"; \
@@ -1342,6 +1353,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
-- 
2.33.0