Files
navop/script/package-linux-gpu-stack-docker.sh
T
胡飞 e38a35df99 build(linux): 渲染依赖独立成包,便携版改为同一二进制加标记文件
- 新增 script/package-linux-gpu-stack{,.py,-build.sh,-docker.sh} 与
  script/linux-gpu-stack-install.sh:在 Rocky 8 容器里收集 Mesa/EGL/LLVM
  闭包,产出 navop-<version>-linux-<x64|arm64>-gpu-stack.tar.gz;安装脚本
  按 ldconfig 只补宿主缺失的库,支持 --dry-run/--force/--uninstall,卸载
  只回放自己安装过的文件
- 删除 Linux portable 变体:musl 启动器 script/linux-portable-launcher.c、
  script/package-linux-portable.{py,sh},发布矩阵移除 linux-x64-portable
  与 linux-arm64-portable
- Linux 应用包统一为默认 feature 的裸二进制,构建走
  cargo zigbuild --target <triple>.2.28,不再拆 --no-default-features 分支
- 便携包回归:Package (Linux) 用同一个二进制平铺、加一个空的
  navop.portable 标记打成 -portable.tar.gz,不新增矩阵项、不二次编译
- upload-r2.yml 的 targetFor() 识别 -portable./-gpu-stack. 后缀并映射到
  对应 target,避免这两类资产被归入 universal
- 三语言 install-update.md 更新下载表,新增图形依赖包与便携版说明
- 重写 script/test-release-packaging.mjs:退役 portable 打包器用例,新增
  依赖包三方契约、便携标记跨平台锁定、install.sh 增量卸载等断言
2026-09-22 13:45:05 +08:00

134 lines
3.9 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# Host side of the Linux GPU dependency stack build. Drives
# script/package-linux-gpu-stack-build.sh inside a RHEL 8 generation container,
# because the stack has to match the glibc baseline Navop is built against and
# only that distribution generation ships a Mesa user space at it.
#
# Docker is used for its package manager, not for cross-architecture emulation:
# the container runs natively on the host runner while the RPMs it resolves
# target --target's architecture. Nothing in the pipeline executes a collected
# library, so no emulator is required.
set -euo pipefail
repository_root="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
default_image="rockylinux:8"
binary=""
target=""
output=""
image="$default_image"
source_distribution=""
usage() {
cat <<'USAGE'
Usage: package-linux-gpu-stack-docker.sh --binary PATH --target TRIPLE --output DIR [options]
Options:
--binary PATH release Navop binary for the target
--target TRIPLE x86_64-unknown-linux-gnu or aarch64-unknown-linux-gnu
--output DIR directory to receive navop-gpu-stack-linux-<arch>.tar.gz
--image NAME build container (default rockylinux:8)
--source-distribution TEXT overrides the distribution string in the manifest
--help
USAGE
}
fail() {
printf 'Error: %s\n' "$*" >&2
exit 1
}
parse_arguments() {
while [ "$#" -gt 0 ]; do
case "$1" in
--binary)
shift
[ "$#" -gt 0 ] || fail "--binary requires a path"
binary="$1"
;;
--target)
shift
[ "$#" -gt 0 ] || fail "--target requires a triple"
target="$1"
;;
--output)
shift
[ "$#" -gt 0 ] || fail "--output requires a directory"
output="$1"
;;
--image)
shift
[ "$#" -gt 0 ] || fail "--image requires a name"
image="$1"
;;
--source-distribution)
shift
[ "$#" -gt 0 ] || fail "--source-distribution requires text"
source_distribution="$1"
;;
-h | --help)
usage
exit 0
;;
*)
fail "unknown argument: $1 (try --help)"
;;
esac
shift
done
[ -n "$binary" ] || fail "--binary is required"
[ -n "$target" ] || fail "--target is required"
[ -n "$output" ] || fail "--output is required"
}
main() {
parse_arguments "$@"
command -v docker >/dev/null 2>&1 ||
fail "docker is required to resolve the RHEL 8 dependency tree"
[ -f "$binary" ] || fail "release binary does not exist: $binary"
binary="$(cd -- "$(dirname -- "$binary")" && pwd)/$(basename -- "$binary")"
mkdir -p "$output"
output="$(cd -- "$output" && pwd)"
# The container only ever sees three mounts: the repository (read only), the
# binary's directory, and the output directory.
local binary_directory
binary_directory="$(dirname -- "$binary")"
local container_arguments=(
--binary "/binary/$(basename -- "$binary")"
--target "$target"
--output /out
)
if [ -n "$source_distribution" ]; then
container_arguments+=(--source-distribution "$source_distribution")
fi
docker run --rm \
-v "$repository_root:/workspace:ro" \
-v "$binary_directory:/binary:ro" \
-v "$output:/out" \
--workdir /workspace \
"$image" \
bash /workspace/script/package-linux-gpu-stack-build.sh "${container_arguments[@]}"
# Resolve the newest archive with portable test operators only: the GNU-only
# `find` time predicates are unavailable on a BSD userland.
local archive="" candidate
for candidate in "$output"/navop-gpu-stack-linux-*.tar.gz; do
[ -f "$candidate" ] || continue
if [ -z "$archive" ] || [ "$candidate" -nt "$archive" ]; then
archive="$candidate"
fi
done
[ -n "$archive" ] || fail "the build container produced no dependency archive in $output"
printf 'Dependency stack written: %s\n' "$archive"
}
main "$@"