distribution/config/path

119 lines
3 KiB
Text
Raw Normal View History

2022-02-05 14:23:32 +00:00
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
set -e
# setup initial directorys (relative to root)
CONFIG=config
SCRIPTS=scripts
PACKAGES=packages
2023-02-24 13:53:43 +00:00
SOURCES=${SOURCES_DIR:-${ROOT}/sources}
BUILD_ROOT=${BUILD_DIR:-${ROOT}}
2022-02-05 14:23:32 +00:00
BUILD_BASE=build
2023-02-24 13:53:43 +00:00
TARGET_IMG=${TARGET_DIR:-${ROOT}/release}
2022-02-05 14:23:32 +00:00
ADDONS=addons
# include ARCH specific options
2023-02-24 13:53:43 +00:00
if [ -f config/arch.${TARGET_ARCH} ]; then
. config/arch.${TARGET_ARCH}
2022-02-05 14:23:32 +00:00
fi
2023-03-01 10:38:27 +00:00
[ -z "${HOST_NAME}" ] && export HOST_NAME="$(${LOCAL_CC} -dumpmachine)"
2022-02-05 14:23:32 +00:00
TARGET_NAME=$TARGET_GCC_ARCH-libreelec-linux-gnu${TARGET_ABI}
2023-02-24 13:53:43 +00:00
BUILD=${BUILD_ROOT}/${BUILD_BASE}.${DISTRONAME}-${DEVICE:-${PROJECT}}.${TARGET_ARCH}
2022-02-05 14:23:32 +00:00
if [ "${LIBREELEC_VERSION}" = "devel" ] ; then
2023-02-24 13:53:43 +00:00
BUILD=${BUILD_ROOT}/${BUILD_BASE}.${DISTRONAME}-${DEVICE:-${PROJECT}}.${TARGET_ARCH}-${OS_VERSION}-${LIBREELEC_VERSION}
2022-02-05 14:23:32 +00:00
fi
if [ -n "$BUILD_SUFFIX" ]; then
BUILD=$BUILD-$BUILD_SUFFIX
fi
THREAD_CONTROL=${BUILD}/.threads
TARGET_ADDONS="$TARGET_IMG/$ADDONS/$ADDON_PATH"
ADDON_BUILD="$BUILD/$ADDONS/$1"
STAMPS=$BUILD/.stamps
STAMPS_INSTALL=$BUILD/image/.stamps
DOCS=DOCS
TOOLCHAIN=$BUILD/toolchain
2023-02-24 13:53:43 +00:00
SYSROOT_PREFIX=${TOOLCHAIN}/${TARGET_NAME}/sysroot
LIB_PREFIX=${SYSROOT_PREFIX}/usr
TARGET_PREFIX=${TOOLCHAIN}/bin/${TARGET_NAME}-
2022-02-05 14:23:32 +00:00
FAKEROOT_SCRIPT=$BUILD/.fakeroot
2023-02-24 13:53:43 +00:00
if [ -z "${INSTALL}" ]; then
2022-02-05 14:23:32 +00:00
INSTALL=$BUILD/image/system
fi
. config/sources
2023-02-24 13:53:43 +00:00
MAKE="${TOOLCHAIN}/bin/make"
2022-02-05 14:23:32 +00:00
XORG_PATH_DRI=/usr/lib/dri
XORG_PATH_XKB=/usr/share/X11/xkb
XORG_PATH_XKB_OUTPUT=/var/lib/xkb
XORG_PATH_RGB=/usr/lib/X11/rgb
XORG_PATH_MODULES=/usr/lib/xorg/modules
XORG_PATH_DRIVERS=/usr/lib/xorg/modules/drivers
. config/optimize
2022-11-01 11:37:27 +00:00
# use different toolchain for 64/32 split builds
2023-02-24 13:53:43 +00:00
if [ -z "${KERNEL_TOOLCHAIN}" -a "${TARGET_KERNEL_ARCH}" = "arm64" -a "${TARGET_ARCH}" = "arm" ]; then
2022-11-01 11:37:27 +00:00
KERNEL_TOOLCHAIN="aarch64"
2022-02-05 14:23:32 +00:00
fi
2023-02-24 13:53:43 +00:00
if [ -n "${KERNEL_TOOLCHAIN}" ]; then
TARGET_KERNEL_PREFIX=${KERNEL_TOOLCHAIN}-none-elf-
2022-02-05 14:23:32 +00:00
else
2023-02-24 13:53:43 +00:00
TARGET_KERNEL_PREFIX=${TARGET_PREFIX}
2022-02-05 14:23:32 +00:00
fi
2023-02-24 13:53:43 +00:00
if [ -z "${CCACHE_DIR}" ]; then
2022-02-05 14:23:32 +00:00
export CCACHE_DIR=${BUILD_ROOT}/.ccache-${TARGET_ARCH}
fi
2023-02-25 11:19:40 +00:00
# keep a copy of ccache dir used for toolchain ccache
export BUILD_CCACHE_DIR="${CCACHE_DIR}"
# local ccache dir in case we build early packages with local ccache
if [ -z "${LOCAL_CCACHE_DIR}" ]; then
export LOCAL_CCACHE_DIR="${BUILD}/.ccache-local"
fi
# Corrects a missing cache directory when building with Docker.
if [ -z "${PYTHON_EGG_CACHE}" ]; then
2023-03-01 03:35:42 +00:00
export PYTHON_EGG_CACHE="${BUILD}/.egg_cache"
fi
2023-02-24 13:53:43 +00:00
if [[ -z "$PATH" || ( "$PATH" != "${TOOLCHAIN}/bin:${TOOLCHAIN}/sbin" && "$PATH" = "${PATH#${TOOLCHAIN}/bin:${TOOLCHAIN}/sbin:}" ) ]]; then
export PATH="${TOOLCHAIN}/bin:${TOOLCHAIN}/sbin${PATH:+":$PATH"}"
2022-02-05 14:23:32 +00:00
fi
# redirect formatted output
export BUILD_INDENT_SIZE=4
SILENT_OUT=3
VERBOSE_OUT=4
if [ "$VERBOSE" = yes ]; then
exec 3>&1
exec 4>&1
else
exec 3>&2
exec 4>/dev/null
fi
unset LD_LIBRARY_PATH
# multilib? nah
unset CONFIG_SITE
# Ignore custom python installs...
unset PYTHONHOME PYTHONPATH PYTHONSTARTUP
export PYTHONNOUSERSITE=yes #disable PEP 370
# Fix #4737
unset PYTHONDONTWRITEBYTECODE