OverviewFilesCommitsIssuesDocsReleasesPeers

ifsrenderer-linux / packaging / build-tarball.sh

53 lines · bash ref:
#!/bin/sh
# Builds the self-contained Linux release tarball.
#
# Self-contained means the .NET runtime, GLFW, Skia and HarfBuzz all ship inside;
# the host only needs ordinary desktop libraries (glibc >= 2.34, libstdc++, zlib,
# libpng, freetype, fontconfig, expat, bzip2, brotli) plus an OpenGL 4.5 driver.
set -eu

# The pear-git runner exports Version=<branch>-<shortSha> (e.g. "linux-port-aef35ba").
# MSBuild picks that up as a project property and NuGet rejects it as a version
# string, failing restore before anything is built. Drop it and use a real one.
unset Version VersionPrefix VersionSuffix 2>/dev/null || true
BUILD_VERSION="${BUILD_VERSION:-1.5.0}"

DOTNET="${DOTNET:-$HOME/.dotnet/dotnet}"
OUT="${OUT:-dist}"
NAME="ifsrenderer-linux-x86_64"
STAGE="$OUT/$NAME"

rm -rf "$STAGE"
mkdir -p "$STAGE"

"$DOTNET" publish AvaloniaShell/AvaloniaShell.csproj \
    -c Release -r linux-x64 --self-contained true \
    -p:Version="$BUILD_VERSION" \
    -o "$STAGE" --nologo

# Headless renderer alongside the editor, sharing the same assets.
"$DOTNET" publish LinuxCli/LinuxCli.csproj \
    -c Release -r linux-x64 --self-contained true \
    -p:Version="$BUILD_VERSION" \
    -o "$OUT/cli-tmp" --nologo
# Overlay the whole CLI publish, not just the apphost: the launcher needs its
# ifsrender.dll, .deps.json and .runtimeconfig.json beside it. Both apps are
# self-contained linux-x64, so the shared runtime assemblies are identical and
# only the per-app files differ.
cp -r "$OUT/cli-tmp"/. "$STAGE"/
rm -rf "$OUT/cli-tmp"

cp LICENSE "$STAGE/LICENSE"
cp README.md "$STAGE/README.md"

cat > "$STAGE/run.sh" <<'LAUNCH'
#!/bin/sh
# Launcher: resolves the real install directory even when symlinked onto PATH.
DIR=$(CDPATH= cd -- "$(dirname -- "$(readlink -f -- "$0")")" && pwd)
exec "$DIR/ifsrenderer" "$@"
LAUNCH
chmod +x "$STAGE/run.sh" "$STAGE/ifsrenderer" "$STAGE/ifsrender"

tar -czf "$OUT/$NAME.tar.gz" -C "$OUT" "$NAME"
echo "built $OUT/$NAME.tar.gz ($(du -h "$OUT/$NAME.tar.gz" | cut -f1))"