Files
WHCandCursor 41f4cf85ee
ci / tcc-check (push) Failing after 40s
ci / linux (aarch64, 0) (push) Skipped
ci / linux (x86, 1) (push) Skipped
ci / linux (x86_64, 1) (push) Skipped
ci / windows (push) Skipped
release: Hermit 1.0.0 — home layout, icon font, install
Compact the home parliament chip, animate crab states like the HTML kit,
ship hermit-icons.ttf (sbix) + frames, and install the font from make/
bootstrap/package paths.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-29 21:57:46 +08:00

82 lines
2.8 KiB
Bash
Executable File

#!/usr/bin/env bash
# Static musl build of cst-agent for one architecture, packed as
# dist/cst-agent-VERSION-linux-ARCH.tar.gz (+ .sha256).
# scripts/package_linux.sh x86_64|x86|aarch64
# CST_LINUX_CHECK=1 also runs `make check` (only where the binaries can run).
# CST_FORCE_REBUILD=1 forces a clean tree; otherwise same compiler+version
# reuses object files (much faster CI/local repacks).
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
# shellcheck source=lib_release.sh
. "$ROOT/scripts/lib_release.sh"
ARCH="${1:?usage: $0 x86_64|x86|aarch64}"
PREFIX="$ROOT/third_party/prefix-linux-$ARCH"
cd "$ROOT"
read -r LINUX_HOST bindir < <(bash scripts/ci_linux_toolchain.sh "$ARCH")
export PATH="$bindir:$PATH" LINUX_HOST
T="$LINUX_HOST-"
if [[ ! -f "$PREFIX/lib/libcurl.a" || ! -f "$PREFIX/lib/libncursesw.a" ]]; then
bash scripts/build_third_party_linux.sh "$ARCH"
fi
# Only the static prefix: no host .pc file may leak into the link.
export PKG_CONFIG_LIBDIR="$PREFIX/lib/pkgconfig"
unset PKG_CONFIG_PATH CC CFLAGS LDFLAGS
mk=(make CC="${T}gcc" AR="${T}ar" STATIC=1
CFLAGS="-std=c11 -Wall -Wextra -O2 -g -Werror")
stamp=".gen/release-linux-$ARCH.stamp"
want="$(cst_build_stamp "${T}gcc")"
if [[ "${CST_FORCE_REBUILD:-0}" == 1 || ! -f hermit || ! -f "$stamp" ||
"$(cat "$stamp" 2>/dev/null || true)" != "$want" ]]; then
echo "==> clean rebuild ($ARCH)"
make clean >/dev/null
make -C vendor/sashidown clean >/dev/null 2>&1 || true
else
echo "==> incremental rebuild ($ARCH, stamp match)"
fi
"${mk[@]}" -j"$(nproc)" hermit
mkdir -p .gen
printf '%s\n' "$want" >"$stamp"
if "${T}readelf" -l hermit | grep -q 'Requesting program interpreter'; then
echo "hermit is dynamically linked" >&2
exit 1
fi
if [[ "${CST_LINUX_CHECK:-0}" == 1 ]]; then
"${mk[@]}" check
fi
ver="$(cst_version)"
name="hermit-$ver-linux-$ARCH"
rel="dist/$name"
rm -rf "$rel"
mkdir -p "$rel"
cp -f hermit "$rel/hermit"
ln -sfr "$rel/hermit" "$rel/cst-agent" 2>/dev/null || ln -sf hermit "$rel/cst-agent"
"${T}strip" "$rel/hermit"
cp -f README.md "$rel/README.md"
echo "$ver" >"$rel/VERSION"
# Ship icon font + animation frames with the release tarball.
if [[ ! -f res/hermit-icons.ttf ]]; then
python3 scripts/build_hermit_font.py >/dev/null 2>&1 || true
fi
if [[ -f res/hermit-icons.ttf ]]; then
mkdir -p "$rel/share/hermit" "$rel/share/fonts/hermit"
cp -f res/hermit-icons.ttf "$rel/hermit-icons.ttf"
cp -f res/hermit-icons.ttf "$rel/share/hermit/hermit-icons.ttf"
cp -f res/hermit-icons.ttf "$rel/share/fonts/hermit/hermit-icons.ttf"
fi
if [[ -d res/hermit-frames ]]; then
mkdir -p "$rel/share/hermit/frames"
cp -a res/hermit-frames/. "$rel/share/hermit/frames/"
fi
tgz="$(cst_pack_tgz dist "$name")"
# Compat alias package name for one release cycle
cp -f "$tgz" "dist/cst-agent-$ver-linux-$ARCH.tar.gz"
cst_sha256_write "dist/cst-agent-$ver-linux-$ARCH.tar.gz"
ls -la "$rel"
echo "$ROOT/$tgz"