Files
RuDS/.gitea/scripts/install-linux-build-dependencies.sh
Hermes Agent b0e10f52e7
Some checks failed
Tagged release / prepare-release (push) Successful in 2m54s
Tagged release / build-linux-x64 (push) Failing after 6m6s
Tagged release / build-macos (push) Has been skipped
Tagged release / build-linux-arm64 (push) Has been skipped
Tagged release / build-windows (push) Has been skipped
Tagged release / publish-release (push) Has been skipped
Build Linux x64 against an isolated sysroot.
2026-08-14 14:34:42 +00:00

88 lines
3.1 KiB
Bash

#!/bin/sh
set -eu
target=${1:?usage: install-linux-build-dependencies.sh arm64|x64}
install_packages() {
sudo env DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends "$@"
}
case "$target" in
arm64)
sudo apt-get update
install_packages \
build-essential \
cmake \
libgtk-3-dev \
libwebkit2gtk-4.1-dev \
libxdo-dev \
pkg-config
;;
x64)
if [ "$(dpkg --print-architecture)" != "arm64" ]; then
echo "the x64 release build expects an arm64 Ubuntu runner" >&2
exit 1
fi
if [ ! -r /etc/os-release ]; then
echo "cannot determine the Ubuntu release" >&2
exit 1
fi
. /etc/os-release
if [ "${ID:-}" != "ubuntu" ] || [ -z "${VERSION_CODENAME:-}" ]; then
echo "the x64 release build requires an Ubuntu runner" >&2
exit 1
fi
native_sources=/etc/apt/sources.list.d/ubuntu.sources
if [ ! -f "$native_sources" ]; then
echo "the x64 release build requires Ubuntu's deb822 package sources" >&2
exit 1
fi
sudo sed -i \
'/^Architectures:/d; /^Types: deb$/a Architectures: arm64' \
"$native_sources"
sudo apt-get update
install_packages build-essential cmake gcc-x86-64-linux-gnu g++-x86-64-linux-gnu pkg-config
sudo dpkg --add-architecture amd64
{
printf '%s\n' \
'Types: deb' \
'URIs: http://archive.ubuntu.com/ubuntu' \
"Suites: $VERSION_CODENAME ${VERSION_CODENAME}-updates" \
'Components: main universe restricted multiverse' \
'Architectures: amd64' \
'Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg' \
'' \
'Types: deb' \
'URIs: http://security.ubuntu.com/ubuntu' \
"Suites: ${VERSION_CODENAME}-security" \
'Components: main universe restricted multiverse' \
'Architectures: amd64' \
'Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg'
} | sudo tee /etc/apt/sources.list.d/ruds-amd64.sources >/dev/null
sudo apt-get update
# Foreign development packages contain architecture-specific helper
# programs whose maintainer scripts cannot run on the arm64 host.
# Download them without installing and extract a link-only sysroot.
sysroot=/opt/ruds-x64-sysroot
archives=/tmp/ruds-x64-archives
sudo mkdir -p "$archives/partial" "$sysroot"
sudo env DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
--download-only \
-o Dir::Cache::archives="$archives" \
libgtk-3-dev:amd64 \
libwebkit2gtk-4.1-dev:amd64 \
libxdo-dev:amd64
for package in "$archives"/*.deb; do
sudo dpkg-deb --extract "$package" "$sysroot"
done
;;
*)
echo "unsupported Linux build target: $target" >&2
exit 1
;;
esac