Files
Arch-R/scripts/build_distro
T
Douglas Teles 2d0a76b94a ArchR v2.0-rc3 — first official release-candidate
Kernel 6.12 LTS · Mesa 26.0.5 Panfrost · CMA 96 MB · zlib-ng 2.2.4
CPU turbo 1.5 GHz (vdd_arm 1.45 V) · GPU 650 MHz @ 1.150 V · mali_kbase PM patch
43 motherboard revisions covered · two image variants with hardware auto-detect
PortMaster pre-installed · MESA_GLTHREAD whitelist · RetroAchievements
Tailscale / WireGuard / ZeroTier · Syncthing + rclone · Samba

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 14:36:32 -03:00

104 lines
2.6 KiB
Bash
Executable File

#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2024-present ArchR (https://github.com/archr-linux/Arch-R)
###
### Simple script to build ROCKNX
###
set -e
# Export OFFICIAL so it reaches scripts/image via make
[ -n "${OFFICIAL}" ] && export OFFICIAL
scripts/checkdeps
if [ -z "${ARCH}" ]; then
echo "Please export ARCH before building."
exit 1
fi
. config/options ""
. projects/${PROJECT}/devices/${DEVICE}/options
echo "Building ${DISTRO} for ${DEVICE}"
# Collect packages to clean
PKG_CLEAN=""
if [ "${ENABLE_32BIT}" == "true" ]; then
PKG_CLEAN+=" ${CLEAN_EMU_32BIT}"
fi
if [ "${WINDOWMANAGER}" == "weston" ]; then
PKG_CLEAN+=" ${CLEAN_WESTON}"
fi
# Handle DEVICE_ROOT logic
if [ -n "${DEVICE_ROOT}" ]; then
if [ "${DEVICE_ROOT}" != "${DEVICE}" ]; then
# Remove existing build directory if present
if [ -d "build.${DISTRO}-${DEVICE}.${ARCH}" ]; then
echo "Removing stale build root."
rm -rf build.${DISTRO}-${DEVICE}.${ARCH}
fi
# Ensure DEVICE_ROOT is built before DEVICE
if [ ! -d "build.${DISTRO}-${DEVICE_ROOT}.${ARCH}" ]; then
echo "ERROR: Can't find build root build.${DISTRO}-${DEVICE_ROOT}.${ARCH}"
echo "You need to build ${DEVICE_ROOT} before ${DEVICE}"
exit 1
fi
# Link build directory to DEVICE_ROOT
if [ ! -L "build.${DISTRO}-${DEVICE}.${ARCH}" ]; then
ln -sf build.${DISTRO}-${DEVICE_ROOT}.${ARCH} build.${DISTRO}-${DEVICE}.${ARCH}
fi
# Link sources if necessary
if [ -d "sources-${DEVICE_ROOT}" ] && [ ! -L "sources-${DEVICE}" ]; then
ln -sf sources-${DEVICE_ROOT} sources-${DEVICE}
fi
fi
PKG_CLEAN+=" ${CLEAN_DEVICE_ROOT}"
fi
# Add standard packages to clean
PKG_CLEAN+=" ${CLEAN_NETWORK} ${CLEAN_OS_BASE} ${CLEAN_PACKAGES}"
if [ -z "${DIRTY}" ]; then
# Clean packages to ensure build date and version are updated
for package in ${PKG_CLEAN}; do
echo "Clean: ${package}"
./scripts/clean "${package}" 2>/dev/null || true
done
rm -rf build.${DISTRO}-${DEVICE_ROOT}.${ARCH}/{.stamps/initramfs,initramfs}
fi
# Prune old releases
echo "Prune old releases: ${DISTRO}-${DEVICE}.${ARCH}-*"
rm -f ./release/${DISTRO}-${DEVICE}.${ARCH}-*
rm -f ./target/${DISTRO}-${DEVICE}.${ARCH}-*
# Remove image root
rm -rf ./build.${DISTRO}-${DEVICE}.${ARCH}/image
case "${ARCH}" in
arm)
if [ "${BASE_ONLY}" == "true" ] || [ "${ENABLE_32BIT}" != "true" ]; then
exit 0
fi
export PKG_BUILD_PERF=no
scripts/build_compat arm
scripts/install arm
;;
*)
make image
;;
esac
if [ $? -ne 0 ]; then
echo "Build failed..exiting."
exit 1
fi