mirror of
https://github.com/burakgon/OpenScreens.git
synced 2026-12-06 07:30:35 +08:00
scripts/release-linux.sh builds in Swift's image of Ubuntu 24.04 with podman or docker, links the Swift runtime in, and packs the program with its desktop entry, icon, an install script for one's own folders, and its read-me. The program it makes starts on a bare Ubuntu 24.04 with nothing but GTK 4 added, and on Arch.
48 lines
1.8 KiB
Bash
Executable File
48 lines
1.8 KiB
Bash
Executable File
#!/bin/sh
|
|
# Builds OpenScreens for Linux and packs it for a release on GitHub.
|
|
#
|
|
# scripts/release-linux.sh [output directory]
|
|
#
|
|
# The build runs in a container of Ubuntu 24.04 with Swift's own image, so
|
|
# the program runs on that and on anything newer, and the Swift runtime is
|
|
# linked into it: what it needs from the system is GTK 4.12 or newer. It
|
|
# needs podman or docker. What it leaves in the output directory is
|
|
# OpenScreens-<version>-linux-<architecture>.tar.gz and its checksum.
|
|
set -eu
|
|
|
|
OUT="${1:-dist}"
|
|
cd "$(dirname "$0")/.."
|
|
VERSION=$(sed -n 's/^MARKETING_VERSION *= *//p' Config/Base.xcconfig)
|
|
IMAGE=${SWIFT_IMAGE:-docker.io/library/swift:6.4.2-noble}
|
|
ENGINE=$(command -v podman || command -v docker) || {
|
|
echo "Install podman or docker first." >&2
|
|
exit 1
|
|
}
|
|
ARCHITECTURE=$(uname -m)
|
|
NAME="OpenScreens-$VERSION-linux-$ARCHITECTURE"
|
|
|
|
WORK="$(mktemp -d)"
|
|
trap 'rm -rf "$WORK"' EXIT
|
|
|
|
# What the build needs, copied, so the container writes nothing here.
|
|
mkdir -p "$WORK/src"
|
|
tar -cf - --exclude=.build Apps/Linux Packages/RDP | tar -xf - -C "$WORK/src"
|
|
|
|
echo "Building OpenScreens $VERSION for Linux ($ARCHITECTURE)..."
|
|
"$ENGINE" run --rm -v "$WORK/src:/src" -w /src/Apps/Linux "$IMAGE" sh -c '
|
|
set -e
|
|
apt-get update -qq
|
|
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq libgtk-4-dev > /dev/null
|
|
swift build -c release --static-swift-stdlib -Xlinker -s
|
|
'
|
|
|
|
mkdir -p "$WORK/$NAME" "$OUT"
|
|
cp "$WORK/src/Apps/Linux/.build/release/openscreens" "$WORK/$NAME/"
|
|
cp Apps/Linux/Resources/com.burakgon.openscreens.desktop Apps/Linux/Resources/com.burakgon.openscreens.png \
|
|
Apps/Linux/Resources/install.sh "$WORK/$NAME/"
|
|
cp Apps/Linux/README.md "$WORK/$NAME/README.md"
|
|
cp LICENSE "$WORK/$NAME/" 2>/dev/null || true
|
|
tar -czf "$OUT/$NAME.tar.gz" -C "$WORK" "$NAME"
|
|
(cd "$OUT" && sha256sum "$NAME.tar.gz" > "$NAME.tar.gz.sha256")
|
|
echo "Done: $OUT/$NAME.tar.gz"
|