gioser

sergio/takana

> Una distribución Linux construida con un laboratorio funcional y hermético en el > sótano, y una terminal mutable, clásica y anárquica en el piso de arriba — diseñada > desde el suelo para que una IA programadora entienda, modifique y co…

TOML 1572Shell 203Rust 109Markdown 993728 Sutichaykuna

⎇ 3786b4de9f64ef894661d9dde2ebca6d9dc4a299 recipes/helix.toml TOML · 83 siq'ikuna · 4.7 KB Ñawpa willay ch'uya

takana etapa 5a: los comentarios de las 741 recetas e852f4849 · Sergio ·

1# Importada de Alpine aports por `takana import-alpine` (Etapa G). PUNTO DE PARTIDA — pero
2# YA trae los parches de musl de Alpine (lo que un import de nix pierde). Pendiente: el
3# sha256 del tarball (el wrapper lo calcula), y adaptar build/install del shell de abuild.
4name    = "helix"
5version = "25.07.1"
6license = "MPL-2.0"
7
8[source]
9tarball = "https://github.com/helix-editor/helix/archive/25.07.1/helix-25.07.1.tar.gz"
10# FIXME sha256: el wrapper lo calcula (Alpine publica sha512). sha512 de Alpine:
11# sha512 = "a8f64782273d88cd43b1aeadf45d1fa6a913c9c0b77c1da716ffdc64ec02e89db1bfb2dde4333509c3ddb5733b8f5a450b44ca54d35f113c3c0f411c01f4ce8c"
12sha256  = "27c8bc3eba46bc7bab1e3629c6b28ff94882eeff17366b3ea69cd8ceffba7541"
13patches = ["fix-gotmpl-grammar-source.patch"]
14
15# GUETO gcc: helix trae tree-house-bindings (tree-sitter en C); cc-rs hace detección de familia
16# de compilador con `zig -E` y zig la rechaza. compiler="gcc" usa el musl gcc de Alpine.
17[build]
18compiler = "gcc"
19target   = "x86_64-linux-musl"
20link     = "static"
21flags    = []
22
23[build.phases]
24# Fase compile custom OBLIGATORIA (a diferencia de tuc, que la borró): helix necesita exportar dos
25# env vars antes de cargo, y el path default del lab no da dónde ponerlas. Pero entonces hay que
26# REPLICAR A MANO el setup estático del lab — mismo patrón que cargo-edit.
27#
28# POR QUÉ (2026-07-17, frente static-audit): el `cargo build --frozen --release` que traía la receta
29# importada de Alpine PISABA el comando del lab entero (`resolve_phases` sólo autogenera la fase si la
30# receta no la trae: `if out.compile.is_none()`). Al pisarlo se perdían las tres cosas que hacen
31# honesto al `link = "static"`: `+crt-static` (musl adentro), `relocation-model=static` (ET_EXEC en vez
32# de PIE) y `-C linker=.hammer-zig-cc` (el wrapper que sanea el triple `x86_64-alpine-linux-musl`, que
33# zig rechaza). hx salía PIE dinámico con `NEEDED: libgcc_s.so.1, libc.so`.
34#
35# Ese `libgcc_s` NO lo metían las tree-house-bindings ni ningún otro C: es el UNWINDER de la std de
36# rustc, que sin `+crt-static` se enlaza dinámico contra el libgcc_s de Alpine. El fix de C/C++
37# (`-static-libgcc`) acá no aplica. Prueba: tuc es Rust puro, sin una línea de C, y arrastraba el
38# MISMO libgcc_s por la misma causa.
39#
40# `crt-static` va TRAS `cargo rustc --` y NUNCA en RUSTFLAGS: en build nativo RUSTFLAGS alcanza también
41# a los proc-macros (un proc-macro es un dylib PIC) y rustc aborta con "cannot produce proc-macro".
42# Como `cargo rustc --` exige UN único target, se fija `--bin hx`. Y `-p helix-term` porque la raíz de
43# helix es un manifiesto VIRTUAL (workspace sin paquete propio): sin `-p`, cargo rustc corta con
44# "is a virtual manifest, but this command requires running against an actual package". helix-term es
45# quien declara `[[bin]] name = "hx"`.
46#
47# CC=gcc: el GUETO declarado arriba (cc-rs compila el tree-sitter en C y rechaza zig). El linker sigue
48# siendo zig-cc: los .o de gcc-musl y el Rust zig-musl son ABI-compatibles (ambos musl, mismo ELF).
49compile = '''
50# This path is embedded in the resulting binary so that helix can find system grammars
51# https://github.com/helix-editor/helix/blob/25.01.1/helix-loader/src/lib.rs#L64
52export HELIX_DEFAULT_RUNTIME=/usr/share/helix/runtime
53# Sandbox hermético: helix-term/build.rs intenta `git clone` de 245 gramáticas tree-sitter
54# (sin red ⇒ panic). Lo desactivamos; las gramáticas van por runtime/ (build post-install).
55export HELIX_DISABLE_AUTO_GRAMMAR_BUILD=1
56# de-Alpinizado: cargo-auditable no está en el lab de hammer; build plano (Etapa G)
57printf '%s\n' '#!/bin/sh' 'for a do' 'case "$a" in --target=*) a=--target=x86_64-linux-musl ;; esac' 'set -- "$@" "$a"' 'shift' 'done' 'exec zig cc -mcpu=baseline "$@"' > "$PWD/.hammer-zig-cc"
58chmod +x "$PWD/.hammer-zig-cc"
59RF="-C linker=$PWD/.hammer-zig-cc"
60rustc -vV | grep -q 'host: .*-alpine-' || RF="$RF -C link-self-contained=no"
61CC=gcc CXX=g++ AR=ar RUSTFLAGS="$RF" cargo rustc --release --locked --offline -p helix-term --bin hx -- -C target-feature=+crt-static -C relocation-model=static
62'''
63# de package() de Alpine (traducido $pkgdir→/out):
64install = '''
65_abuild_phase() {
66install -D -m755 target/release/hx -t "/out"/usr/bin/
67
68	install -D -m644 contrib/completion/hx.bash "/out"/usr/share/bash-completion/completions/hx
69	install -D -m644 contrib/completion/hx.fish "/out"/usr/share/fish/vendor_completions.d/hx.fish
70	install -D -m644 contrib/completion/hx.zsh "/out"/usr/share/zsh/site-functions/_hx
71
72	install -D -m644 contrib/Helix.desktop -t "/out"/usr/share/applications/
73	install -D -m644 logo.svg "/out"/usr/share/icons/hicolor/scalable/apps/Helix.svg
74
75	install -d -m755 "/out"/usr/share/"helix"
76
77	rm runtime/grammars/.gitkeep
78	rm runtime/themes/README.md
79	rm -rf runtime/grammars/sources
80	cp -r runtime "/out"/usr/share/"helix"
81}
82_abuild_phase
83'''