lang/python3/ndmake.sh
$ cat ndmake.sh
#!/bin/sh -ue
NAME=python3
VERSION=3.11.5
RELEASE=1
SOURCE="https://www.python.org/ftp/python/3.11.5/Python-3.11.5.tgz"
build() {
patch -p1 < "$PORTDIR/files/bearSSL.patch"
msg "creating modules/setup.local for static modules..."
cat > Modules/Setup.local <<'EOF'
# Force critical modules to be built-in for static builds
*static*
_posixsubprocess _posixsubprocess.c
select selectmodule.c
_socket socketmodule.c
_ssl _ssl.c _ssl/cert.c _ssl/misc.c _ssl/debughelpers.c
# crypto hash modules, required by hashlib, random, tempfile
_md5 md5module.c
_sha1 sha1module.c
_sha256 sha256module.c
_sha512 sha512module.c
_sha3 _sha3/sha3module.c
_blake2 _blake2/blake2module.c _blake2/blake2b_impl.c _blake2/blake2s_impl.c
# core data structures and utilities
_asyncio _asynciomodule.c
_bisect _bisectmodule.c
_contextvars _contextvarsmodule.c
_csv _csv.c
_datetime _datetimemodule.c
_heapq _heapqmodule.c
_json _json.c
_lsprof _lsprof.c rotatingtree.c
_opcode _opcode.c
_pickle _pickle.c
_queue _queuemodule.c
_random _randommodule.c
_struct _struct.c
_zoneinfo _zoneinfo.c
array arraymodule.c
binascii binascii.c
cmath cmathmodule.c
math mathmodule.c
unicodedata unicodedata.c
pyexpat pyexpat.c
# other modules
fcntl fcntlmodule.c
grp grpmodule.c
mmap mmapmodule.c
resource resource.c
termios termios.c
EOF
msg "configuring python3..."
./configure \
--prefix="$PREFIX" \
LDFLAGS="-static -lbearssl -lpthread -lm" \
--disable-shared \
OPENSSL_LIBS="-lbearssl" \
--with-static-libpython \
--without-ensurepip || die "configure failed"
msg "building python3..."
make -j"$NPROC" OPENSSL_LIBS="-lbearssl" LDFLAGS="-static -lbearssl -lpthread -lm"
make DESTDIR="$PKG" install || die "make install failed"
}
. ${0%/*}/../../libsh/libdmake.sh
