2022-02-05 14:23:32 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
2023-10-24 16:00:57 +00:00
|
|
|
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
|
2022-02-05 14:23:32 +00:00
|
|
|
|
|
|
|
###
|
|
|
|
### Simple script to build JELOS
|
|
|
|
###
|
|
|
|
|
|
|
|
if [ !"${ARCH}" == true ]
|
|
|
|
then
|
|
|
|
echo "export ARCH before building."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2023-04-04 23:14:31 +00:00
|
|
|
. config/options ""
|
|
|
|
. projects/${PROJECT}/devices/${DEVICE}/options
|
2022-02-05 14:23:32 +00:00
|
|
|
|
|
|
|
echo "Building ${DISTRO} for ${DEVICE}"
|
|
|
|
|
2023-04-05 21:09:40 +00:00
|
|
|
if [ "${ENABLE_32BIT}" == "true" ]
|
|
|
|
then
|
2023-04-26 13:21:19 +00:00
|
|
|
PKG_CLEAN+=" ${CLEAN_EMU_32BIT}"
|
2022-07-29 21:11:02 +00:00
|
|
|
fi
|
2022-07-21 00:51:59 +00:00
|
|
|
|
2023-04-25 22:54:13 +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.
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2023-08-24 21:08:28 +00:00
|
|
|
# Ensure the DEVICE_ROOT is built before DEVICE
|
2023-08-24 21:02:51 +00:00
|
|
|
if [ ! -d "build.${DISTRO}-${DEVICE_ROOT}.${ARCH}" ]
|
|
|
|
then
|
|
|
|
echo "ERROR: Can't find build root build.${DISTRO}-${DEVICE_ROOT}.${ARCH}"
|
|
|
|
echo "You need to build ${DEVICE_ROOT} before ${DEVICE}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2023-04-25 22:54:13 +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
|
2023-04-26 00:39:13 +00:00
|
|
|
|
|
|
|
# If sources are split between devices, make sure we link it.
|
|
|
|
if [ -d "sources-${DEVICE_ROOT}" ] && \
|
|
|
|
[ ! -L "sources-${DEVICE}" ]
|
|
|
|
then
|
|
|
|
ln -sf sources-${DEVICE_ROOT} sources-${DEVICE}
|
|
|
|
fi
|
2023-04-25 22:54:13 +00:00
|
|
|
fi
|
2023-11-25 17:38:53 +00:00
|
|
|
PKG_CLEAN+=" ${CLEAN_DEVICE_ROOT}"
|
2023-04-25 22:54:13 +00:00
|
|
|
fi
|
|
|
|
|
2023-02-10 12:51:40 +00:00
|
|
|
# Clean necessary packages.
|
2023-11-25 17:38:53 +00:00
|
|
|
PKG_CLEAN+=" ${CLEAN_NETWORK} ${CLEAN_OS_BASE} ${CLEAN_PACKAGES}"
|
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
|
|
|
# Clean a few packages to ensure the build date and version are updated
|
|
|
|
for package in ${PKG_CLEAN}
|
|
|
|
do
|
|
|
|
echo "Clean: ${package}"
|
2023-04-27 11:57:00 +00:00
|
|
|
./scripts/clean ${package} 2>/dev/null ||:
|
2022-08-31 21:50:23 +00:00
|
|
|
done
|
2023-04-26 21:21:33 +00:00
|
|
|
rm -rf build.${DISTRO}-${DEVICE_ROOT}.${ARCH}/.stamps/initramfs
|
2022-08-31 21:50:23 +00:00
|
|
|
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
|
|
|
|
2023-03-04 01:12:41 +00:00
|
|
|
case ${ARCH} in
|
|
|
|
arm)
|
2023-04-04 23:14:31 +00:00
|
|
|
[ "${BASE_ONLY}" == "true" ] || [ ! "${ENABLE_32BIT}" == "true" ] && exit 0
|
2023-03-04 15:05:43 +00:00
|
|
|
export PKG_BUILD_PERF=no
|
|
|
|
scripts/build_compat arm
|
|
|
|
scripts/install arm
|
2023-03-04 01:12:41 +00:00
|
|
|
;;
|
|
|
|
i686)
|
2023-04-04 23:14:31 +00:00
|
|
|
[ "${BASE_ONLY}" == "true" ] || [ ! "${ENABLE_32BIT}" == "true" ] && exit 0
|
2023-03-04 15:05:43 +00:00
|
|
|
export PKG_BUILD_PERF=no
|
2023-03-04 01:12:41 +00:00
|
|
|
scripts/build_compat x86
|
|
|
|
scripts/install x86
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
make image
|
|
|
|
esac
|
2022-02-05 14:23:32 +00:00
|
|
|
|
|
|
|
if [ ! $? == 0 ]
|
|
|
|
then
|
|
|
|
echo "Build failed..exiting."
|
|
|
|
exit 1
|
|
|
|
fi
|