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-21 00:51:59 +00:00
|
|
|
# If DEVICE_ROOT is defined make sure that the build folder is a link to root rather than
|
2022-07-11 23:35:08 +00:00
|
|
|
# a folder and take additional clean steps to ensure everything is built properly.
|
|
|
|
|
2022-07-21 00:51:59 +00:00
|
|
|
if [ -n "${DEVICE_ROOT}" ]
|
2022-07-11 23:35:08 +00:00
|
|
|
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
|
|
|
|
|
2022-07-21 00:51:59 +00:00
|
|
|
# Link back to the DEVICE_ROOT so we can re-use the build directory to save space.
|
2022-07-11 23:35:08 +00:00
|
|
|
if [ ! -L "build.${DISTRO}-${DEVICE}.${ARCH}" ]
|
|
|
|
then
|
2022-07-21 00:51:59 +00:00
|
|
|
ln -sf build.${DISTRO}-${DEVICE_ROOT}.${ARCH} build.${DISTRO}-${DEVICE}.${ARCH}
|
2022-07-11 23:35:08 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2022-07-21 00:51:59 +00:00
|
|
|
# We need to always assume some packages are build and clean them so the linked build functionality
|
|
|
|
# works as expected. Start with the emulators and cores.
|
|
|
|
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"
|
|
|
|
|
|
|
|
# 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-07-21 00:51:59 +00:00
|
|
|
emulationstation retroarch lib32 jelos"
|
2022-02-05 14:23:32 +00:00
|
|
|
|
2022-07-23 13:57:45 +00:00
|
|
|
if [ -d "build.${DISTRO}-${DEVICE_ROOT}.${ARCH}/initramfs" ]
|
|
|
|
then
|
|
|
|
rm -rf build.${DISTRO}-${DEVICE_ROOT}.${ARCH}/initramfs
|
|
|
|
fi
|
|
|
|
|
2022-04-10 19:51:34 +00:00
|
|
|
# Clean a few packages to ensure the build date and version are updated
|
|
|
|
for package in ${PKG_CLEAN}
|
|
|
|
do
|
2022-04-12 16:58:05 +00:00
|
|
|
echo "Clean: ${package}"
|
2022-04-10 19:51:34 +00:00
|
|
|
./scripts/clean ${package}
|
|
|
|
done
|
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
|