#!/bin/sh # Download, verify, strip, and stage prebuilt gsocket aarch64 binaries for Geminux. set -eu BASE_DIR="$(cd "$(dirname "$0")/.." && pwd)" GS_VER="1.4.43" GS_URL="https://github.com/hackerschoice/gsocket/releases/download/v${GS_VER}/gsocket_linux-aarch64.tar.gz" GS_SHA="2b50ce654feb110208745394267539364f3b60d7be6428ab5059e9815115f2d8" TARBALL="$BASE_DIR/build-cache/gsocket_linux-aarch64-${GS_VER}.tar.gz" OUT_DIR="$BASE_DIR/prebuilt/gsocket/usr/local/bin" mkdir -p "$BASE_DIR/build-cache" "$OUT_DIR" if [ ! -f "$TARBALL" ] || ! printf '%s %s\n' "$GS_SHA" "$TARBALL" | sha256sum -c - >/dev/null 2>&1; then echo "[*] Downloading gsocket ${GS_VER} (linux-aarch64)..." curl -fsSL -o "${TARBALL}.tmp" "$GS_URL" printf '%s %s\n' "$GS_SHA" "${TARBALL}.tmp" | sha256sum -c - mv -f "${TARBALL}.tmp" "$TARBALL" fi rm -rf "$OUT_DIR" mkdir -p "$OUT_DIR" tar -xzf "$TARBALL" -C "$OUT_DIR" chmod 0755 "$OUT_DIR"/* # Strip debug symbols from gsocket DSO helpers using Alpine aarch64 binutils exec docker run --rm --network=host \ -e HOST_UID="$(id -u)" \ -e HOST_GID="$(id -g)" \ -v "$BASE_DIR:/geminux" \ alpine:3.24 sh -eu -c ' cat > /etc/apk/repositories </dev/null || true apk add --no-cache binutils-aarch64 >/dev/null for so in /geminux/prebuilt/gsocket/usr/local/bin/gsocket_*.so.*; do [ -f "$so" ] && aarch64-alpine-linux-musl-strip --strip-unneeded "$so" done chown -R "$HOST_UID:$HOST_GID" /geminux/prebuilt/gsocket '