distribution/scripts/build_distro

105 lines
2.7 KiB
Text
Raw Normal View History

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}"
# 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
if [ -n "${DEVICE_ROOT}" ]
2022-07-11 23:35:08 +00:00
then
if [ ! "${DEVICE_ROOT}" = "${DEVICE}" ]
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
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
2022-07-11 23:35:08 +00:00
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"
fi
# Clean OS specific packages.
PKG_CLEAN="${PKG_CLEAN} system-utils plymouth-lite initramfs busybox linux grub u-boot SDL2 modules \
emulationstation retroarch lib32 splash jelos"
2022-02-05 14:23:32 +00:00
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
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-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
if [ "${ARCH}" == "arm" ]
2022-02-05 14:23:32 +00:00
then
if [ "${BASE_ONLY}" == true ]
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
else
make image
2022-02-05 14:23:32 +00:00
fi
if [ ! $? == 0 ]
then
echo "Build failed..exiting."
exit 1
fi