summaryrefslogtreecommitdiff
path: root/Makefile.pre.in
diff options
context:
space:
mode:
authorNed Deily <nad@acm.org>2014-08-22 13:30:59 -0700
committerNed Deily <nad@acm.org>2014-08-22 13:30:59 -0700
commit983df8688d6add6d7f35388eac97d5ecd1c8017f (patch)
tree6dc430b8624e77e59931b2bd3a43bff9f8db36a0 /Makefile.pre.in
parent01408453f12a1acd7c1b2caeca377d4bd6ea7947 (diff)
downloadcpython-git-983df8688d6add6d7f35388eac97d5ecd1c8017f.tar.gz
Issue #21166: Prevent possible segfaults and other random failures of
python --generate-posix-vars in pybuilddir.txt build target by ensuring that pybuilddir.txt is always regenerated when configure is run and that the newly built skeleton python does not inadvertently import modules from previously installed instances.
Diffstat (limited to 'Makefile.pre.in')
-rw-r--r--Makefile.pre.in12
1 files changed, 11 insertions, 1 deletions
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 80a09269e6..c3568366e1 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -447,8 +447,18 @@ platform: $(BUILDPYTHON) pybuilddir.txt
# Create build directory and generate the sysconfig build-time data there.
# pybuilddir.txt contains the name of the build dir and is used for
# sys.path fixup -- see Modules/getpath.c.
+# Since this step runs before shared modules are built, try to avoid bootstrap
+# problems by creating a dummy pybuildstr.txt just to allow interpreter
+# initialization to succeed. It will be overwritten by generate-posix-vars
+# or removed in case of failure.
pybuilddir.txt: $(BUILDPYTHON)
- $(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars
+ @echo "none" > ./pybuilddir.txt
+ $(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars ;\
+ if test $$? -ne 0 ; then \
+ echo "generate-posix-vars failed" ; \
+ rm -f ./pybuilddir.txt ; \
+ exit 1 ; \
+ fi
# Build the shared modules
# Under GNU make, MAKEFLAGS are sorted and normalized; the 's' for