Etapa G: libjpeg-turbo/zstd (cmake static) + lz4 (make static) — leaves imagen/compresión

This commit is contained in:
2026-06-30 04:40:07 -04:00
parent 5e68c03d94
commit c500470dbe
3 changed files with 16 additions and 155 deletions
+5 -61
View File
@@ -1,72 +1,16 @@
# 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.
# libjpeg-turbo 3.1.3 — JPEG (loader de imágenes). cmake static, SIMD off (sin nasm).
name = "libjpeg-turbo"
version = "3.1.3"
[source]
tarball = "https://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/3.1.3/libjpeg-turbo-3.1.3.tar.gz"
# FIXME sha256: el wrapper lo calcula (Alpine publica sha512). sha512 de Alpine:
# sha512 = "d3410a072044b4962c1aa08eb144b4e4b959f4f65203dfac4013b14e2fd987b9a6ee9b59f5570980fa691ddf5e9f9d3aa328a63afb487a46c2e76de722f3d693"
sha256 = "075920b826834ac4ddf97661cc73491047855859affd671d52079c6867c1c6c0"
[build]
compiler = "zig-cc"
target = "x86_64-linux-musl"
link = "static"
flags = []
[build.phases]
# de build() de Alpine (traducido; el lab provee $CBUILD/$CHOST — Etapa G Fase 3; revisá --shared para estático):
compile = '''
_abuild_phase() {
local _floattest=
if [ "$CBUILD" != "$CHOST" ]; then
CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
fi
case "$CARCH" in
ppc64le) export JSIMD_FORCENONE=1;;
s390x|riscv64) _floattest="-DFLOATTEST=fp-contract";;
esac
CFLAGS="$CFLAGS -O2 -DNDEBUG -flto=auto" \
CXXFLAGS="$CXXFLAGS -O2 -DNDEBUG -flto=auto" \
cmake -B build-shared -G Ninja \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=/usr/lib \
-DBUILD_SHARED_LIBS=True \
-DENABLE_STATIC=False \
-DCMAKE_BUILD_TYPE=None \
-DCMAKE_SKIP_INSTALL_RPATH=ON \
-DWITH_JPEG8=1 \
$_floattest \
$CMAKE_CROSSOPTS
cmake --build build-shared
cmake -B build-static -G Ninja \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=/usr/lib \
-DBUILD_SHARED_LIBS=False \
-DENABLE_STATIC=True \
-DCMAKE_BUILD_TYPE=None \
-DCMAKE_SKIP_INSTALL_RPATH=ON \
-DWITH_JPEG8=1 \
$_floattest \
$CMAKE_CROSSOPTS
cmake --build build-static
}
_abuild_phase
'''
# de package() de Alpine (traducido $pkgdir→/out):
install = '''
_abuild_phase() {
DESTDIR="/out" cmake --install build-static
DESTDIR="/out" cmake --install build-shared
install -d "/out"/usr/share/licenses/libjpeg-turbo
ln -s ../../doc/libjpeg-turbo/LICENSE.md "/out/usr/share/licenses/libjpeg-turbo"
}
_abuild_phase
'''
configure = "cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DENABLE_SHARED=0 -DENABLE_STATIC=1 -DWITH_SIMD=0"
compile = "cmake --build build"
install = "DESTDIR=/out cmake --install build"
[deps]
build = ["nasm", "samurai"]
build = ["cmake"]
+4 -33
View File
@@ -1,42 +1,13 @@
# 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.
# lz4 1.10.0 — compresión rápida. Makefile, static only.
name = "lz4"
version = "1.10.0"
[source]
tarball = "https://github.com/lz4/lz4/archive/v1.10.0.tar.gz"
# FIXME sha256: el wrapper lo calcula (Alpine publica sha512). sha512 de Alpine:
# sha512 = "8c4ceb217e6dc8e7e0beba99adc736aca8963867bcf9f970d621978ba11ce92855912f8b66138037a1d2ae171e8e17beb7be99281fea840106aa60373c455b28"
tarball = "https://github.com/lz4/lz4/releases/download/v1.10.0/lz4-1.10.0.tar.gz"
sha256 = "537512904744b35e232912055ccf8ec66d768639ff3abe5788d90d792ec5f48b"
[build]
compiler = "zig-cc"
target = "x86_64-linux-musl"
link = "static"
flags = []
[build.phases]
# de build() de Alpine (traducido; el lab provee $CBUILD/$CHOST — Etapa G Fase 3; revisá --shared para estático):
compile = '''
_abuild_phase() {
export CFLAGS="$CFLAGS -O2 -flto=auto"
export CPPFLAGS="$CPPFLAGS -O2 -flto=auto"
make PREFIX="/usr"
}
_abuild_phase
'''
# de package() de Alpine (traducido $pkgdir→/out):
install = '''
_abuild_phase() {
make PREFIX="/usr" DESTDIR="/out" install
(
cd tests/
rm -f ./*.c COPYING Makefile .gitignore
)
mkdir -p "/out"/usr/share/lz4
cp -rf tests "/out"/usr/share/lz4/
}
_abuild_phase
'''
compile = "make BUILD_SHARED=no BUILD_STATIC=yes -C lib"
install = "make -C lib install BUILD_SHARED=no PREFIX=/usr DESTDIR=/out"
+7 -61
View File
@@ -1,70 +1,16 @@
# 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.
# zstd 1.5.7 — compresión (lo usan muchos). cmake static, sin programas.
name = "zstd"
version = "1.5.7"
[source]
tarball = "https://github.com/facebook/zstd/archive/v1.5.7.tar.gz"
# FIXME sha256: el wrapper lo calcula (Alpine publica sha512). sha512 de Alpine:
# sha512 = "26e441267305f6e58080460f96ab98645219a90d290a533410b1b0b1d2f870721c95f8384e342ee647c5e968385a5b7e30c2d04340c37f59b3e6d86762c3260c"
sha256 = "37d7284556b20954e56e1ca85b80226768902e2edabd3b649e9e72c0c9012ee3"
tarball = "https://github.com/facebook/zstd/releases/download/v1.5.7/zstd-1.5.7.tar.gz"
sha256 = "eb33e51f49a15e023950cd7825ca74a4a2b43db8354825ac24fc1b7ee09e6fa3"
[build]
compiler = "zig-cc"
target = "x86_64-linux-musl"
link = "static"
flags = []
[build.phases]
# de build() de Alpine (traducido; el lab provee $CBUILD/$CHOST — Etapa G Fase 3; revisá --shared para estático):
compile = '''
_abuild_phase() {
export CFLAGS="${CFLAGS/-Os/-O3} -flto=auto -ffat-lto-objects"
export CXXFLAGS="${CXXFLAGS/-Os/-O3} -flto=auto -ffat-lto-objects"
export CPPFLAGS="${CPPFLAGS/-Os/-O3} -flto=auto -ffat-lto-objects"
local pgo=false
if [ -z "$BOOTSTRAP" ]; then
pgo=true
fi
# 2-stage pgo+lto build (non-bootstrap), standard meson usage.
# note that with clang,
# llvm-profdata merge --output=output/somefilename(?) output/*.profraw
# is needed.
# believe it or not, this is +30% faster on x86_64 than the default makefile build (same params)..
# maybe needs more testing
# shellcheck disable=2046
abuild-meson \
--default-library=both \
-Db_ndebug=true \
$($pgo && echo -Db_pgo=generate) \
-Dbin_contrib=true \
-Dbin_programs=true \
-Dbin_tests="$(want_check && echo true || echo false)" \
-Dbacktrace=disabled \
-Dmulti_thread=enabled \
-Dlz4=disabled \
-Dlzma=disabled \
-Dzlib=disabled \
build/meson output
meson compile -C output
if $pgo; then
meson test -t 4 --print-errorlogs -C output
meson configure -Dbin_tests=false -Db_pgo=use output
meson compile -C output
fi
}
_abuild_phase
'''
# de package() de Alpine (traducido $pkgdir→/out):
install = '''
_abuild_phase() {
DESTDIR="/out" meson install --no-rebuild -C output
}
_abuild_phase
'''
configure = "cmake -S build/cmake -B b -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DZSTD_BUILD_SHARED=OFF -DZSTD_BUILD_STATIC=ON -DZSTD_BUILD_PROGRAMS=OFF -DZSTD_BUILD_TESTS=OFF"
compile = "cmake --build b"
install = "DESTDIR=/out cmake --install b"
[deps]
build = ["grep"]
build = ["cmake"]