104 lines
2.7 KiB
Bash
Executable file
104 lines
2.7 KiB
Bash
Executable file
#!/bin/bash
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
# Copyright (C) 2020-present Fewtarius
|
|
|
|
###
|
|
### Simple script to build JELOS
|
|
###
|
|
|
|
if [ !"${ARCH}" == true ]
|
|
then
|
|
echo "export ARCH before building."
|
|
exit 1
|
|
fi
|
|
|
|
### Remember to make this more dynamic.
|
|
export DISTRO="JELOS"
|
|
|
|
export OS_VERSION=$(date +%Y%m%d)
|
|
export BUILD_DATE=$(date)
|
|
|
|
echo "Building ${DISTRO} for ${DEVICE}"
|
|
|
|
# If DEVICE_ROOT is defined and not the device being built, make sure that the
|
|
# build folder is a link to root rather than a folder.
|
|
|
|
if [ -n "${DEVICE_ROOT}" ]
|
|
then
|
|
|
|
if [ ! "${DEVICE_ROOT}" = "${DEVICE}" ]
|
|
then
|
|
# Ensure there isn't a left over build directory.
|
|
if [ -d "build.${DISTRO}-${DEVICE}.${ARCH}" ]
|
|
then
|
|
echo "Removing stale build root."
|
|
rm -rf build.${DISTRO}-${DEVICE}.${ARCH}
|
|
fi
|
|
|
|
if [ ! -d "build.${DISTRO}-${DEVICE_ROOT}.${ARCH}" ]
|
|
then
|
|
echo "Building the device root (${DEVICE_ROOT})."
|
|
make ${DEVICE_ROOT}
|
|
fi
|
|
|
|
# Link back to the DEVICE_ROOT so we can re-use the build directory to save space.
|
|
if [ ! -L "build.${DISTRO}-${DEVICE}.${ARCH}" ]
|
|
then
|
|
ln -sf build.${DISTRO}-${DEVICE_ROOT}.${ARCH} build.${DISTRO}-${DEVICE}.${ARCH}
|
|
fi
|
|
fi
|
|
|
|
# If DEVICE_ROOT is defined, take additional clean steps to ensure everything is built
|
|
# properly for all devices including the root device.
|
|
|
|
PKG_CLEAN="${PKG_CLEAN} mupen64plus-nx mupen64plus flycast_libretro dosbox-pure parallel-n64_glide64 \
|
|
parallel-n64_gln64 parallel-n64_rice pcsx_rearmed pcsx_rearmed gpsp raze amiberry lzdoom \
|
|
PPSSPPSDL gzdoom mupen64plussa-core mupen64plussa-input-sdl 351files libgo2 \
|
|
gamecontrollerdb duckstationsa moonlight"
|
|
|
|
fi
|
|
|
|
# Clean OS specific packages.
|
|
PKG_CLEAN="${PKG_CLEAN} system-utils plymouth-lite initramfs busybox linux grub u-boot SDL2 modules \
|
|
emulationstation retroarch lib32 autostart splash jelos"
|
|
|
|
if [ ! -n "${DIRTY}" ]
|
|
then
|
|
if [ -d "build.${DISTRO}-${DEVICE_ROOT}.${ARCH}/initramfs" ]
|
|
then
|
|
rm -rf build.${DISTRO}-${DEVICE_ROOT}.${ARCH}/initramfs
|
|
fi
|
|
|
|
# Clean a few packages to ensure the build date and version are updated
|
|
for package in ${PKG_CLEAN}
|
|
do
|
|
echo "Clean: ${package}"
|
|
./scripts/clean ${package}
|
|
done
|
|
fi
|
|
|
|
# Clean out old builds before starting the new one.
|
|
echo "Prune old releases: ${DISTRO}-${DEVICE}.${ARCH}-*"
|
|
rm -f ./release/${DISTRO}-${DEVICE}.${ARCH}-*
|
|
|
|
# Remove the image root as it should be regenerated for every build.
|
|
rm -rf ./build.${DISTRO}-${DEVICE}.${ARCH}/image
|
|
|
|
if [ "${ARCH}" == "arm" ]
|
|
then
|
|
if [ "${BASE_ONLY}" == true ]
|
|
then
|
|
echo "Skipping 32bit."
|
|
exit 0
|
|
fi
|
|
scripts/build_compat
|
|
scripts/install arm32
|
|
else
|
|
make image
|
|
fi
|
|
|
|
if [ ! $? == 0 ]
|
|
then
|
|
echo "Build failed..exiting."
|
|
exit 1
|
|
fi
|