From 0c92ad97c0485308b408ac65d893e055deed09cc Mon Sep 17 00:00:00 2001 From: Leonid Pliushch Date: Tue, 14 Jan 2020 01:30:29 +0200 Subject: [PATCH] python: build with optimizations enabled --- packages/python/build.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/python/build.sh b/packages/python/build.sh index c576db182..6fbdd1005 100644 --- a/packages/python/build.sh +++ b/packages/python/build.sh @@ -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() {