python: build with optimizations enabled

This commit is contained in:
Leonid Pliushch 2020-01-14 01:30:29 +02:00
parent eb27236873
commit 0c92ad97c0

View File

@ -3,12 +3,14 @@ TERMUX_PKG_DESCRIPTION="Python 3 programming language intended to enable clear p
TERMUX_PKG_LICENSE="PythonPL"
_MAJOR_VERSION=3.8
TERMUX_PKG_VERSION=${_MAJOR_VERSION}.1
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://www.python.org/ftp/python/${TERMUX_PKG_VERSION}/Python-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=75894117f6db7051c1b34f37410168844bbb357c139a8a10a352e9bf8be594e8
TERMUX_PKG_DEPENDS="gdbm, libandroid-support, libbz2, libcrypt, libffi, liblzma, libsqlite, ncurses, ncurses-ui-libs, openssl, readline, zlib"
TERMUX_PKG_SUGGESTS="python-tkinter"
TERMUX_PKG_BREAKS="python2 (<= 2.7.15), python-dev"
TERMUX_PKG_REPLACES="python-dev"
# The flag --with(out)-pymalloc (disable/enable specialized mallocs) is enabled by default and causes m suffix versions of python.
# Set ac_cv_func_wcsftime=no to avoid errors such as "character U+ca0025 is not in range [U+0000; U+10ffff]"
# when executing e.g. "from time import time, strftime, localtime; print(strftime(str('%Y-%m-%d %H:%M'), localtime()))"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="ac_cv_file__dev_ptmx=yes ac_cv_file__dev_ptc=no ac_cv_func_wcsftime=no"
@ -28,13 +30,16 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" ac_cv_buggy_getaddrinfo=no"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --enable-loadable-sqlite-extensions"
# Fix https://github.com/termux/termux-packages/issues/2236:
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" ac_cv_little_endian_double=yes"
# Enable optimizations:
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --enable-optimizations"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-computed-gotos"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-lto"
TERMUX_PKG_RM_AFTER_INSTALL="
lib/python${_MAJOR_VERSION}/test
lib/python${_MAJOR_VERSION}/*/test
lib/python${_MAJOR_VERSION}/*/tests
"
TERMUX_PKG_BREAKS="python2 (<= 2.7.15), python-dev"
TERMUX_PKG_REPLACES="python-dev"
termux_step_pre_configure() {
# Needed when building with clang, as setup.py only probes
@ -44,6 +49,9 @@ termux_step_pre_configure() {
CPPFLAGS+=" -I$TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/include"
LDFLAGS+=" -L$TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/lib"
if [ $TERMUX_ARCH = x86_64 ]; then LDFLAGS+=64; fi
# -Oz causes linking error when -flto is enabled.
CFLAGS="${CFLAGS/-Oz/-O3}"
}
termux_step_post_make_install() {