2019-06-25 09:24:27 -06:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
2021-08-10 10:00:58 -06:00
|
|
|
# Without this environment variable being set to some arbitrary value,
|
|
|
|
# python's module loader uses timestamps for cache invalidation. Something
|
|
|
|
# goes wrong here and all pyc files are seen as stale.
|
|
|
|
#
|
|
|
|
# By setting this value, python uses checksums for cache invalidation which
|
|
|
|
# (on my machine) drops startup time from 3 seconds to 0.060s. Further
|
|
|
|
# investigation is needed.
|
|
|
|
export SOURCE_DATE_EPOCH=1628593994
|
|
|
|
|
2020-03-24 07:44:52 -06:00
|
|
|
# Remove util-linux dependency among other things.
|
2020-02-07 16:55:12 -07:00
|
|
|
cat >> Modules/Setup <<EOF
|
|
|
|
*disabled*
|
2020-03-24 07:44:52 -06:00
|
|
|
_uuid nis ossaudiodev
|
2020-02-07 16:55:12 -07:00
|
|
|
EOF
|
|
|
|
|
2020-03-28 05:49:47 -06:00
|
|
|
# Reported 20-27% performance improvements.
|
|
|
|
# See: "PythonNoSemanticInterpositionSpeedup"
|
|
|
|
export CFLAGS="$CFLAGS -fno-semantic-interposition"
|
|
|
|
export LDFLAGS="$LDFLAGS -fno-semantic-interposition"
|
|
|
|
|
2020-03-24 07:44:52 -06:00
|
|
|
patch -p1 < python3-always-pip.patch
|
|
|
|
|
2019-06-25 09:24:27 -06:00
|
|
|
./configure \
|
2019-06-27 03:10:08 -06:00
|
|
|
--prefix=/usr \
|
2019-09-09 04:19:14 -06:00
|
|
|
--enable-shared \
|
|
|
|
--with-system-expat \
|
|
|
|
--with-system-ffi \
|
2020-03-24 07:44:52 -06:00
|
|
|
--with-ensurepip=yes \
|
|
|
|
--without-doc-strings
|
2019-06-25 09:24:27 -06:00
|
|
|
|
2021-08-10 05:13:14 -06:00
|
|
|
make EXTRA_CFLAGS="$CFLAGS -DTHREAD_STACK_SIZE=0x100000"
|
2021-07-17 21:09:11 -06:00
|
|
|
make install
|
2019-06-25 11:08:58 -06:00
|
|
|
|
|
|
|
ln -s python3 "$1/usr/bin/python"
|
2019-08-28 12:55:53 -06:00
|
|
|
ln -s pip3 "$1/usr/bin/pip"
|
2019-08-29 18:31:47 -06:00
|
|
|
|
|
|
|
# Make static library writable.
|
2020-02-25 15:32:57 -07:00
|
|
|
chmod u+w "$1/usr/lib/libpython"*
|
2020-03-24 07:44:52 -06:00
|
|
|
|
|
|
|
# Let's make some kind of effort to reduce the overall
|
|
|
|
# size of Python by removing a bunch of rarely used and
|
|
|
|
# otherwise useless components.
|
|
|
|
#
|
|
|
|
# This can't be done via ./configure as the build system
|
|
|
|
# doesn't give you this much control over the process.
|
|
|
|
{
|
|
|
|
cd "$1/usr/lib/python"*
|
|
|
|
rm -rf test ./*/test ./*/tests
|
2021-07-20 05:43:49 -06:00
|
|
|
rm -rf pydoc* idlelib turtle* config-*
|
2020-03-24 07:44:52 -06:00
|
|
|
|
|
|
|
cd "$1/usr/bin"
|
2020-05-24 23:33:30 -06:00
|
|
|
rm -f pydoc* idle*
|
2020-03-24 07:44:52 -06:00
|
|
|
}
|