mirror of
https://github.com/X11Libre/xserver.git
synced 2026-11-14 05:14:45 +00:00
NetBSD's CDN doesn't seem to deliver older versions anymore, so we need to upgrade to 10.2. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
111 lines
3.4 KiB
Shell
Executable file
111 lines
3.4 KiB
Shell
Executable file
#!/bin/sh
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
# Copyright (C) 2026 Enrico Weigelt, metux IT consult <info@metux.net>
|
|
|
|
set -ex
|
|
|
|
. .github/scripts/util.sh
|
|
|
|
export PATH="$PATH:/usr/sbin:/sbin:/usr/local/sbin"
|
|
|
|
NETBSD_RELEASE="11.0"
|
|
NETBSD_ARCH="amd64"
|
|
PKGSRC_ARCH="x86_64"
|
|
|
|
# Install pkgin if not present
|
|
if ! command -v pkgin >/dev/null 2>&1; then
|
|
echo "Installing pkgin..."
|
|
MIRRORS="
|
|
https://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/${PKGSRC_ARCH}/${NETBSD_RELEASE}/All
|
|
https://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/${PKGSRC_ARCH}/${NETBSD_RELEASE}/All
|
|
"
|
|
for mirror in $MIRRORS; do
|
|
echo "Trying pkgin from $mirror"
|
|
export PKG_PATH="$mirror"
|
|
if pkg_add -v pkgin; then
|
|
echo "pkgin installed from $mirror"
|
|
break
|
|
fi
|
|
done
|
|
if ! command -v pkgin >/dev/null 2>&1; then
|
|
echo "Failed to install pkgin"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
# Configure pkgin repositories (use .conf extension)
|
|
rm -f /usr/pkg/etc/pkgin/repositories.conf
|
|
rm -f /etc/pkgin/repositories.conf
|
|
mkdir -p /usr/pkg/etc/pkgin
|
|
mkdir -p /etc/pkgin
|
|
|
|
{
|
|
cat <<EOF
|
|
https://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/${PKGSRC_ARCH}/${NETBSD_RELEASE}/All
|
|
https://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/${PKGSRC_ARCH}/${NETBSD_RELEASE}/All
|
|
EOF
|
|
} > /usr/pkg/etc/pkgin/repositories.conf
|
|
cp /usr/pkg/etc/pkgin/repositories.conf /etc/pkgin/repositories.conf
|
|
|
|
# Unset PKG_REPOS so pkgin reads repositories.conf (one URL per line)
|
|
unset PKG_REPOS
|
|
|
|
# Update package database
|
|
echo "Updating pkgin..."
|
|
if ! pkgin update; then
|
|
echo "pkgin update had partial mirror failures, falling back to NetBSD 10.0 repositories..."
|
|
{
|
|
cat <<EOF
|
|
https://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/${PKGSRC_ARCH}/10.0/All
|
|
https://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/${PKGSRC_ARCH}/10.0/All
|
|
EOF
|
|
} > /usr/pkg/etc/pkgin/repositories.conf
|
|
cp /usr/pkg/etc/pkgin/repositories.conf /etc/pkgin/repositories.conf
|
|
pkgin update || true
|
|
fi
|
|
|
|
# Install curl for downloading sets
|
|
echo "Installing curl..."
|
|
pkgin -y install curl || true
|
|
|
|
# X11 binary sets
|
|
SETS_MIRRORS="
|
|
https://ftp.netbsd.org/pub/NetBSD/NetBSD-$NETBSD_RELEASE/$NETBSD_ARCH/binary/sets
|
|
https://ftp.us.netbsd.org/pub/NetBSD/NetBSD-$NETBSD_RELEASE/$NETBSD_ARCH/binary/sets
|
|
https://cdn.netbsd.org/pub/NetBSD/NetBSD-$NETBSD_RELEASE/$NETBSD_ARCH/binary/sets
|
|
"
|
|
|
|
echo "Downloading and installing X11 sets..."
|
|
for i in xbase xetc xfont xcomp xserver; do
|
|
ok=0
|
|
for urlbase in $SETS_MIRRORS; do
|
|
url="$urlbase/$i.tar.xz"
|
|
echo "Fetching $url"
|
|
if curl -L --retry 3 --connect-timeout 20 -f -o "/$i.tar.xz" "$url"; then
|
|
ok=1
|
|
break
|
|
fi
|
|
done
|
|
if [ $ok -ne 1 ]; then
|
|
echo "ERROR: Failed to download $i.tar.xz"
|
|
exit 1
|
|
fi
|
|
tar --unlink -xJf "/$i.tar.xz" -C /
|
|
rm -f "/$i.tar.xz"
|
|
done
|
|
|
|
# Install build dependencies
|
|
echo "Installing build dependencies..."
|
|
pkgin -y install \
|
|
bash git pkgconf autoconf automake libtool xorgproto meson pixman xtrans \
|
|
libxkbfile libxcvt libpciaccess font-util libepoll-shim libepoxy nettle \
|
|
xkbcomp xcb-util libXcursor libXScrnSaver spice-protocol fontconfig \
|
|
mkfontscale python311 gmake curl || true
|
|
|
|
mkdir -p "$X11_BUILD_DIR"
|
|
cd "$X11_BUILD_DIR"
|
|
|
|
export X11_INSTALL_PREFIX=/usr/pkg
|
|
|
|
build_ac xorg-macros $(fdo_mirror xorg-macros) refs/tags/util-macros-1.20.2
|
|
build_ac libxcb-wm $(fdo_mirror libxcb-wm) refs/tags/xcb-util-wm-0.4.2
|