python{2,3}: Use -O2 optimization for building extensions

This commit is contained in:
Alexpux
2014-09-23 11:01:49 +04:00
parent 7917aa312d
commit 1f26f2db65
5 changed files with 41 additions and 22 deletions

View File

@@ -0,0 +1,15 @@
--- a/Lib/distutils/cygwinccompiler.py.orig 2014-06-30 07:05:25.000000000 +0500
+++ b/Lib/distutils/cygwinccompiler.py 2014-09-23 10:42:09.263600000 +0500
@@ -324,9 +324,9 @@
else:
no_cygwin = ''
- self.set_executables(compiler='gcc%s -O -Wall' % no_cygwin,
- compiler_so='gcc%s -mdll -O -Wall' % no_cygwin,
- compiler_cxx='g++%s -O -Wall' % no_cygwin,
+ self.set_executables(compiler='gcc%s -O2 -Wall' % no_cygwin,
+ compiler_so='gcc%s -mdll -O2 -Wall' % no_cygwin,
+ compiler_cxx='g++%s -O2 -Wall' % no_cygwin,
linker_exe='gcc%s' % no_cygwin,
linker_so='%s%s %s %s'
% (self.linker_dll, no_cygwin,

View File

@@ -5,7 +5,7 @@
_realname=python2
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=2.7.8
pkgrel=4
pkgrel=5
_pybasever=2.7
pkgdesc="A high-level scripting language (mingw-w64)"
arch=('any')
@@ -22,7 +22,7 @@ depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
"${MINGW_PACKAGE_PREFIX}-tcl"
"${MINGW_PACKAGE_PREFIX}-tk")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config" "${MINGW_PACKAGE_PREFIX}-ncurses")
options=('!makeflags' 'staticlibs' '!strip' 'debug')
options=('!makeflags' 'staticlibs' 'strip' '!debug')
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
@@ -94,6 +94,7 @@ source=("http://www.python.org/ftp/python/${pkgver%rc?}/Python-${pkgver}.tar.xz"
0830-add-build-sysroot-config-option.patch
0840-add-builddir-to-library_dirs.patch
0850-cross-PYTHON_FOR_BUILD-gteq-276-and-fullpath-it.patch
0860-mingw-build-optimized-ext.patch
1000-dont-link-with-gettext.patch
1010-ctypes-python-dll.patch
1020-gdbm-module-includes.patch
@@ -186,6 +187,7 @@ prepare() {
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}"/0850-cross-PYTHON_FOR_BUILD-gteq-276-and-fullpath-it.patch
patch -p1 -i "${srcdir}"/0860-mingw-build-optimized-ext.patch
plain "Apply Alexey Pavlov's mingw-w64 patches (2)"
patch -p1 -i "${srcdir}"/1000-dont-link-with-gettext.patch
@@ -232,8 +234,8 @@ build() {
CFLAGS+=" -fwrapv -D__USE_MINGW_ANSI_STDIO=1 "
CXXFLAGS+=" -fwrapv -D__USE_MINGW_ANSI_STDIO=1 "
CPPFLAGS+=" -I$PREFIX_WIN/include -I$PREFIX_WIN/include/ncursesw -I$PREFIX_WIN/${MINGW_CHOST}/include "
#LDFLAGS+=" -L$PREFIX_WIN/${MINGW_CHOST}/lib -L$PREFIX_WIN/lib "
CPPFLAGS+=" -I$PREFIX_WIN/include -I$PREFIX_WIN/include/ncursesw "
if check_option "strip" "y"; then
LDFLAGS+=" -s "
fi
@@ -393,6 +395,7 @@ sha1sums=('9c6281eeace0c3646fa556c8087bb1b7e033c9c4'
'430ed5b5794e4081b7de2016bc10b2d220e29f24'
'b570caceaf451c0869d840fc06dae526f083046b'
'9ee357eb87550e1ce5c8fd359a976a24bf9ff697'
'ee253d2d59916fe3f9f50c853b8006b9cf79e2c3'
'439eaa06db994ddb724e5ad6a459bbddb5089527'
'5601ab657dc701aea3b16cf96be782b45262a6b4'
'a5b4f74cfdc0cd8148ae0c2b7d080e08ac73bc5a'

View File

@@ -1,17 +0,0 @@
--- a/Lib/distutils/cygwinccompiler.py.orig 2014-08-05 23:01:05.598200000 +0400
+++ b/Lib/distutils/cygwinccompiler.py 2014-08-05 23:02:24.355000000 +0400
@@ -167,8 +167,12 @@
raise CompileError(msg)
else: # for other files use the C-compiler
try:
- self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
- extra_postargs)
+ if "MSYSTEM" in os.environ:
+ self.spawn(['sh', '-c', ' '.join(self.compiler_so + cc_args + [src, '-o', obj] +
+ extra_postargs).replace("\\", "\\\\")])
+ else:
+ self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
+ extra_postargs)
except DistutilsExecError as msg:
raise CompileError(msg)

View File

@@ -0,0 +1,15 @@
--- a/Lib/distutils/cygwinccompiler.py.orig 2014-05-19 10:19:38.000000000 +0500
+++ b/Lib/distutils/cygwinccompiler.py 2014-09-23 11:09:54.211200000 +0500
@@ -299,9 +299,9 @@
raise CCompilerError(
'Cygwin gcc cannot be used with --compiler=mingw32')
- self.set_executables(compiler='gcc -O -Wall',
- compiler_so='gcc -mdll -O -Wall',
- compiler_cxx='g++ -O -Wall',
+ self.set_executables(compiler='gcc -O2 -Wall',
+ compiler_so='gcc -mdll -O2 -Wall',
+ compiler_cxx='g++ -O2 -Wall',
linker_exe='gcc',
linker_so='%s %s %s'
% (self.linker_dll, shared_option,

View File

@@ -6,7 +6,7 @@ _realname=python3
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
_pybasever=3.4
pkgver=${_pybasever}.1
pkgrel=8
pkgrel=9
pkgdesc="A high-level scripting language (mingw-w64)"
arch=('any')
license=('PSF')
@@ -104,6 +104,7 @@ source=("http://www.python.org/ftp/python/${pkgver%rc?}/Python-${pkgver}.tar.xz"
0850-use-gnu_printf-in-format.patch
0860-fix-_Py_CheckPython3-prototype.patch
0870-mingw-fix-ssl-dont-use-enum_certificates.patch
0890-mingw-build-optimized-ext.patch
1000-fix-building-posixmodule.patch
1010-install-msilib.patch)
@@ -201,6 +202,7 @@ prepare() {
patch -Np1 -i "${srcdir}"/0850-use-gnu_printf-in-format.patch
patch -Np1 -i "${srcdir}"/0860-fix-_Py_CheckPython3-prototype.patch
patch -Np1 -i "${srcdir}"/0870-mingw-fix-ssl-dont-use-enum_certificates.patch
patch -Np1 -i "${srcdir}"/0890-mingw-build-optimized-ext.patch
patch -Np1 -i "${srcdir}"/1000-fix-building-posixmodule.patch
patch -Np1 -i "${srcdir}"/1010-install-msilib.patch
@@ -406,5 +408,6 @@ md5sums=('6cafc183b4106476dd73d5738d7f616a'
'c4a497ac25a8438ea0142000d75f1965'
'abec47dfff50a6b1adf6b78e9466a529'
'501eaec84e4516a8201679ee45797a59'
'5d5b248fe1821f82d0e4a4a1385e7ccf'
'38b940ff6ef0652c004c461f4393771a'
'994736a02ffafe807207f0c88e40252b')