From 74baaf3130c3c430855fffb938f90d479ae4b410 Mon Sep 17 00:00:00 2001 From: sergio Date: Sun, 21 Jun 2026 10:52:45 -0400 Subject: [PATCH] =?UTF-8?q?Etapa=20G:=20oniguruma=20+=20jq=20destrabados?= =?UTF-8?q?=20=E2=80=94=20lib=20de=20regex=20al=20corpus=20(51=E2=86=9253)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit jq estaba bloqueado por su lib de regex faltante. Importo oniguruma de Alpine (lib build-dep como zlib/libcap: el lab apila libonig.a + oniguruma.pc en /usr) y cableo jq con deps.build=[oniguruma]. Fricciones C resueltas, documentadas en las recetas: - oniguruma: el archive/ de GitHub no trae configure (Alpine corre autoreconf, pide autoconf/automake/libtool ausentes del corpus); uso el tarball de RELEASE que sí trae configure pregenerado -> sin autoreconf. - jq: gueto gcc (zig-cc lo miscompila -> segfault, igual que file). Estático vía libtool requiere -all-static en make Y en make install (libtool relinkea al instalar y descartaba el flag -> binario dinámico). Ahora jq sale static-pie. - el import emitia sed como build-dep; es herramienta del sandbox, no lib -> la quito. Ambos construyen+corren: jq-1.8.1 static-pie evalua JSON. Corpus 51->53. --- recipes/jq.toml | 44 +++++++++++++++++++++++++++++++++++++ recipes/oniguruma.toml | 30 +++++++++++++++++++++++++ recipes/test-portable.patch | 28 +++++++++++++++++++++++ 3 files changed, 102 insertions(+) create mode 100644 recipes/jq.toml create mode 100644 recipes/oniguruma.toml create mode 100644 recipes/test-portable.patch diff --git a/recipes/jq.toml b/recipes/jq.toml new file mode 100644 index 00000000..260fcf4e --- /dev/null +++ b/recipes/jq.toml @@ -0,0 +1,44 @@ +# jq 1.8.1 — procesador de JSON. Etapa G, tier-2 C. Antes BLOQUEADO por falta de su lib de regex; +# ahora destrabado por `recipes/oniguruma.toml` en el corpus. +# +# Importada de Alpine aports. Ajustes sobre el import crudo: +# - deps.build = ["oniguruma"] SOLAMENTE. El import emitió `["oniguruma", "sed"]` desde el +# makedepends de Alpine, pero `sed` es una herramienta build-time que el sandbox del lab YA trae +# (busybox/coreutils) — no una lib a materializar; meterla como dep buscaría recipes/sed.toml (no +# existe) y abortaría. oniguruma SÍ es lib: el lab apila libonig.a + oniguruma.pc en /usr y el +# configure de jq la halla por pkgconf. +# - El release `jq-1.8.1.tar.gz` ya trae `configure` (dist propio de jqlang) ⇒ sin autoreconf. +# - test-portable.patch: parche de Alpine para que el suite de tests sea portable (musl). +# +# $CBUILD/$CHOST los provee el lab (Fase 3). link=static ⇒ el lab exporta LDFLAGS=-static. +# +# GUETO gcc (igual que file/gzip): con zig-cc jq salía ELF DINÁMICO y SEGFAULTEABA (zig-cc lo +# miscompila, mismo patrón que `file`). Con gcc CORRE. +# +# ESTÁTICO vía libtool: jq enlaza su binario CON LIBTOOL, que ignora el `LDFLAGS=-static` del lab +# (lo lee como "usá libs estáticas de libtool", no como flag al linker) ⇒ salía dinámico-musl. El +# flag de libtool para binario 100% estático es `-all-static`, pero NO se puede poner en LDFLAGS del +# configure (gcc no lo entiende ⇒ los test-compiles de configure fallarían). Solución: pasarlo SOLO +# al `make` final (`make LDFLAGS=-all-static`) Y al `make install` (libtool RELINKEA el binario al +# instalar; sin el flag ahí, el relink lo devolvía a dinámico). Resultado: jq ELF estático, como gzip/tar. + +name = "jq" +version = "1.8.1" + +[source] +tarball = "https://github.com/jqlang/jq/releases/download/jq-1.8.1/jq-1.8.1.tar.gz" +sha256 = "2be64e7129cecb11d5906290eba10af694fb9e3e7f9fc208a311dc33ca837eb0" +patches = ["test-portable.patch"] + +[build] +compiler = "gcc" +target = "x86_64-linux-musl" +link = "static" + +[build.phases] +configure = "./configure --build=$CBUILD --host=$CHOST --prefix=/usr --disable-docs --disable-shared --enable-static" +compile = "make LDFLAGS=-all-static -j\"$(nproc)\"" +install = "make DESTDIR=/out prefix=/usr LDFLAGS=-all-static install" + +[deps] +build = ["oniguruma"] diff --git a/recipes/oniguruma.toml b/recipes/oniguruma.toml new file mode 100644 index 00000000..6c6440cb --- /dev/null +++ b/recipes/oniguruma.toml @@ -0,0 +1,30 @@ +# oniguruma 6.9.10 — librería de regex (motor de `jq`). Etapa G, lib build-dep (tier-2 C). +# +# Importada de Alpine aports (trae el trabajo de portabilidad a musl), pero con DOS ajustes sobre el +# import crudo: +# 1. FUENTE = el tarball de RELEASE (`onig-6.9.10.tar.gz`), no el `archive/v6.9.10.tar.gz` de GitHub. +# El archive auto-generado NO trae `configure` ⇒ Alpine corre `autoreconf -vfi` en prepare() +# (pide autoconf/automake/libtool, que NO están en el corpus). El release SÍ trae `configure` +# pregenerado (es `make dist`) ⇒ saltamos autoreconf entero. sha256 oficial del asset. +# 2. Lib, no programa: la consumen otras recetas vía `deps.build = ["oniguruma"]`; el lab apila su +# árbol /out como capa overlay del sandbox y deja libonig.a + oniguruma.h + oniguruma.pc en /usr +# (igual que zlib/libcap). `--disable-shared` ⇒ sólo el .a estático (el lab enlaza estático). +# +# $CBUILD/$CHOST los provee el lab (Etapa G Fase 3) con el triple nativo saneado (build==host ⇒ nativo). + +name = "oniguruma" +version = "6.9.10" + +[source] +tarball = "https://github.com/kkos/oniguruma/releases/download/v6.9.10/onig-6.9.10.tar.gz" +sha256 = "2a5cfc5ae259e4e97f86b68dfffc152cdaffe94e2060b770cb827238d769fc05" + +[build] +compiler = "zig-cc" +target = "x86_64-linux-musl" +link = "static" + +[build.phases] +configure = "./configure --build=$CBUILD --host=$CHOST --prefix=/usr --disable-shared --enable-posix-api" +compile = "make -j\"$(nproc)\"" +install = "make DESTDIR=/out install" diff --git a/recipes/test-portable.patch b/recipes/test-portable.patch new file mode 100644 index 00000000..f95c5a3d --- /dev/null +++ b/recipes/test-portable.patch @@ -0,0 +1,28 @@ +Patch-Source: https://github.com/jqlang/jq/pull/3365 +--- +From 63e9449a8142ce30c83fcd7e9396e5de9843774e Mon Sep 17 00:00:00 2001 +From: Alyssa Ross +Date: Thu, 3 Jul 2025 11:00:13 +0200 +Subject: [PATCH] jq.test: drop non-portable %F test + +%F is a non-portable GNU extension, not supported by all strptime +implementations (for example musl's). +--- + tests/jq.test | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/tests/jq.test b/tests/jq.test +index 4ecf72ffdc..6bfb6f853c 100644 +--- a/tests/jq.test ++++ b/tests/jq.test +@@ -1848,10 +1848,6 @@ try ["OK", strflocaltime({})] catch ["KO", .] + "2015-03-05T23:51:47Z" + [[2015,2,5,23,51,47,4,63],1425599507] + +-[strptime("%FT%T")|(.,mktime)] +-"2025-06-07T08:09:10" +-[[2025,5,7,8,9,10,6,157],1749283750] +- + # Check day-of-week and day of year computations + # (should trip an assert if this fails) + last(range(365 * 67)|("1970-03-01T01:02:03Z"|strptime("%Y-%m-%dT%H:%M:%SZ")|mktime) + (86400 * .)|strftime("%Y-%m-%dT%H:%M:%SZ")|strptime("%Y-%m-%dT%H:%M:%SZ"))