distribution/scripts/build_distro

90 lines
2.5 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 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.
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
# 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
ln -sf build.${DISTRO}-${DEVICE_ROOT}.${ARCH} build.${DISTRO}-${DEVICE}.${ARCH}
2022-07-11 23:35:08 +00:00
fi
fi
# 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.
PKG_CLEAN="${PKG_CLEAN} system-utils plymouth-lite initramfs busybox linux grub u-boot SDL2 modules \
emulationstation retroarch lib32 jelos"
2022-02-05 14:23:32 +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-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