2022-02-05 14:23:32 +00:00
|
|
|
# Do not build as root. Ever.
|
2023-04-23 01:44:25 +00:00
|
|
|
if [[ "${EUID}" -eq 0 ]] && \
|
|
|
|
[ ! -f /.dockerenv ]; then
|
2022-02-05 14:23:32 +00:00
|
|
|
echo "Building as the root user is NOT supported. Use a regular user account for the build." 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Spaces in paths are verboten
|
|
|
|
if [[ ${PWD} =~ [[:space:]] ]]; then
|
|
|
|
echo "Current PWD: \"${PWD}\"" 1>&2
|
|
|
|
echo 1>&2
|
|
|
|
echo "Building in a folder that includes spaces is NOT supported. Use a folder without spaces." 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# set default language for buildsystem
|
|
|
|
export LC_ALL=C
|
|
|
|
|
|
|
|
# set default independent variables
|
|
|
|
ROOT="${PWD}"
|
|
|
|
DISTRO_DIR="${ROOT}/distributions"
|
|
|
|
PROJECT_DIR="${ROOT}/projects"
|
|
|
|
|
|
|
|
# determines DISTRO, if not forced by user
|
2024-03-17 22:04:09 +00:00
|
|
|
DISTRO="${DISTRO:-ROCKNIX}"
|
2022-02-05 14:23:32 +00:00
|
|
|
|
|
|
|
# determines PROJECT, if not forced by user
|
2022-12-31 01:10:47 +00:00
|
|
|
PROJECT="${PROJECT:-PC}"
|
2022-02-05 14:23:32 +00:00
|
|
|
|
|
|
|
# determines TARGET_ARCH, if not forced by user
|
2022-12-31 01:10:47 +00:00
|
|
|
ARCH="${ARCH:-x86_64}"
|
2022-02-05 14:23:32 +00:00
|
|
|
TARGET_ARCH="${ARCH}"
|
|
|
|
|
2023-04-04 23:14:31 +00:00
|
|
|
# determine if we are building 32bit support
|
|
|
|
ENABLE_32BIT="${ENABLE_32BIT-true}"
|
|
|
|
|
2022-12-31 20:27:56 +00:00
|
|
|
# determines the default device, if not forced by user
|
2023-04-15 09:30:02 +00:00
|
|
|
DEVICE="${DEVICE:-AMD64}"
|
2022-12-31 20:27:56 +00:00
|
|
|
|
2023-04-04 23:14:31 +00:00
|
|
|
# the version is the date
|
|
|
|
OS_VERSION=$(date +%Y%m%d)
|
|
|
|
|
|
|
|
# defines the born on date of a build
|
|
|
|
BUILD_DATE=$(date)
|
|
|
|
|
2023-07-14 11:39:36 +00:00
|
|
|
# defines supported systems documentation path
|
2023-07-14 21:53:37 +00:00
|
|
|
SYSDOCROOT="${ROOT}/documentation/PER_DEVICE_DOCUMENTATION/${DEVICE}/"
|
2023-07-14 13:58:47 +00:00
|
|
|
SYSDOC="${SYSDOCROOT}/SUPPORTED_EMULATORS_AND_CORES"
|
2023-07-14 11:39:36 +00:00
|
|
|
|
2022-02-05 14:23:32 +00:00
|
|
|
# include helper functions
|
|
|
|
. config/functions
|
|
|
|
|
|
|
|
# projects can set KERNEL_NAME (kernel.img)
|
|
|
|
KERNEL_NAME="${KERNEL_NAME:-KERNEL}"
|
|
|
|
|
|
|
|
LINUX_DEPENDS="${PROJECT_DIR}/${PROJECT}/linux ${PROJECT_DIR}/${PROJECT}/patches/linux ${PROJECT_DIR}/${PROJECT}/packages/linux ${ROOT}/packages/linux"
|
|
|
|
[ -n "${DEVICE}" ] && LINUX_DEPENDS+=" ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/linux ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/patches/linux ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/packages/linux"
|
2023-03-04 19:15:34 +00:00
|
|
|
[[ "${TARGET_ARCH}" =~ i*86|x86_64 ]] && LINUX_DEPENDS+=" ${ROOT}/packages/linux-firmware/intel-ucode ${ROOT}/packages/linux-firmware/kernel-firmware"
|
2022-02-05 14:23:32 +00:00
|
|
|
|
|
|
|
# Need to point to your actual cc
|
|
|
|
# If you have ccache installed, take care that LOCAL_CC does not point to it
|
|
|
|
[ -z "${LOCAL_CC}" ] && export LOCAL_CC="$(command -v gcc)"
|
|
|
|
|
|
|
|
if [ -z "${LOCAL_CC}" ]; then
|
|
|
|
die "***** Please install gcc *****" "127"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Need to point to your actual g++
|
|
|
|
# If you have ccache installed, take care that LOCAL_CXX does not point to it
|
|
|
|
[ -z "${LOCAL_CXX}" ] && export LOCAL_CXX="$(command -v g++)"
|
|
|
|
|
|
|
|
# verbose compilation mode (yes/no)
|
|
|
|
VERBOSE="${VERBOSE:-yes}"
|
|
|
|
|
|
|
|
# Concurrency make level (-j option)
|
|
|
|
# Try values between 1 and number of processor cores present.
|
|
|
|
# default: use all cores
|
|
|
|
[ -z "${CONCURRENCY_MAKE_LEVEL}" ] && export CONCURRENCY_MAKE_LEVEL=$(nproc)
|
|
|
|
|
|
|
|
# cache size for ccache
|
|
|
|
# Set the maximum size of the files stored in the cache. You can specify a
|
|
|
|
# value in gigabytes, megabytes or kilobytes by appending a G, M or K to the
|
|
|
|
# value. The default is gigabytes. The actual value stored is rounded down to
|
|
|
|
# the nearest multiple of 16 kilobytes. Keep in mind this per project .ccache
|
|
|
|
# directory.
|
2022-02-10 00:43:47 +00:00
|
|
|
CCACHE_CACHE_SIZE="20G"
|
2022-02-05 14:23:32 +00:00
|
|
|
|
2023-02-25 00:39:48 +00:00
|
|
|
# compression level for ccache
|
|
|
|
# This option determines the level at which ccache will compress object files
|
|
|
|
# using the real-time compression algorithm Zstandard. It only has effect if
|
|
|
|
# compression is enabled (which it is by default). Zstandard is extremely fast
|
|
|
|
# for decompression and very fast for compression for lower compression
|
|
|
|
# levels. The default is 0. The value 0 means that ccache will choose a
|
|
|
|
# suitable zstd level, currently 1.
|
|
|
|
CCACHE_COMPRESSLEVEL="0"
|
|
|
|
|
2023-06-22 11:43:49 +00:00
|
|
|
# read GLOBAL options if available
|
2023-06-22 11:53:26 +00:00
|
|
|
if [ -f "${HOME}/.${DISTRO}/options" ]; then
|
|
|
|
. "${HOME}/.${DISTRO}/options"
|
2022-02-05 14:23:32 +00:00
|
|
|
fi
|
|
|
|
|
2023-06-22 11:43:49 +00:00
|
|
|
# read ROOT options from ${ROOT} if available
|
2023-06-22 11:17:57 +00:00
|
|
|
if [ -f "${ROOT}/.${DISTRO}/options" ]; then
|
|
|
|
. "${ROOT}/.${DISTRO}/options"
|
2022-09-01 21:17:36 +00:00
|
|
|
fi
|
|
|
|
|
2023-06-22 11:43:49 +00:00
|
|
|
# read DISTRO options if available
|
|
|
|
if [ -f "${DISTRO_DIR}/${DISTRO}/options" ]; then
|
|
|
|
. "${DISTRO_DIR}/${DISTRO}/options"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# read PROJECT options if available
|
|
|
|
if [ -f "${PROJECT_DIR}/${PROJECT}/options" ]; then
|
|
|
|
. "${PROJECT_DIR}/${PROJECT}/options"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# read DEVICE options if available
|
|
|
|
if [ -f "${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/options" ]; then
|
|
|
|
. "${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/options"
|
2022-02-05 14:23:32 +00:00
|
|
|
fi
|
|
|
|
|
2023-02-25 11:19:40 +00:00
|
|
|
if [ "${LOCAL_CCACHE_SUPPORT}" = "yes" ] && [ -z "${CCACHE_DISABLE}" ]; then
|
|
|
|
# like LOCAL_CC check for local ccache only on the very first
|
|
|
|
# call to config/options, before toolchain has been added to the path,
|
|
|
|
# otherwise we might pick up ccache from toolchain/bin here
|
|
|
|
if [ -z "${LOCAL_CCACHE}" ] && [ "${LOCAL_CCACHE_CHECKED}" != "yes" ]; then
|
|
|
|
export LOCAL_CCACHE="$(command -v ccache)"
|
|
|
|
export LOCAL_CCACHE_CHECKED="yes"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
export LOCAL_CCACHE=""
|
|
|
|
fi
|
|
|
|
|
2022-02-05 14:23:32 +00:00
|
|
|
# overwrite OEM_SUPPORT via commandline
|
|
|
|
if [ "${OEM}" = "yes" -o "${OEM}" = "no" ]; then
|
|
|
|
OEM_SUPPORT="${OEM}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
check_config
|
|
|
|
|
|
|
|
. config/graphic
|
|
|
|
. config/path $1
|
|
|
|
|
|
|
|
## package processing
|
|
|
|
|
|
|
|
# If the package caches are unset, then populate them
|
|
|
|
init_package_cache
|
|
|
|
|
2022-12-06 22:00:30 +00:00
|
|
|
if [ -z "${DEFAULT_PYTHON_VERSION+set}" ]; then
|
|
|
|
export DEFAULT_PYTHON_VERSION="$(get_pkg_variable Python3 PKG_PYTHON_VERSION)"
|
|
|
|
fi
|
|
|
|
|
2022-02-05 14:23:32 +00:00
|
|
|
# set package metadata
|
|
|
|
source_package "${1}"
|