python
- Check if it builds with
--pack-dyn-relocs=relr - Check if we need to specify stack size in flags using
LDFLAGS="-Wl,-z,stack-size=$size"andCPPFLAGS="-DTHREAD_STACK_SIZE=$size"wheresize=0x200000(2 MB)
Package
Section titled “Package”- Check if we need
python -> python3.14andpython3 -> python3.14symlinks
Prepare
Section titled “Prepare”- As of
pythonversion3.14.2to work withlibresslversion4.2.1the following are needed:- patch
Modules/_ssl.caslibressldoes not declareX509_VERIFY_PARAM_get_hostflags - patch
Modules/_hashopenssl.caslibressllacksNID_id_scryptandEVP_MD_FLAG_XOF - pass
ac_cv_working_openssl_hashlib=yesto./configureaslibressldoes not find_hashlib
- patch
musldoes not ship withldconfigwhich is why a manual search patch from alpine forLib/ctypes/util.pyis requiredautoreconfbreaks build- Depends on system
expatandmpdecimalas bundled version is scheduled for removal in3.16(seeconfigure.ac) - Depends on
whichin$PATH - Depends on
libgcov.afromgccwhen--enable-optimizationsis enabled forpgo - No need to manually remove modules under
Modules/as bothexpatandmpdecimalsupport the--with-systemswitch andtest-modulescan be explicitly disabled
Configure
Section titled “Configure”universalsdkandframeworkaremacosspecific and are disabled by default onlinux(seeconfigure.acandMac/README.rst)wasm-dynamic-linkingand--enable-wasm-pthreadsarewasmspecific and are also disabled by default (seeconfigure.acandMac/README.rst)--enable-sharedprovides a sharedpythonlibrarylibpython.sowhich comes with a performance penalty likeperl’s-Duseshrplib--disable-gilenables free threading support forpythonby disabling thegilwhich improves multi-threaded performance and causes a slight overhead for single-threaded workloads (it also strictly relies on the bundledmimallocand notpymallocand renames/usr/lib/python3.14to/usr/lib/python3.14t) (seeconfigure.ac)profilingandpystatsare disabled by default (seeconfigure.ac)- Do not enable
optimizationsas it enablespgowhich runs tests (some of which may hang) and collects profiling data to improve performance and is disabled by default (it also requiresllvm-profdata) (seeconfigure.ac) - Do not enable
boltas it runs the post-link optimizerllvm-boltafterpgowhich requires profiling data from representative workloads and is disabled by default (seeconfigure.ac) - Explicitly enable
safetyas it adds-fstack-protector-strong,-Wtrampolines,-Wimplicit-fallthrough,-Werror=format-security,-Wbidi-chars=anyand-WalltoCFLAGSand is disabled by default (seeconfigure.ac) clangdoes not support-Wtrampolinesand-Wbidi-chars=anyas it does not implementgcc’s nested functions- Explicitly enable
slower-safetyas it adds-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3toCFLAGSand is disabled by default (seeconfigure.ac) (glaucus already has-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -isystem /usr/include/fortifyin the globalCPPFLAGS) experimental-jitis disabled by default and enabling it requiresgilwhich glaucus disables in favor of a free-threadedpython(see.configure.ac)loadable-sqlite-extensionsare disabled by default (seeconfigure.ac)- Explicitly enable
ipv6as the default is to check forAF_INET6whichmuslsupports (seeconfigure.ac) big-digitsforlongdefaults to30(seeInclude/pyport.handInclude/cpython/longintrepr.h)- Explicitly disable
test-modulesas they are enabled by default (seeconfigure.ac) --with-build-pythonis only required when cross-compilingpythonand is not relevant for a native build (seeconfigure.ac)- Explicitly specify
--with-pkg-config(or--with-pkg-config=yes) as it makes$PKG_CONFIGmandatory and./configurefails if$PKG_CONFIGis not found in path unlike the default behavior which only checks without failing (seeconfigure) --with-universal-archsismacosspecific and is meaningless onlinuxwhereuniversalsdkis disabled by default (seeconfigure.acandMac/README.rst)--with-framework-nameismacosspecific and is meaningless onlinuxwhereframeworkis disabled by default (seeconfigure.acandMac/README.rst)--with-app-store-complianceismacosspecific and is meaningless onlinux(seeconfigure.acandMac/README.rst)- Do not set executable suffix
--with-suffixand leave the default value which is empty onlinux(seeconfigure.ac) - Explicitly disable
static-libpythonas it is enabled by default (seeconfigure.ac) pydebugandassertionsare disabled by default (seeconfigure.ac)trace-refsare disabled by default and enabling them requiresgilwhich glaucus disables (seeconfigure.ac)ltois disabled by default so explicitly specify--with-lto=thinas glaucus defaults toclang(this also requiresllvm-ar) (seeconfigure.ac)strict-overflowis disabled by default, this means that-fno-strict-overflowis passed which prevents the compiler from performing this optimization that may cause code miscompilations (seeconfigure.ac)dsymutilismacosspecific and is disabled by default onlinux(seeconfigure.ac)address-sanitizer,memory-sanitizer,undefined-behavior-sanitizerandthread-sanitizerare fragile onmusland are disabled by default, they also disablepymalloc(when they are enabled) as it interferes with the sanitizers (seeconfigure.ac)hash-algorithmdefaults tosiphash13assiphash24is older andfnvis not as cryptographically strong (seeconfigure.ac)--without-tzpathand--with-tzpath=noare invalid so leave the default value (seeconfigure.ac)- Do not use
--without-libsas it does not link against any additional libs by default (seeconfigure.ac) - Explicitly use
--with-system-expatas the bundled version is used by default (seeconfigure.ac) --with-system-libmpdecis used by default as the bundled version is scheduled for removal in3.16(seeconfigure.ac)--with-decimal-contextvardefaults tocoroutine-localrather thanthread-localcontext which is better for modernpythonandasynccode (seeconfigure.ac)--without-dbmliborderand--with-dbmliborder=noare invalid so leave the default valuegdbm:ndbm:bdbas it only controls the detection order for the optionaldbm.ndbmmodule and does not makepythondepend onbdb,gdbm,ndbm(seeconfigure.ac)- Explicitly disable
doc-stringsas they are enabled by default (seeconfigure.ac) - Force enable the bundled
mimallocas we already disable thegiland the default is to check forstdatomic.h(seeconfigure.ac) - Explicitly disable
pymallocas it requires thegilwhich we disable (seeconfigure.ac) c-locale-coercionis enabled by default and it preventspythonfrom “misbehaving” on aUTF-8byte (seeconfigure.ac)valgrindanddtraceare disabled by default (seeconfigure.ac)- No need to specify
--with-libmas it defaults to-lm(seeconfigure.ac) - No need to specify
--with-libcas the default value is empty so leave it (seeconfigure.ac) - No need to specify
--with-platlibdiras it defaults toliband glaucus does not support or providelib64(seeconfigure.ac) - No need to specify
--with-wheel-pkg-diras it is empty by default and glaucus already disablesensurepip(seeconfigure.ac) - Explicitly disable the
readlinemodule using--without-readlineas it defaults toreadlineand thereplnow relies onpyreplas of3.13(this will cause issues whenimport readlineis used, but thereplstill works, and even thenpythonis only provided to satisfy some build scripts) (seeconfigure.ac) - Explicitly specify
--with-computed-gotosas the default is to check for support whichclanghas (seeconfigure.ac) - Explicitly disable
computed-gotosaspythonchecks then enables it by default (seeconfigure.ac) - Explicitly enable the
tail-callinterpreter aspythondisables it by default (seeconfigure.ac) clangsupports both the oldercomputed-gotosinterpreter and the relatively newertail-callinterpreter- Prefer the relatively newer
tail-callinterpreter over the oldercomputed-gotosinterpreter - The
tail-callinterpreter benefits greatly whenclangis used and with--enable-optimizationswhich we currently disable - Explicitly disable
remote-debugas it is enabled by default (seeconfigure.ac) - Explicitly disable
ensurepipas the default is toupgradeusing bundledpipaftermake install(this does not preventensurepipfrom being installed so we’ll have to manually remove it) (seeconfigure.ac) - Do not set
--with-opensslas glaucus already installslibresslsystem-wide (which is compatible withopensslpaths) --with-openssl-rpathis disabled by default (seeconfigure.ac)- Only set
--with-openssl=$customDir/usrand--with-openssl-rpath=autowhenlibresslis installed inside$customDir(e.g. when building on a host machine with a differentssllibrary that we want to avoid, may also requireLDFLAGS=-L$customDir/usr/lib) - Explicitly specify
--with-ssl-default-suites=opensslas it defaults topythonwhich is a curated set of strict selections and while that is generally better than untouched defaults on systems that use regularopenssl, it is not necessarily the better option on glaucus as we uselibressland trust its defaults (seeconfigure.ac) - No need to specify
--with-builtin-hashlib-hashesas it defaults tomd5,sha1,sha2,sha3,blake2which is good (seeconfigure.ac) --with-system-ffiwas removed (seeMisc/HISTORYandMisc/NEWS)
- Do not build
pythonout-of-tree as it attempts to clean the directory./buildand errors out doing so - No need to specify
CFLAGS_NODIST,CXXFLAGS_NODISTandLDFLAGS_NODISTas build system automatically picks up global$CFLAGS,$CXXFLAGSand$LDFLAGS
Package
Section titled “Package”- All
installtargets usealltarget as synchronization point to prevent race conditions withpgobuilds (seeMakefile.pre.in) installapps,installunixtools,altinstallunixtoolsandinstallextrastargets aremacosspecificcommoninstalltarget includesaltbininstall,libinstall,inclinstall,libainstall,sharedinstallandaltmaninstallaltinstallcallscommoninstallbininstallalso callscommoninstall- Either manually strip
/usr/lib/libpython3.14t.so.1.0using--strip-unneeded(asSTRIPFLAGS=-sonly strips binaries) or rely on--strip-allin our global$LDFLAGSto do so (seeMakefile.pre.in) - We manually remove
ensurepip/,idlelib/,pydoc*,tkinter/andturtle*as we have no use forguiandidepackages - No need to manually remove
readme,changelog,todoornewsfiles as they are mostly under$dir/usr/lib/python3.14t/idlelib/which we explicitly remove - No need to provide an
EXTERNALLY-MANAGEDmarker file as we disableensurepippostmake installthen manually remove the module
References
Section titled “References”Offline
Section titled “Offline”- configure
- configure.ac
- Makefile.pre.in
- Misc/python-config.sh.in
- Modules/config.c.in
- Modules/Setup
- Modules/Setup.bootstrap.in
- pyconfig.h.in
- README.rst
Online
Section titled “Online”- https://blog.nelhage.com/post/cpython-tail-call/
- https://docs.python.org/3/howto/free-threading-python.html
- https://docs.python.org/3/using/configure.html
- https://packaging.python.org/en/latest/specifications/externally-managed-environments/
- https://peps.python.org/pep-0456/
- https://peps.python.org/pep-0644/
- https://peps.python.org/pep-0668/
- https://rfc.archlinux.page/0010-adopt-pep517-tooling/
- https://rfc.archlinux.page/0020-sources-for-python-packaging/