···24 # doesn't work in Nix because Nix changes the mtime of files in
25 # the Nix store to 1. So treat that as a special case.
26 ./nix-store-mtime.patch
00027 ];
2829 preConfigure = ''
···24 # doesn't work in Nix because Nix changes the mtime of files in
25 # the Nix store to 1. So treat that as a special case.
26 ./nix-store-mtime.patch
27+28+ # http://bugs.python.org/issue10013
29+ ./python2.6-fix-parallel-make.patch
30 ];
3132 preConfigure = ''
···1+diff -up Python-2.7/Makefile.pre.in.fix-parallel-make Python-2.7/Makefile.pre.in
2+--- Python-2.7/Makefile.pre.in.fix-parallel-make 2010-07-22 15:01:39.567996932 -0400
3++++ Python-2.7/Makefile.pre.in 2010-07-22 15:47:02.437998509 -0400
4+@@ -207,6 +207,7 @@ SIGNAL_OBJS= @SIGNAL_OBJS@
5+6+ ##########################################################################
7+ # Grammar
8++GRAMMAR_STAMP= $(srcdir)/grammar-stamp
9+ GRAMMAR_H= $(srcdir)/Include/graminit.h
10+ GRAMMAR_C= $(srcdir)/Python/graminit.c
11+ GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
12+@@ -530,10 +531,24 @@ Modules/getpath.o: $(srcdir)/Modules/get
13+ Modules/python.o: $(srcdir)/Modules/python.c
14+ $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
15+16++# GNU "make" interprets rules with two dependents as two copies of the rule.
17++#
18++# In a parallel build this can lead to pgen being run twice, once for each of
19++# GRAMMAR_H and GRAMMAR_C, leading to race conditions in which the compiler
20++# reads a partially-overwritten copy of one of these files, leading to syntax
21++# errors (or linker errors if the fragment happens to be syntactically valid C)
22++#
23++# See http://www.gnu.org/software/hello/manual/automake/Multiple-Outputs.html
24++# for more information
25++#
26++# Introduce ".grammar-stamp" as a contrived single output from PGEN to avoid
27++# this:
28++$(GRAMMAR_H) $(GRAMMAR_C): $(GRAMMAR_STAMP)
29+30+-$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
31++$(GRAMMAR_STAMP): $(PGEN) $(GRAMMAR_INPUT)
32+ -@$(INSTALL) -d Include
33+ -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
34++ touch $(GRAMMAR_STAMP)
35+36+ $(PGEN): $(PGENOBJS)
37+ $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)