python2: Fix --with-pydebug

This commit is contained in:
Ray Donnelly
2015-12-29 03:56:12 +00:00
parent 2d377aeb3c
commit e6ba8ccfcc
3 changed files with 53 additions and 21 deletions

View File

@@ -1,12 +1,11 @@
diff -Naur Python-2.7.9-orig/setup.py Python-2.7.9/setup.py
--- Python-2.7.9-orig/setup.py 2014-12-11 13:51:17.891000000 +0300
+++ Python-2.7.9/setup.py 2014-12-11 13:51:18.015800000 +0300
@@ -272,6 +272,9 @@
@@ -272,6 +272,8 @@
args['compiler_so'] = compiler + ' ' + ccshared + ' ' + cflags
self.compiler.set_executables(**args)
+ if host_platform not in ['mingw', 'win32']:
+ self.compiler.library_dirs.insert(0, '.')
+ self.compiler.library_dirs.insert(0, '.')
+
build_ext.build_extensions(self)

View File

@@ -0,0 +1,26 @@
--- Python-2.7.10/setup.py.orig 2015-12-28 12:34:14.075841800 +0000
+++ Python-2.7.10/setup.py 2015-12-28 15:47:57.770679100 +0000
@@ -1731,6 +1731,23 @@
if '_tkinter' not in [e.name for e in self.extensions]:
missing.append('_tkinter')
+ # Remove any extensions.library_dirs that are also in compiler.library_dirs
+ # Rationale: It's wrong. Ok, better. The compiler.library_dirs appear first
+ # in the link command line and (finally, not yet) include "." which
+ # causes the build dir to be searched in for -lpython2.7 before
+ # $sysroot/lib. This is necessary as otherwise the old python import
+ # library is used instead of the new one. This affects sqlite (and
+ # some others). I could go into fixing these individually .. but I
+ # worry I'll be back here in 6 months fixing the same bug again if
+ # I do for some other module(s) in Python 2.7.12. In our case,
+ # C:/msys64/mingw64/lib was turning up as that's where libsqlite was
+ # and this prevented me from switching from an installed release to
+ # an new debug Python. We should be building in clean sysroots but
+ # that's another matter really.
+ for ext in self.extensions:
+ ext.library_dirs = [dir for dir in ext.library_dirs
+ if dir not in self.compiler.library_dirs]
+
## # Uncomment these lines if you want to play with xxmodule.c
## ext = Extension('xx', ['xxmodule.c'])
## self.extensions.append(ext)

View File

