2022-02-05 14:23:32 +00:00
|
|
|
#!/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
|
|
|
|
|
2022-04-12 16:53:08 +00:00
|
|
|
### Remember to make this more dynamic.
|
|
|
|
export DISTRO="JELOS"
|
|
|
|
|
2022-02-05 14:23:32 +00:00
|
|
|
export OS_VERSION=$(date +%Y%m%d)
|
|
|
|
export BUILD_DATE=$(date)
|
|
|
|
|
|
|
|
echo "Building ${DISTRO} for ${DEVICE}"
|
|
|
|
|
2022-07-30 02:19:47 +00:00
|
|
|
# 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.
|
2022-07-11 23:35:08 +00:00
|
|
|
|
2022-07-21 00:51:59 +00:00
|
|
|
if [ -n "${DEVICE_ROOT}" ]
|
2022-07-11 23:35:08 +00:00
|
|
|
then
|
|
|
|
|
2022-07-30 02:19:47 +00:00
|
|
|
if [ ! "${DEVICE_ROOT}" = "${DEVICE}" ]
|
2022-07-11 23:35:08 +00:00
|
|
|
then
|
2022-07-30 02:19:47 +00:00
|
|
|
# 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
|
|
|
|
|
2022-08-02 11:47:27 +00:00
|
|
|
if [ ! -d "build.${DISTRO}-${DEVICE_ROOT}.${ARCH}" ]
|
|
|
|
then
|
|
|
|
echo "Building the device root (${DEVICE_ROOT})."
|
|
|
|
make ${DEVICE_ROOT}
|
|
|
|
fi
|
|
|
|
|
2022-07-30 02:19:47 +00:00
|
|
|
# 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
|
2022-07-11 23:35:08 +00:00
|
|
|
fi
|
|
|
|
|
2022-07-30 02:19:47 +00:00
|
|
|
# If DEVICE_ROOT is defined, take additional clean steps to ensure everything is built
|
|
|
|
# properly for all devices including the root device.
|
|
|
|
|
2022-07-29 21:11:02 +00:00
|
|
|
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"
|
|
|
|
|
|
|
|
fi
|
2022-07-21 00:51:59 +00:00
|
|
|
|
|
|
|
# Clean OS specific packages.
|
2022-07-23 12:58:30 +00:00
|
|
|
PKG_CLEAN="${PKG_CLEAN} system-utils plymouth-lite initramfs busybox linux grub u-boot SDL2 modules \
|
2022-08-23 11:23:08 +00:00
|
|
|
emulationstation retroarch lib32 splash jelos"
|
2022-02-05 14:23:32 +00:00
|
|
|
|
2022-08-31 21:50:23 +00:00
|
|
|
if [ ! -n "${DIRTY}" ]
|
2022-07-23 13:57:45 +00:00
|
|
|
then
|
2022-08-31 21:50:23 +00:00
|
|
|
if [ -d "build.${DISTRO}-${DEVICE_ROOT}.${ARCH}/initramfs" ]
|
|
|
|
then
|
|
|
|
rm -rf build.${DISTRO}-${DEVICE_ROOT}.${ARCH}/initramfs
|
|
|
|
fi
|
2022-07-23 13:57:45 +00:00
|
|
|
|
2022-08-31 21:50:23 +00:00
|
|
|
# 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
|
2022-02-05 14:23:32 +00:00
|
|
|
|
2022-04-10 19:51:34 +00:00
|
|
|
# Clean out old builds before starting the new one.
|
2022-04-12 16:58:05 +00:00
|
|
|
echo "Prune old releases: ${DISTRO}-${DEVICE}.${ARCH}-*"
|
2022-04-10 19:51:34 +00:00
|
|
|
rm -f ./release/${DISTRO}-${DEVICE}.${ARCH}-*
|
2022-03-01 22:06:41 +00:00
|
|
|
|
2022-04-10 19:51:34 +00:00
|
|
|
# Remove the image root as it should be regenerated for every build.
|
|
|
|
rm -rf ./build.${DISTRO}-${DEVICE}.${ARCH}/image
|
2022-03-25 18:51:38 +00:00
|
|
|
|
2022-04-27 10:08:03 +00:00
|
|
|
if [ "${ARCH}" == "arm" ]
|
2022-02-05 14:23:32 +00:00
|
|
|
then
|
2022-04-10 11:31:14 +00:00
|
|
|
if [ "${BASE_ONLY}" == true ]
|
2022-04-10 11:27:57 +00:00
|
|
|
then
|
|
|
|
echo "Skipping 32bit."
|
|
|
|
exit 0
|
|
|
|
fi
|
2022-02-10 00:43:47 +00:00
|
|
|
scripts/build_compat
|
2022-02-05 14:23:32 +00:00
|
|
|
scripts/install arm32
|
2022-04-27 10:08:03 +00:00
|
|
|
else
|
|
|
|
make image
|
2022-02-05 14:23:32 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! $? == 0 ]
|
|
|
|
then
|
|
|
|
echo "Build failed..exiting."
|
|
|
|
exit 1
|
|
|
|
fi
|