@@ -58,54 +58,154 @@ diff -up Python-2.7.6/Lib/distutils/tests/test_install.py.debug-build Python-2.7
5858 return modname + sysconfig.get_config_var('SO')
5959
6060
61- diff -up Python-2.7.6/Makefile.pre.in.debug-build Python-2.7.6/Makefile.pre.in
62- --- Python-2.7.6/Makefile.pre.in.debug-build 2014-01-29 14:13:08.800889482 +0100
63- +++ Python-2.7.6/Makefile.pre.in 2014-01-29 14:17:30.929316462 +0100
64- @@ -111,8 +111,8 @@ SCRIPTDIR= $(prefix)/lib64
61+ diff -up Python-2.7.6/Misc/python-config.in.debug-build Python-2.7.6/Misc/python-config.in
62+ --- Python-2.7.6/Misc/python-config.in.debug-build 2013-11-10 08:36:41.000000000 +0100
63+ +++ Python-2.7.6/Misc/python-config.in 2014-01-29 14:13:08.816888470 +0100
64+ @@ -45,7 +45,7 @@ for opt in opt_flags:
65+ print ' '.join(flags)
66+
67+ elif opt in ('--libs', '--ldflags'):
68+ - libs = ['-lpython' + pyver]
69+ + libs = ['-lpython' + pyver + (sys.pydebug and "_d" or "")]
70+ libs += getvar('LIBS').split()
71+ libs += getvar('SYSLIBS').split()
72+ # add the prefix/lib/pythonX.Y/config dir, but only if there is no
73+ diff -up Python-2.7.6/Modules/makesetup.debug-build Python-2.7.6/Modules/makesetup
74+ --- Python-2.7.6/Modules/makesetup.debug-build 2013-11-10 08:36:41.000000000 +0100
75+ +++ Python-2.7.6/Modules/makesetup 2014-01-29 14:13:08.817888407 +0100
76+ @@ -233,7 +233,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
77+ *$mod.o*) base=$mod;;
78+ *) base=${mod}module;;
79+ esac
80+ - file="$srcdir/$base\$(SO)"
81+ + file="$srcdir/$base\$(DEBUG_EXT)\$(SO)"
82+ case $doconfig in
83+ no) SHAREDMODS="$SHAREDMODS $file";;
84+ esac
85+ diff -up Python-2.7.6/Python/dynload_shlib.c.debug-build Python-2.7.6/Python/dynload_shlib.c
86+ --- Python-2.7.6/Python/dynload_shlib.c.debug-build 2013-11-10 08:36:41.000000000 +0100
87+ +++ Python-2.7.6/Python/dynload_shlib.c 2014-01-29 14:13:08.817888407 +0100
88+ @@ -46,11 +46,16 @@ const struct filedescr _PyImport_DynLoad
89+ {"module.exe", "rb", C_EXTENSION},
90+ {"MODULE.EXE", "rb", C_EXTENSION},
91+ #else
92+ + #ifdef Py_DEBUG
93+ + {"_d.so", "rb", C_EXTENSION},
94+ + {"module_d.so", "rb", C_EXTENSION},
95+ + #else
96+ {".so", "rb", C_EXTENSION},
97+ {"module.so", "rb", C_EXTENSION},
98+ - #endif
99+ - #endif
100+ - #endif
101+ + #endif /* Py_DEBUG */
102+ + #endif /* __VMS */
103+ + #endif /* defined(PYOS_OS2) && defined(PYCC_GCC) */
104+ + #endif /* __CYGWIN__ */
105+ {0, 0}
106+ };
107+
108+ diff -up Python-2.7.6/Python/sysmodule.c.debug-build Python-2.7.6/Python/sysmodule.c
109+ --- Python-2.7.6/Python/sysmodule.c.debug-build 2013-11-10 08:36:41.000000000 +0100
110+ +++ Python-2.7.6/Python/sysmodule.c 2014-01-29 14:13:08.817888407 +0100
111+ @@ -1506,6 +1506,12 @@ _PySys_Init(void)
112+ PyString_FromString("legacy"));
113+ #endif
114+
115+ + #ifdef Py_DEBUG
116+ + PyDict_SetItemString(sysdict, "pydebug", Py_True);
117+ + #else
118+ + PyDict_SetItemString(sysdict, "pydebug", Py_False);
119+ + #endif
120+ +
121+ #undef SET_SYS_FROM_STRING
122+ if (PyErr_Occurred())
123+ return NULL;
124+ diff -up Python-2.7.6/configure.ac.debug-build Python-2.7.6/configure.ac
125+ --- Python-2.7.6/configure.ac.debug-build 2014-01-29 14:13:08.796889735 +0100
126+ +++ Python-2.7.6/configure.ac 2014-01-29 14:13:08.814888597 +0100
127+ @@ -738,7 +738,7 @@ AC_SUBST(LIBRARY)
128+ AC_MSG_CHECKING(LIBRARY)
129+ if test -z "$LIBRARY"
130+ then
131+ - LIBRARY='libpython$(VERSION).a'
132+ + LIBRARY='libpython$(VERSION)$(DEBUG_EXT).a'
133+ fi
134+ AC_MSG_RESULT($LIBRARY)
135+
136+ @@ -884,8 +884,8 @@ if test $enable_shared = "yes"; then
137+ INSTSONAME="$LDLIBRARY".$SOVERSION
138+ ;;
139+ Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*)
140+ - LDLIBRARY='libpython$(VERSION).so'
141+ - BLDLIBRARY='-L. -lpython$(VERSION)'
142+ + LDLIBRARY='libpython$(VERSION)$(DEBUG_EXT).so'
143+ + BLDLIBRARY='-L. -lpython$(VERSION)$(DEBUG_EXT)'
144+ RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
145+ case $ac_sys_system in
146+ FreeBSD*)
147+ @@ -1028,6 +1028,14 @@ else AC_MSG_RESULT(no); Py_DEBUG='false'
148+ fi],
149+ [AC_MSG_RESULT(no)])
150+
151+ + if test "$Py_DEBUG" = 'true'
152+ + then
153+ + DEBUG_EXT=_d
154+ + DEBUG_SUFFIX=-debug
155+ + fi
156+ + AC_SUBST(DEBUG_EXT)
157+ + AC_SUBST(DEBUG_SUFFIX)
158+ +
159+ # XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
160+ # merged with this chunk of code?
161+
162+ --- Python-2.7.12/Makefile.pre.in 2016-06-25 21:49:31.000000000 +0000
163+ +++ Python-2.7.12/Makefile.pre.in.patch 2016-06-28 20:12:10.304000000 +0000
164+ @@ -116,8 +116,8 @@
65165 # Detailed destination directories
66166 BINLIBDEST= $(LIBDIR)/python$(VERSION)
67167 LIBDEST= $(SCRIPTDIR)/python$(VERSION)
68168- INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
69169- CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)
70- + INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)$(DEBUG_SUFFIX)
71- + CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)$(DEBUG_SUFFIX)
170+ + INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)$(DEBUG_SUFFIX)
171+ + CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)$(DEBUG_SUFFIX)
72172 LIBP= $(LIBDIR)/python$(VERSION)
73173
74174 # Symbols used for using shared libraries
75- @@ -126 ,6 +126 ,12 @@ DESTSHARED= $(BINLIBDEST)/lib-dynload
175+ @@ -131 ,6 +131 ,12 @@
76176 EXE= @EXEEXT@
77177 BUILDEXE= @BUILDEXEEXT@
78178
79179+ # DEBUG_EXT is used by ELF files (names and SONAMEs); it will be "_d" for a debug build
80180+ # DEBUG_SUFFIX is used by filesystem paths; it will be "-debug" for a debug build
81181+ # Both will be empty in an optimized build
82- + DEBUG_EXT= @DEBUG_EXT@
83- + DEBUG_SUFFIX= @DEBUG_SUFFIX@
182+ + DEBUG_EXT= @DEBUG_EXT@
183+ + DEBUG_SUFFIX= @DEBUG_SUFFIX@
84184+
85185 # Short name and location for Mac OS X Python framework
86186 UNIVERSALSDK=@UNIVERSALSDK@
87187 PYTHONFRAMEWORK= @PYTHONFRAMEWORK@
88- @@ -189 ,8 +195 ,8 @@ LIBOBJDIR= Python/
188+ @@ -197 ,8 +203 ,8 @@
89189 LIBOBJS= @LIBOBJS@
90190 UNICODE_OBJS= @UNICODE_OBJS@
91191
92192- PYTHON= python$(EXE)
93193- BUILDPYTHON= python$(BUILDEXE)
94- + PYTHON= python$(DEBUG_SUFFIX)$(EXE)
95- + BUILDPYTHON= python$(DEBUG_SUFFIX)$(BUILDEXE)
194+ + PYTHON= python$(DEBUG_SUFFIX)$(EXE)
195+ + BUILDPYTHON= python$(DEBUG_SUFFIX)$(BUILDEXE)
96196
197+ cross_compiling=@cross_compiling@
97198 PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
98- _PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@
99- @@ -464,7 +470,7 @@ sharedmods: $(BUILDPYTHON) pybuilddir.tx
100- _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
101- $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
199+ @@ -560,7 +566,7 @@
200+ $(AR) $(ARFLAGS) $@ $(MODOBJS)
201+ $(RANLIB) $@
102202
103203- libpython$(VERSION).so: $(LIBRARY_OBJS)
104204+ libpython$(VERSION)$(DEBUG_EXT).so: $(LIBRARY_OBJS)
105205 if test $(INSTSONAME) != $(LDLIBRARY); then \
106206 $(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
107207 $(LN) -f $(INSTSONAME) $@; \
108- @@ -856 ,18 +862 ,18 @@ bininstall: altbininstall
208+ @@ -978 ,18 +984 ,18 @@
109209 then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
110210 else true; \
111211 fi
@@ -135,7 +235,7 @@ diff -up Python-2.7.6/Makefile.pre.in.debug-build Python-2.7.6/Makefile.pre.in
135235
136236 # Install the interpreter with $(VERSION) affixed
137237 # This goes into $(exec_prefix)
138- @@ -880 ,7 +886 ,7 @@ altbininstall: $(BUILDPYTHON)
238+ @@ -1002 ,7 +1008 ,7 @@
139239 else true; \
140240 fi; \
141241 done
@@ -144,7 +244,7 @@ diff -up Python-2.7.6/Makefile.pre.in.debug-build Python-2.7.6/Makefile.pre.in
144244 if test -f $(LDLIBRARY); then \
145245 if test -n "$(DLLLIBRARY)" ; then \
146246 $(INSTALL_SHARED) $(DLLLIBRARY) $(DESTDIR)$(BINDIR); \
147- @@ -1046 ,10 +1052,11 @@ $(srcdir)/Lib/$(PLATDIR):
247+ @@ -1172 ,10 +1178,10 @@
148248 fi; \
149249 cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen
150250
@@ -154,28 +254,27 @@ diff -up Python-2.7.6/Makefile.pre.in.debug-build Python-2.7.6/Makefile.pre.in
154254 # is not available in configure
155255- sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
156256+ sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(DEBUG_SUFFIX)$(EXE)," < $(srcdir)/Misc/python-config.in >python$(DEBUG_SUFFIX)-config
157- +
158257
159258 # Install the include files
160259 INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
161- @@ -1070 ,13 +1077 ,13 @@ inclinstall:
260+ @@ -1196 ,13 +1202 ,13 @@
162261 $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
163262
164263 # Install the library and miscellaneous stuff needed for extending/embedding
165264- # This goes into $(exec_prefix)
166265- LIBPL= $(LIBP)/config
167266+ # This goes into $(exec_prefix)$(DEBUG_SUFFIX)
168- + LIBPL= $(LIBP)/config$(DEBUG_SUFFIX)
267+ + LIBPL= $(LIBP)/config$(DEBUG_SUFFIX)
169268
170269 # pkgconfig directory
171270 LIBPC= $(LIBDIR)/pkgconfig
172271
173272- libainstall: all python-config
174- + libainstall: all python$(DEBUG_SUFFIX)-config
273+ + libainstall: all python$(DEBUG_SUFFIX)-config
175274 @for i in $(LIBDIR) $(LIBP) $(LIBPL) $(LIBPC); \
176275 do \
177276 if test ! -d $(DESTDIR)$$i; then \
178- @@ -1092 ,11 +1099 ,10 @@ libainstall: all python-config
277+ @@ -1230 ,11 +1236 ,10 @@
179278 $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
180279 $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
181280 $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
@@ -189,104 +288,3 @@ diff -up Python-2.7.6/Makefile.pre.in.debug-build Python-2.7.6/Makefile.pre.in
189288 @if [ -s Modules/python.exp -a \
190289 "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
191290 echo; echo "Installing support files for building shared extension modules on AIX:"; \
192- diff -up Python-2.7.6/Misc/python-config.in.debug-build Python-2.7.6/Misc/python-config.in
193- --- Python-2.7.6/Misc/python-config.in.debug-build 2013-11-10 08:36:41.000000000 +0100
194- +++ Python-2.7.6/Misc/python-config.in 2014-01-29 14:13:08.816888470 +0100
195- @@ -45,7 +45,7 @@ for opt in opt_flags:
196- print ' '.join(flags)
197-
198- elif opt in ('--libs', '--ldflags'):
199- - libs = ['-lpython' + pyver]
200- + libs = ['-lpython' + pyver + (sys.pydebug and "_d" or "")]
201- libs += getvar('LIBS').split()
202- libs += getvar('SYSLIBS').split()
203- # add the prefix/lib/pythonX.Y/config dir, but only if there is no
204- diff -up Python-2.7.6/Modules/makesetup.debug-build Python-2.7.6/Modules/makesetup
205- --- Python-2.7.6/Modules/makesetup.debug-build 2013-11-10 08:36:41.000000000 +0100
206- +++ Python-2.7.6/Modules/makesetup 2014-01-29 14:13:08.817888407 +0100
207- @@ -233,7 +233,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
208- *$mod.o*) base=$mod;;
209- *) base=${mod}module;;
210- esac
211- - file="$srcdir/$base\$(SO)"
212- + file="$srcdir/$base\$(DEBUG_EXT)\$(SO)"
213- case $doconfig in
214- no) SHAREDMODS="$SHAREDMODS $file";;
215- esac
216- diff -up Python-2.7.6/Python/dynload_shlib.c.debug-build Python-2.7.6/Python/dynload_shlib.c
217- --- Python-2.7.6/Python/dynload_shlib.c.debug-build 2013-11-10 08:36:41.000000000 +0100
218- +++ Python-2.7.6/Python/dynload_shlib.c 2014-01-29 14:13:08.817888407 +0100
219- @@ -46,11 +46,16 @@ const struct filedescr _PyImport_DynLoad
220- {"module.exe", "rb", C_EXTENSION},
221- {"MODULE.EXE", "rb", C_EXTENSION},
222- #else
223- + #ifdef Py_DEBUG
224- + {"_d.so", "rb", C_EXTENSION},
225- + {"module_d.so", "rb", C_EXTENSION},
226- + #else
227- {".so", "rb", C_EXTENSION},
228- {"module.so", "rb", C_EXTENSION},
229- - #endif
230- - #endif
231- - #endif
232- + #endif /* Py_DEBUG */
233- + #endif /* __VMS */
234- + #endif /* defined(PYOS_OS2) && defined(PYCC_GCC) */
235- + #endif /* __CYGWIN__ */
236- {0, 0}
237- };
238-
239- diff -up Python-2.7.6/Python/sysmodule.c.debug-build Python-2.7.6/Python/sysmodule.c
240- --- Python-2.7.6/Python/sysmodule.c.debug-build 2013-11-10 08:36:41.000000000 +0100
241- +++ Python-2.7.6/Python/sysmodule.c 2014-01-29 14:13:08.817888407 +0100
242- @@ -1506,6 +1506,12 @@ _PySys_Init(void)
243- PyString_FromString("legacy"));
244- #endif
245-
246- + #ifdef Py_DEBUG
247- + PyDict_SetItemString(sysdict, "pydebug", Py_True);
248- + #else
249- + PyDict_SetItemString(sysdict, "pydebug", Py_False);
250- + #endif
251- +
252- #undef SET_SYS_FROM_STRING
253- if (PyErr_Occurred())
254- return NULL;
255- diff -up Python-2.7.6/configure.ac.debug-build Python-2.7.6/configure.ac
256- --- Python-2.7.6/configure.ac.debug-build 2014-01-29 14:13:08.796889735 +0100
257- +++ Python-2.7.6/configure.ac 2014-01-29 14:13:08.814888597 +0100
258- @@ -738,7 +738,7 @@ AC_SUBST(LIBRARY)
259- AC_MSG_CHECKING(LIBRARY)
260- if test -z "$LIBRARY"
261- then
262- - LIBRARY='libpython$(VERSION).a'
263- + LIBRARY='libpython$(VERSION)$(DEBUG_EXT).a'
264- fi
265- AC_MSG_RESULT($LIBRARY)
266-
267- @@ -884,8 +884,8 @@ if test $enable_shared = "yes"; then
268- INSTSONAME="$LDLIBRARY".$SOVERSION
269- ;;
270- Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*)
271- - LDLIBRARY='libpython$(VERSION).so'
272- - BLDLIBRARY='-L. -lpython$(VERSION)'
273- + LDLIBRARY='libpython$(VERSION)$(DEBUG_EXT).so'
274- + BLDLIBRARY='-L. -lpython$(VERSION)$(DEBUG_EXT)'
275- RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
276- case $ac_sys_system in
277- FreeBSD*)
278- @@ -1028,6 +1028,14 @@ else AC_MSG_RESULT(no); Py_DEBUG='false'
279- fi],
280- [AC_MSG_RESULT(no)])
281-
282- + if test "$Py_DEBUG" = 'true'
283- + then
284- + DEBUG_EXT=_d
285- + DEBUG_SUFFIX=-debug
286- + fi
287- + AC_SUBST(DEBUG_EXT)
288- + AC_SUBST(DEBUG_SUFFIX)
289- +
290- # XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
291- # merged with this chunk of code?
292-
0 commit comments