From d985a7113ed54f114c80d511c3876101ade70c7c Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 6 Oct 2023 01:27:52 +0200 Subject: [PATCH] gh-103053: Fix BUILDPYTHON target of Makefile On FreeBSD when Python is built out of tree, the "python" program was created in the source directory instead of build directory. Fix the Makefile to write the "python" program in the build directory. --- Makefile.pre.in | 5 ++++- .../Build/2023-10-06-01-35-22.gh-issue-103053.qyJ0ru.rst | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Build/2023-10-06-01-35-22.gh-issue-103053.qyJ0ru.rst diff --git a/Makefile.pre.in b/Makefile.pre.in index f1f5c8557e7ffc..a39c86b11c6505 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -783,7 +783,10 @@ clinic-tests: check-clean-src $(srcdir)/Lib/test/clinic.test.c # Build the interpreter $(BUILDPYTHON): Programs/python.o $(LINK_PYTHON_DEPS) - $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(LINK_PYTHON_OBJS) $(LIBS) $(MODLIBS) $(SYSLIBS) + @ # gh-103053: Use "-o $(BUILDPYTHON)" instead of "-o $@". + @ # On FreeBSD when Python is built out of tree, $@ contains the source + @ # directory, whereas the build directory is expected. + $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $(BUILDPYTHON) Programs/python.o $(LINK_PYTHON_OBJS) $(LIBS) $(MODLIBS) $(SYSLIBS) 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 diff --git a/Misc/NEWS.d/next/Build/2023-10-06-01-35-22.gh-issue-103053.qyJ0ru.rst b/Misc/NEWS.d/next/Build/2023-10-06-01-35-22.gh-issue-103053.qyJ0ru.rst new file mode 100644 index 00000000000000..a1fc76a5a88cd3 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2023-10-06-01-35-22.gh-issue-103053.qyJ0ru.rst @@ -0,0 +1,4 @@ +On FreeBSD when Python is built out of tree, the "python" program was +created in the source directory instead of build directory. Fix the Makefile +to write the "python" program in the build directory. Patch by Victor +Stinner.