Los 17 que construyen de la tanda base-system-1 pasan de recipes/incoming-clib a recipes/ canónicas y al índice firmado (dist/repo, artefacto local): bash git sudo doas util-linux rsync sed tzdata dbus dhcpcd iproute2 iputils dosfstools e2fsprogs parted vim ca-certificates. Sólo foot queda staged (stack Wayland, diferido). Cierra el grueso del hueco 'userland foundational' hacia la distro completa: shell real + VCS + privilegios + red + disco + TLS.
140 lines
5.3 KiB
TOML
140 lines
5.3 KiB
TOML
# Importada de Alpine aports por `hammer import-alpine` (Etapa G). PUNTO DE PARTIDA — pero
|
|
# YA trae los parches de musl de Alpine (lo que un import de nix pierde). Pendiente: el
|
|
# sha256 del tarball (el wrapper lo calcula), y adaptar build/install del shell de abuild.
|
|
name = "parted"
|
|
version = "3.7"
|
|
|
|
[source]
|
|
tarball = "https://ftp.gnu.org/gnu/parted/parted-3.7.tar.xz"
|
|
# FIXME sha256: el wrapper lo calcula (Alpine publica sha512). sha512 de Alpine:
|
|
# sha512 = "941afeb68edb45c33fb797f4c320ed1aa1de2e8b35defa5d742aa6894618e6729a1440e3ee0824e8710bc58eb42b85d77f28ba083d92d4ea3f3f65f37c8307b0"
|
|
sha256 = "008de57561a4f3c25a0648e66ed11e7b30be493889b64334a6d70f2c1951ef7b"
|
|
patches = ["fix-includes.patch", "fix-libintl-header-s390x.patch", "parted-include-sysmacros.patch", "fix-truncate-tests.patch", "make-tests.patch", "skip-duplicate-bsd-test-on-s390x.patch"]
|
|
|
|
[build]
|
|
compiler = "zig-cc"
|
|
target = "x86_64-linux-musl"
|
|
link = "static"
|
|
flags = []
|
|
|
|
[build.phases]
|
|
# fase configure EXPLÍCITA (gotcha rsync): sin ella hammer autogenera su propio ./configure
|
|
# e ignora estos flags.
|
|
#
|
|
# libuuid: parted la EXIGE (uuid_generate para los GUID de particiones GPT). En el catálogo
|
|
# la proveería util-linux, pero esa receta está rota (configure "nonexistent directory") y
|
|
# e2fsprogs la trae deshabilitada — y aquí sólo se puede tocar parted.toml. Solución
|
|
# autocontenida: horneamos una libuuid mínima pero FUNCIONAL (uuid v4 desde /dev/urandom) en
|
|
# /src (persiste entre fases; /tmp es tmpfs fresco por fase) y la apuntamos por CPPFLAGS/
|
|
# LDFLAGS, que autotools graba en el Makefile para la fase compile. Cubre el API que parted
|
|
# usa: uuid_generate / uuid_is_null / uuid_parse / uuid_unparse_lower.
|
|
configure = '''
|
|
set -e
|
|
UD=/src/.hammer-uuid
|
|
mkdir -p "$UD/include/uuid" "$UD/lib"
|
|
cat > "$UD/include/uuid/uuid.h" <<'HEOF'
|
|
#ifndef _HAMMER_UUID_UUID_H
|
|
#define _HAMMER_UUID_UUID_H
|
|
#define UUID_STR_LEN 37
|
|
typedef unsigned char uuid_t[16];
|
|
void uuid_generate(uuid_t out);
|
|
void uuid_generate_random(uuid_t out);
|
|
void uuid_generate_time(uuid_t out);
|
|
int uuid_is_null(const uuid_t uu);
|
|
int uuid_parse(const char *in, uuid_t uu);
|
|
void uuid_unparse(const uuid_t uu, char *out);
|
|
void uuid_unparse_lower(const uuid_t uu, char *out);
|
|
void uuid_unparse_upper(const uuid_t uu, char *out);
|
|
void uuid_clear(uuid_t uu);
|
|
void uuid_copy(uuid_t dst, const uuid_t src);
|
|
int uuid_compare(const uuid_t a, const uuid_t b);
|
|
#endif
|
|
HEOF
|
|
cat > "$UD/uuid.c" <<'CEOF'
|
|
#include <uuid/uuid.h>
|
|
#include <fcntl.h>
|
|
#include <unistd.h>
|
|
#include <string.h>
|
|
|
|
void uuid_generate_random(uuid_t out) {
|
|
unsigned long n = 0;
|
|
int fd = open("/dev/urandom", O_RDONLY);
|
|
if (fd >= 0) {
|
|
while (n < 16) {
|
|
long r = read(fd, out + n, 16 - n);
|
|
if (r <= 0) break;
|
|
n += (unsigned long)r;
|
|
}
|
|
close(fd);
|
|
}
|
|
for (; n < 16; n++) out[n] = (unsigned char)(n * 37 + 11);
|
|
out[6] = (out[6] & 0x0F) | 0x40; /* version 4 */
|
|
out[8] = (out[8] & 0x3F) | 0x80; /* variant */
|
|
}
|
|
void uuid_generate(uuid_t out) { uuid_generate_random(out); }
|
|
void uuid_generate_time(uuid_t out) { uuid_generate_random(out); }
|
|
int uuid_is_null(const uuid_t uu) { for (int i=0;i<16;i++) if (uu[i]) return 0; return 1; }
|
|
void uuid_clear(uuid_t uu) { memset(uu, 0, 16); }
|
|
void uuid_copy(uuid_t d, const uuid_t s) { memcpy(d, s, 16); }
|
|
int uuid_compare(const uuid_t a, const uuid_t b) { return memcmp(a, b, 16); }
|
|
|
|
static int hv(char c) {
|
|
if (c>='0'&&c<='9') return c-'0';
|
|
if (c>='a'&&c<='f') return c-'a'+10;
|
|
if (c>='A'&&c<='F') return c-'A'+10;
|
|
return -1;
|
|
}
|
|
int uuid_parse(const char *in, uuid_t uu) {
|
|
int i=0,o=0;
|
|
while (in[i] && o<16) {
|
|
if (in[i]=='-') { i++; continue; }
|
|
int hi=hv(in[i]), lo=hv(in[i+1]);
|
|
if (hi<0||lo<0) return -1;
|
|
uu[o++]=(unsigned char)((hi<<4)|lo);
|
|
i+=2;
|
|
}
|
|
return o==16 ? 0 : -1;
|
|
}
|
|
static void up(const uuid_t uu, char *out, const char *hex) {
|
|
char *p=out;
|
|
for (int i=0;i<16;i++) {
|
|
if (i==4||i==6||i==8||i==10) *p++='-';
|
|
*p++=hex[(uu[i]>>4)&0xF];
|
|
*p++=hex[uu[i]&0xF];
|
|
}
|
|
*p='\0';
|
|
}
|
|
void uuid_unparse_lower(const uuid_t uu, char *out) { up(uu,out,"0123456789abcdef"); }
|
|
void uuid_unparse_upper(const uuid_t uu, char *out) { up(uu,out,"0123456789ABCDEF"); }
|
|
void uuid_unparse(const uuid_t uu, char *out) { uuid_unparse_lower(uu,out); }
|
|
CEOF
|
|
$CC -O2 -I"$UD/include" -c "$UD/uuid.c" -o "$UD/uuid.o"
|
|
$AR rcs "$UD/lib/libuuid.a" "$UD/uuid.o"
|
|
export CPPFLAGS="-I$UD/include $CPPFLAGS"
|
|
export LDFLAGS="-L$UD/lib $LDFLAGS"
|
|
./configure \
|
|
--build=$CBUILD \
|
|
--host=$CHOST \
|
|
--prefix=/usr \
|
|
--disable-device-mapper \
|
|
--disable-nls \
|
|
--disable-shared \
|
|
--enable-static \
|
|
--without-readline
|
|
'''
|
|
# -all-static: libtool ignora el -static del lab para el ejecutable final (queda musl-dinámico
|
|
# y no corre fuera del sandbox). Se inyecta SÓLO acá (en configure rompería los link-tests, que
|
|
# no pasan por libtool). Reponemos el -L de la libuuid horneada porque este override pisa LDFLAGS.
|
|
compile = '''
|
|
make LDFLAGS="-all-static -L/src/.hammer-uuid/lib"
|
|
'''
|
|
# de package() de Alpine (traducido $pkgdir→/out):
|
|
install = '''
|
|
make DESTDIR="/out" install
|
|
'''
|
|
|
|
# lvm2 (device-mapper) ausente y opcional → --disable-device-mapper. bash/ncurses/readline
|
|
# innecesarios al binario estático. libuuid horneada en la fase configure (ver arriba).
|
|
[deps]
|
|
build = ["linux-headers"]
|