master hovercats/oakiss / repo / python / build
 1#!/bin/sh -e
 2
 3for p in *.patch; do
 4	patch -p1 < "$p"
 5done
 6
 7# Remove util-linux dependency among other things.
 8cat >> Modules/Setup <<EOF
 9*disabled*
10_uuid nis ossaudiodev
11EOF
12
13# Reported 20-27% performance improvements.
14# See: "PythonNoSemanticInterpositionSpeedup"
15export CFLAGS="$CFLAGS -fno-semantic-interposition"
16export LDFLAGS="$LDFLAGS -fno-semantic-interposition"
17
18./configure \
19    --prefix=/usr \
20    --libdir=/usr/lib \
21    --enable-shared \
22    --with-system-ffi \
23    --with-system-expat \
24    --with-ensurepip=yes \
25    --without-pymalloc \
26    --disable-ipv6 \
27    --with-builtin-hashlib-hashes="sha3,blake2,sha1,sha512,sha256,md5" \
28    --with-ssl-default-suites="TLSv1.3:TLSv1.2+AEAD+ECDHE:TLSv1.2+AEAD+DHE" \
29    ax_cv_c_float_words_bigendian=no
30
31make EXTRA_CFLAGS="$CFLAGS -DTHREAD_STACK_SIZE=0x100000"
32make DESTDIR="$1" install
33
34ln -s python3 "$1/usr/bin/python"
35ln -s pip3    "$1/usr/bin/pip"
36
37# Let's make some kind of effort to reduce the overall
38# size of Python by removing a bunch of rarely used and
39# otherwise useless components.
40#
41# This can't be done via ./configure as the build system
42# doesn't give you this much control over the process.
43{
44    cd "$1/usr/lib/python"*
45    rm -rf test ./*/test ./*/tests
46    rm -rf pydoc* idlelib turtle* config-*
47
48    cd "$1/usr/bin"
49    rm -f pydoc* idle*
50}
51
52# Compress manpages
53find "$1/usr/share/man" -type f -exec gzip -n -9 {} +
54
55# fix broken symlink
56ln -sf python3.11.1.gz "$1/usr/share/man/man1/python3.1"
57
58# A lot of python scripts use #!/usr/bin/env python
59ln -sf ../../bin/env "$1/usr/bin/env"