#!/bin/bash # Build script for CPython 3.13. # # Links the OS-provided OpenSSL 3.5 (base, in /usr) — so _ssl/_hashlib build # stock with no LibreSSL patches, and pip + HTTPS work out of the box. zlib # and libffi also come from the base system. set -e cd "$SRCDIR" # Hammerhead is illumos with a renamed sysname. CPython's configure derives its # platform logic (LDSHARED, Py_SUNOS_VERSION, dynamic loading, ...) from # `uname -s`, which returns "Hammerhead" — so NONE of the SunOS/Solaris branches # fire. Symptoms: LDSHARED defaults to bare `ld` (extension .so links fail with # "cannot find entry symbol _start" + undefined Py symbols), and socketmodule.c # re-declares sethostname() (Py_SUNOS_VERSION undefined, i.e. <= 510), clashing # with illumos . Map Hammerhead -> SunOS in configure so the correct # SunOS/5.x + GCC branches activate: LDSHARED becomes '$(CC) -shared' (GNU-ld # friendly) and Py_SUNOS_VERSION becomes 511. Same approach as the other ports' # hammerhead-solaris-compat patches; done as a string-keyed sed so it survives # Python patch-version bumps. sed -i 's/ac_sys_system=`uname -s`/&; if test "$ac_sys_system" = Hammerhead; then ac_sys_system=SunOS; fi/' configure export CFLAGS="${CFLAGS:--O2} -fPIC" export CPPFLAGS="-I$PREFIX/include" # rpath: libpython3.13.so + any zport deps live at $PREFIX/lib; the base # OpenSSL/ffi/z live at /usr/lib. Bake both so nothing needs LD_LIBRARY_PATH. export LDFLAGS="-L$PREFIX/lib -R$PREFIX/lib -R/usr/lib" # illumos: the _socket module calls hstrerror(), which lives in libresolv # (not libc/libnsl as on Linux). Without this _socket fails to import with # "symbol hstrerror: referenced symbol not found". export LIBS="-lresolv" ./configure \ --build=$BUILD_TRIPLE \ --host=$BUILD_TRIPLE \ --prefix=$PREFIX \ --enable-shared \ --with-system-ffi \ --with-openssl=/usr \ --with-ensurepip=install gmake -j${JOBS:-1} gmake install DESTDIR="$PKGDIR" # convenience symlinks (setup.py install names the binary python3.13) ln -sf python3.13 "$PKGDIR$PREFIX/bin/python3" ln -sf python3 "$PKGDIR$PREFIX/bin/python" ln -sf pip3.13 "$PKGDIR$PREFIX/bin/pip3" 2>/dev/null || true ln -sf pip3 "$PKGDIR$PREFIX/bin/pip" 2>/dev/null || true # Python - CPython interpreter (links the OS-provided OpenSSL 3.5) # https://www.python.org/ [package] name = "python" version = "3.13.2" release = 1 description = "Python programming language interpreter (CPython)" url = "https://www.python.org/" license = "PSF-2.0" maintainer = "Chris Tusa " arch = "x86_64" [dependencies] # openssl, zlib, libffi are provided by the base system (/usr/lib). runtime = [] build = [] [[source]] file = "Python-3.13.2.tar.xz" urls = ["https://www.python.org/ftp/python/3.13.2/Python-3.13.2.tar.xz"] checksum = "d984bcc57cd67caab26f7def42e523b1c015bbc5dc07836cf4f0b63fa159eb56" extract = true [build] parallel = true