Etapa G: prerequisitos de Mesa — mako/markupsafe + PIC en libs base C

Mesa necesita el codegen Python `mako` (dispatch GL/GLES, formatos) y éste importa
`markupsafe` a nivel de módulo. Ambos como módulos Python puros (igual que meson):
se copia el paquete a site-packages de python3.12, sin pip/wheel. markupsafe cae a
su backend `_native` (sin compilar la extensión C `_speedups`). Verificado import +
render de Template.

PIC en libs base C (zlib, zstd, expat; libffi ya en el commit anterior): el .a estático
lleva objetos PIC para poder enlazarse DENTRO de bibliotecas compartidas — Mesa liga
libz/libzstd/libexpat/libffi en sus .so y sin PIC falla con
«R_X86_64_PC32 ... recompile with -fPIC». PIC es superset (sigue sirviendo para enlace
estático de exes/toolchain); la invalidación de caché de los dependientes es perezosa y
produce artefactos equivalentes. Mismo patrón aplicado y verificado con libffi→wayland.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-27 01:05:25 -04:00
co-authored by Claude Opus 4.8
parent 1ad71de885
commit 0b3646d204
5 changed files with 64 additions and 3 deletions
+3 -1
View File
@@ -14,6 +14,8 @@ link = "static"
flags = []
[build.phases]
configure = './configure --build=$CBUILD --host=$CHOST --prefix=/usr --disable-shared --enable-static --without-docbook'
# --with-pic: el .a estático lleva objetos PIC ⇒ enlazable dentro de .so (Mesa liga libexpat en
# libgallium/xmlconfig; sin PIC: «R_X86_64_PC32 ... recompile with -fPIC»). PIC es superset.
configure = './configure --build=$CBUILD --host=$CHOST --prefix=/usr --disable-shared --enable-static --with-pic --without-docbook'
compile = 'make'
install = 'make DESTDIR=/out install'
+26
View File
@@ -0,0 +1,26 @@
# Mako 1.3.12 — motor de plantillas; Mesa lo usa para codegen (dispatch GL/GLES, formatos).
# Python PURO (igual que `meson`): se copia el paquete `mako/` a site-packages, sin pip ni wheel.
# `mako/filters.py` importa `markupsafe` a nivel de módulo ⇒ markupsafe es dep de runtime.
name = "mako"
version = "1.3.12"
[source]
tarball = "https://files.pythonhosted.org/packages/00/62/791b31e69ae182791ec67f04850f2f062716bbd205483d63a215f3e062d3/mako-1.3.12.tar.gz"
sha256 = "9f778e93289bd410bb35daadeb4fc66d95a746f0b75777b942088b7fd7af550a"
[build]
compiler = "zig-cc"
target = "x86_64-linux-musl"
link = "static"
[build.phases]
compile = "true"
install = '''
set -e
SP=/out/usr/lib/python3.12/site-packages
mkdir -p "$SP"
cp -r mako "$SP/mako"
'''
[deps]
runtime = ["python3", "markupsafe"]
+29
View File
@@ -0,0 +1,29 @@
# markupsafe 3.0.3 — dep de Mako (que a su vez es codegen de Mesa). Trae un speedup en C
# (`_speedups`) PERO `__init__` cae a `_native` (Python puro) si no está compilado ⇒ lo instalamos
# como módulo Python puro (sin compilar la extensión), igual que `meson`. site-packages de
# python3.12. python3 es dep de runtime.
name = "markupsafe"
version = "3.0.3"
[source]
tarball = "https://files.pythonhosted.org/packages/7e/99/7690b6d4034fffd95959cbe0c02de8deb3098cc577c67bb6a24fe5d7caa7/markupsafe-3.0.3.tar.gz"
sha256 = "722695808f4b6457b320fdc131280796bdceb04ab50fe1795cd540799ebe1698"
[build]
compiler = "zig-cc"
target = "x86_64-linux-musl"
link = "static"
[build.phases]
compile = "true"
install = '''
set -e
SP=/out/usr/lib/python3.12/site-packages
mkdir -p "$SP"
cp -r src/markupsafe "$SP/markupsafe"
# sin la extensión C: borrá fuentes que no sirven en runtime (cae a _native).
rm -f "$SP/markupsafe/_speedups.c" "$SP/markupsafe/_speedups.pyi"
'''
[deps]
runtime = ["python3"]
+3 -1
View File
@@ -27,6 +27,8 @@ link = "static"
[build.phases]
# --static: sólo libz.a (sin .so; mrustc/rustc enlazan estático). --prefix=/usr: zlib.h→/usr/include,
# libz.a→/usr/lib, zlib.pc→/usr/lib/pkgconfig (layout que materialize_build_deps overlaya en /usr).
configure = "./configure --prefix=/usr --static"
# CFLAGS=-fPIC: el libz.a lleva objetos PIC ⇒ enlazable dentro de .so (Mesa liga libz en sus
# bibliotecas compartidas; sin PIC: «R_X86_64_PC32 ... recompile with -fPIC»). PIC es superset.
configure = "CFLAGS=-fPIC ./configure --prefix=/usr --static"
compile = "make -j\"$(nproc)\""
install = "make install DESTDIR=/out"
+3 -1
View File
@@ -11,5 +11,7 @@ target = "x86_64-linux-musl"
link = "static"
flags = []
[build.phases]
compile = 'make -C lib libzstd.a'
# CFLAGS con -fPIC: el libzstd.a lleva objetos PIC ⇒ enlazable dentro de .so (Mesa liga libzstd en
# sus bibliotecas compartidas; sin PIC: «R_X86_64_PC32 ... recompile with -fPIC»). PIC es superset.
compile = 'make -C lib libzstd.a CFLAGS="-O3 -fPIC"'
install = 'make -C lib install PREFIX=/usr DESTDIR=/out'