#!/bin/mkpkg # description: High-level scripting language # url: https://www.python.org/ name=python3 version=3.14.7 release=2 _basever=3.14 depends=(bzip2 expat libffi mpdecimal libressl readline sqlite xz zlib zstd) makedeps=(pkgconf) source=( https://www.python.org/ftp/python/$version/Python-$version.tar.xz musl-find_library.patch ) sha256sums=( "3b48dac8fb59f62eaa67ac83c1eb12bda1b7a08406dd286e252c11a66be27f81" "c5d0a7f7639a5632231bb9cd8896b1db1dea9cbd97d4ec67caaadd200ababda4" ) patch() { cd Python-$version # musl ctypes fix patch -p1 -i "$SRC/musl-find_library.patch" # LibreSSL compat: X509_VERIFY_PARAM_get_hostflags not implemented sed -i 's/host_flags = X509_VERIFY_PARAM_get_hostflags(ssl_verification_params);/host_flags = 0;/' Modules/_ssl.c # Remove bundled libraries rm -rf Modules/expat } build() { cd Python-$version # musl thread stack size export CFLAGS="$CFLAGS -DTHREAD_STACK_SIZE=0x200000" ./configure \ --prefix=/usr \ --enable-shared \ --with-dbmliborder=gdbm:ndbm \ --with-system-expat \ --with-system-libmpdec \ --without-ensurepip \ --without-readline \ --disable-test-modules \ --disable-idle3 \ --disable-tk \ --without-pymalloc \ ac_cv_working_tzset=yes make make DESTDIR="$PKG" install # # Post-install cleanup # # Canonical symlinks ln -sf python${_basever} "$PKG/usr/bin/python3" ln -sf python3 "$PKG/usr/bin/python" ln -sf python${_basever}-config "$PKG/usr/bin/python3-config" ln -sf python3-config "$PKG/usr/bin/python-config" # Remove test suite rm -rf \ "$PKG/usr/lib/python${_basever}/test" \ "$PKG/usr/lib/python${_basever}/lib2to3/tests" # Remove unused stdlib components (no configure options available) rm -rf \ "$PKG/usr/bin/idle"* \ "$PKG/usr/lib/python${_basever}/idlelib" \ "$PKG/usr/lib/python${_basever}/tkinter" \ "$PKG/usr/lib/python${_basever}/turtle.py" \ "$PKG/usr/lib/python${_basever}/turtledemo" \ # "$PKG/usr/lib/python${_basever}/unittest" \ "$PKG/usr/lib/python${_basever}/pydoc_data" # Remove deprecated tools rm -f "$PKG/usr/bin/2to3"* # Remove platform-specific modules (we're on Linux) rm -f "$PKG/usr/lib/python${_basever}/_aix_support.py" rm -f "$PKG/usr/lib/python${_basever}/_android_support.py" rm -f "$PKG/usr/lib/python${_basever}/_ios_support.py" rm -f "$PKG/usr/lib/python${_basever}/_osx_support.py" rm -f "$PKG/usr/lib/python${_basever}/venv/scripts/common/Activate.ps1" rm -rf "$PKG/usr/lib/python${_basever}/ctypes/macholib" find "$PKG/usr/lib/python${_basever}/asyncio" -name 'windows_*.py' -delete 2>/dev/null || true find "$PKG/usr/lib/python${_basever}/multiprocessing" -name '*win32*' -delete 2>/dev/null || true # Remove libtool junk find "$PKG" -name "*.la" -delete # # Bytecode compilation: compile with max optimization, then remove sources # # Compile all .py to .pyc with -OO (strips docstrings and asserts) # -b puts .pyc alongside .py instead of __pycache__/ #python3 -OO -m compileall -b -q "$PKG/usr/lib/python${_basever}" # Use the just-built python, not system python LD_LIBRARY_PATH="$PWD" ./python -OO -m compileall -b -q "$PKG/usr/lib/python${_basever}" # Remove all .py source files (keep only .pyc bytecode) find "$PKG/usr/lib/python${_basever}" -name '*.py' -delete # Clean up any __pycache__ directories (should be empty now) find "$PKG/usr/lib/python${_basever}" \ -type d -name "__pycache__" -prune -exec rm -rf {} + } signify() { untrusted comment: public key RWTZ9IduCSQ/mL8337TEUinPwT92xFEUpD92hkS7IxcOnzTt9QdpohT3 } # vim: filetype=sh