@@ -1,11 +1,11 @@
# Maintainer: Alexey Pavlov <alexpux@gmail.com>
# Contributor: Ray Donnelly <mingw.android@gmail.com>
# Maintainer: Ray Donnelly <mingw.android@gmail.com>
# Contributor: Saul Ibarra Corretge <saghul@gmail.com>
_realname=python2
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=2.7.10
pkgrel=5
pkgrel=6
_pybasever=${pkgver%.*}
pkgdesc="A high-level scripting language (mingw-w64)"
arch=('any')
@@ -24,7 +24,7 @@ depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
"${MINGW_PACKAGE_PREFIX}-zlib"
)
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config")
options=('!makeflags' 'staticlibs' 'strip' '!debug')
options=('!makeflags') # 'debug' '!strip')
source=("http://www.python.org/ftp/python/${pkgver%rc?}/Python-${pkgver}.tar.xz"
0000-make-_sysconfigdata.py-relocatable.patch
0100-MINGW-BASE-use-NT-thread-model.patch
@@ -93,6 +93,7 @@ source=("http://www.python.org/ftp/python/${pkgver%rc?}/Python-${pkgver}.tar.xz"
0820-mingw-reorder-bininstall-ln-symlink-creation.patch
0830-add-build-sysroot-config-option.patch
0840-add-builddir-to-library_dirs.patch
0845-Remove-compiler-lib-dirs-from-extension-lib-dirs.patch
0850-cross-PYTHON_FOR_BUILD-gteq-276-and-fullpath-it.patch
0855-mingw-fix-ssl-dont-use-enum_certificates.patch
0860-mingw-build-optimized-ext.patch
@@ -187,6 +188,7 @@ prepare() {
patch -p1 -i "${srcdir}"/0820-mingw-reorder-bininstall-ln-symlink-creation.patch
patch -p1 -i "${srcdir}"/0830-add-build-sysroot-config-option.patch
patch -p1 -i "${srcdir}"/0840-add-builddir-to-library_dirs.patch
patch -p1 -i "${srcdir}"/0845-Remove-compiler-lib-dirs-from-extension-lib-dirs.patch
patch -p1 -i "${srcdir}"/0850-cross-PYTHON_FOR_BUILD-gteq-276-and-fullpath-it.patch
patch -p1 -i "${srcdir}"/0855-mingw-fix-ssl-dont-use-enum_certificates.patch
patch -p1 -i "${srcdir}"/0860-mingw-build-optimized-ext.patch
@@ -235,6 +237,7 @@ prepare() {
}
build() {
declare -a extra_config
local PREFIX_WIN=$(cygpath -wm ${MINGW_PREFIX})
CFLAGS+=" -fwrapv -D__USE_MINGW_ANSI_STDIO=1 "
@@ -244,15 +247,16 @@ build() {
if check_option "strip" "y"; then
LDFLAGS+=" -s "
fi
# Most of this is unnecessary, perhaps just
# the extra_config bit?
if check_option "debug" "n"; then
CFLAGS+=" -DNDEBUG "
CXXFLAGS+=" -DNDEBUG "
else
plain " -DDEBUG -DPy_DEBUG -D_DEBUG does not work unfortunately .."
# CFLAGS+=" -DDEBUG -DPy_DEBUG -D_DEBUG "
# CXXFLAGS+=" -DDEBUG -DPy_DEBUG -D_DEBUG "
CFLAGS+=" -O0 -ggdb"
CXXFLAGS+=" -O0 -ggdb"
CFLAGS+=" -DDEBUG -DPy_DEBUG -D_DEBUG "
CXXFLAGS+=" -DDEBUG -DPy_DEBUG -D_DEBUG "
extra_config+=("--with-pydebug")
fi
local LIBFFI_INC=`${MINGW_PREFIX}/bin/pkg-config libffi --cflags-only-I | sed "s|\-I||g"`
@@ -272,15 +276,16 @@ build() {
--with-threads \
--with-system-expat \
--with-system-ffi \
"${extra_config[@]}" \
OPT=""
#--with-dbmliborder='gdbm:ndbm'
make
}
check() {
cd "${srcdir}/build-${CARCH}"
make test
}
#check() {
# cd "${srcdir}/build-${CARCH}"
# make test
#}
package() {
cd "${srcdir}/build-${CARCH}"
@@ -288,18 +293,19 @@ package() {
MSYSTEM=MINGW \
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
make install DESTDIR="$pkgdir"
make install DESTDIR="${pkgdir}"
mv "${pkgdir}${MINGW_PREFIX}"/bin/smtpd.py "${pkgdir}${MINGW_PREFIX}"/lib/python${_pybasever}/
# gdb pretty printers for debugging Python itself; to use:
# gdb support for debugging Python itself (needs options='debug',
# *may* work better on i686 due to frame pointer always being available) to use:
# python
# sys.path.append('C:/msys64/mingw64/share/gdb/python2')
# import python-gdb
# reload(python-gdb)
# import python_gdb
# reload(python_gdb)
# end
[[ -d "${pkgdir}${MINGW_PREFIX}"/share/gdb/python2/ ]] || mkdir -p "${pkgdir}${MINGW_PREFIX}"/share/gdb/python2/
cp -f python.exe-gdb.py "${pkgdir}${MINGW_PREFIX}"/share/gdb/python2/python-gdb.py
cp -f python.exe-gdb.py "${pkgdir}${MINGW_PREFIX}"/share/gdb/python2/python_gdb.py
# Copy python import library to $prefix/lib because some programs can't find it in other locations
cp -f "${pkgdir}${MINGW_PREFIX}"/lib/python${_pybasever}/config/libpython${_pybasever}.dll.a "${pkgdir}${MINGW_PREFIX}"/lib/libpython${_pybasever}.dll.a
@@ -420,7 +426,8 @@ sha1sums=('ee5a50c5562e7448f037d35fdedc18d95c748b9e'
'23c0bcdb082006d6bde3eb9fc72044272c7a08f3'
'fbefe2d0d2d4c9f995c9c49a66c93071587b7045'
'15e055c4cce32a0c1940953062fd2db7c22364c4'
'f0f5efb98c610d0caf3ccbf0850460af49f92c96'
'731ac1d1e54af3906d836a6595cb3a76ce165260'
'415ae19daf7dddc8db20009f2c708b900822e6b4'
'78b039f8ab595750b2f7aee3e2fc6d7a466a5c9c'
'aa295dd8c4f60b70c61753fc4be9c8ff50101577'
'de01d87f5070992f305d5375da1deb69f80ea8bb'