2018-12-22 20:46:13 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
|
|
|
|
|
|
2009-03-18 13:02:53 +01:00
|
|
|
set -e
|
|
|
|
|
|
2011-03-20 23:48:48 +01:00
|
|
|
# setup initial directorys (relative to root)
|
buildsystem: big rework & cleanup - PART-1: split functions from 'config/path' to an seperate file 'config/functions', rework and cleanup some build scripts, remove references to $TARGET_PLATFORM, add support for more then one downloadurl for $PKG_URL (partially done), remove support for: $PKG_DIR/arch, $PKG_DIR/platform, $PKG_DIR/url files, remove support for *.diff patches, create download-stampfiles in sources/$PKG_NAME, create md5 files after download, add support to download all sources at once with './scripts/get'
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2010-11-19 22:01:08 +01:00
|
|
|
CONFIG=config
|
|
|
|
|
SCRIPTS=scripts
|
|
|
|
|
PACKAGES=packages
|
2017-12-21 09:12:40 -05:00
|
|
|
SOURCES=${SOURCES_DIR:-$ROOT/sources}
|
2019-06-17 19:49:58 +02:00
|
|
|
BUILD_ROOT=${BUILD_DIR:-$ROOT}
|
buildsystem: big rework & cleanup - PART-1: split functions from 'config/path' to an seperate file 'config/functions', rework and cleanup some build scripts, remove references to $TARGET_PLATFORM, add support for more then one downloadurl for $PKG_URL (partially done), remove support for: $PKG_DIR/arch, $PKG_DIR/platform, $PKG_DIR/url files, remove support for *.diff patches, create download-stampfiles in sources/$PKG_NAME, create md5 files after download, add support to download all sources at once with './scripts/get'
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2010-11-19 22:01:08 +01:00
|
|
|
BUILD_BASE=build
|
2017-12-21 09:12:40 -05:00
|
|
|
TARGET_IMG=${TARGET_DIR:-$ROOT/target}
|
buildsystem: big rework & cleanup - PART-1: split functions from 'config/path' to an seperate file 'config/functions', rework and cleanup some build scripts, remove references to $TARGET_PLATFORM, add support for more then one downloadurl for $PKG_URL (partially done), remove support for: $PKG_DIR/arch, $PKG_DIR/platform, $PKG_DIR/url files, remove support for *.diff patches, create download-stampfiles in sources/$PKG_NAME, create md5 files after download, add support to download all sources at once with './scripts/get'
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2010-11-19 22:01:08 +01:00
|
|
|
ADDONS=addons
|
|
|
|
|
|
2017-10-09 06:18:29 +01:00
|
|
|
[ -z "${HOST_NAME}" ] && export HOST_NAME="$($LOCAL_CC -dumpmachine)"
|
2016-03-11 22:31:41 +01:00
|
|
|
TARGET_NAME=$TARGET_GCC_ARCH-libreelec-linux-gnu${TARGET_ABI}
|
2009-12-19 17:47:50 +01:00
|
|
|
|
2019-06-17 19:49:58 +02:00
|
|
|
BUILD=${BUILD_ROOT}/${BUILD_BASE}.${DISTRONAME}-${DEVICE:-$PROJECT}.${TARGET_ARCH}-${LIBREELEC_VERSION}
|
|
|
|
|
if [ "${LIBREELEC_VERSION}" = "devel" ] ; then
|
|
|
|
|
BUILD=${BUILD_ROOT}/${BUILD_BASE}.${DISTRONAME}-${DEVICE:-$PROJECT}.${TARGET_ARCH}-${OS_VERSION}-${LIBREELEC_VERSION}
|
2015-05-14 19:33:23 +03:00
|
|
|
fi
|
|
|
|
|
|
2015-01-14 19:42:59 +00:00
|
|
|
if [ -n "$BUILD_SUFFIX" ]; then
|
|
|
|
|
BUILD=$BUILD-$BUILD_SUFFIX
|
|
|
|
|
fi
|
|
|
|
|
|
2019-02-08 17:17:43 +00:00
|
|
|
THREAD_CONTROL=${BUILD}/.threads
|
|
|
|
|
|
2010-07-19 18:51:57 +02:00
|
|
|
TARGET_ADDONS="$TARGET_IMG/$ADDONS/$ADDON_PATH"
|
2010-07-21 18:43:52 +02:00
|
|
|
ADDON_BUILD="$BUILD/$ADDONS/$1"
|
2010-03-11 01:53:00 +01:00
|
|
|
STAMPS=$BUILD/.stamps
|
2010-11-11 17:05:47 +01:00
|
|
|
STAMPS_INSTALL=$BUILD/image/.stamps
|
2009-03-18 13:02:53 +01:00
|
|
|
DOCS=DOCS
|
|
|
|
|
TOOLCHAIN=$BUILD/toolchain
|
2017-02-17 06:40:16 +00:00
|
|
|
SYSROOT_PREFIX=$TOOLCHAIN/$TARGET_NAME/sysroot
|
2009-03-18 13:02:53 +01:00
|
|
|
LIB_PREFIX=$SYSROOT_PREFIX/usr
|
2017-02-17 06:40:16 +00:00
|
|
|
TARGET_PREFIX=$TOOLCHAIN/bin/$TARGET_NAME-
|
2009-03-18 13:02:53 +01:00
|
|
|
|
2017-02-17 18:22:41 +00:00
|
|
|
FAKEROOT_SCRIPT=$BUILD/.fakeroot
|
2010-01-15 08:15:35 +01:00
|
|
|
|
2013-07-17 06:12:14 +02:00
|
|
|
if [ -z "$INSTALL" ]; then
|
|
|
|
|
INSTALL=$BUILD/image/system
|
|
|
|
|
fi
|
|
|
|
|
|
2010-12-16 13:44:14 +01:00
|
|
|
. config/sources
|
|
|
|
|
|
2017-02-17 06:40:16 +00:00
|
|
|
MAKE="$TOOLCHAIN/bin/make"
|
2009-03-18 13:02:53 +01: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
|
2009-05-18 04:56:09 +02:00
|
|
|
XORG_PATH_DRIVERS=/usr/lib/xorg/modules/drivers
|
2009-03-18 13:02:53 +01:00
|
|
|
|
2011-03-21 21:39:29 +01:00
|
|
|
. config/optimize
|
|
|
|
|
|
2022-04-14 19:39:26 +02:00
|
|
|
# use different toolchain for 64/32 split builds
|
2020-03-27 20:16:27 -07:00
|
|
|
if [ -z "$KERNEL_TOOLCHAIN" -a "$TARGET_KERNEL_ARCH" = "arm64" -a "$TARGET_ARCH" = "arm" ]; then
|
2022-04-14 19:39:26 +02:00
|
|
|
KERNEL_TOOLCHAIN="aarch64"
|
2020-03-27 20:16:27 -07:00
|
|
|
fi
|
|
|
|
|
if [ -n "$KERNEL_TOOLCHAIN" ]; then
|
2022-04-14 19:39:26 +02:00
|
|
|
TARGET_KERNEL_PREFIX=$KERNEL_TOOLCHAIN-none-elf-
|
2020-03-27 20:16:27 -07:00
|
|
|
else
|
|
|
|
|
TARGET_KERNEL_PREFIX=$TARGET_PREFIX
|
|
|
|
|
fi
|
|
|
|
|
|
2012-06-06 11:11:30 +01:00
|
|
|
if [ -z "$CCACHE_DIR" ]; then
|
2017-02-17 06:40:16 +00:00
|
|
|
export CCACHE_DIR=$BUILD/.ccache
|
2012-06-06 11:11:30 +01:00
|
|
|
fi
|
2009-03-18 13:02:53 +01:00
|
|
|
|
2022-12-01 15:12:04 +01: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
|
|
|
|
|
|
2017-05-10 22:29:02 +01:00
|
|
|
if [[ -z "$PATH" || ( "$PATH" != "$TOOLCHAIN/bin:$TOOLCHAIN/sbin" && "$PATH" = "${PATH#$TOOLCHAIN/bin:$TOOLCHAIN/sbin:}" ) ]]; then
|
|
|
|
|
export PATH="$TOOLCHAIN/bin:$TOOLCHAIN/sbin${PATH:+":$PATH"}"
|
2009-03-18 13:02:53 +01:00
|
|
|
fi
|
|
|
|
|
|
2018-12-18 03:43:28 +00:00
|
|
|
# redirect formatted output
|
2019-02-08 17:17:43 +00:00
|
|
|
export BUILD_INDENT_SIZE=4
|
|
|
|
|
SILENT_OUT=3
|
|
|
|
|
VERBOSE_OUT=4
|
2018-12-18 03:43:28 +00:00
|
|
|
|
2019-02-08 17:17:43 +00:00
|
|
|
if [ "$VERBOSE" = yes ]; then
|
|
|
|
|
exec 3>&1
|
|
|
|
|
exec 4>&1
|
|
|
|
|
else
|
|
|
|
|
exec 3>&2
|
|
|
|
|
exec 4>/dev/null
|
2009-03-18 13:02:53 +01:00
|
|
|
fi
|
2013-07-23 21:28:17 +03:00
|
|
|
|
2018-12-18 03:43:28 +00:00
|
|
|
unset LD_LIBRARY_PATH
|
2017-12-18 11:09:55 +00:00
|
|
|
|
2013-07-23 21:28:17 +03:00
|
|
|
# multilib? nah
|
|
|
|
|
unset CONFIG_SITE
|
2014-03-05 23:01:34 +02:00
|
|
|
|
2020-04-17 04:08:43 +01:00
|
|
|
# Ignore custom python installs...
|
|
|
|
|
unset PYTHONHOME PYTHONPATH PYTHONSTARTUP
|
|
|
|
|
export PYTHONNOUSERSITE=yes #disable PEP 370
|
2020-12-11 23:53:14 +01:00
|
|
|
|
|
|
|
|
# Fix #4737
|
|
|
|
|
unset PYTHONDONTWRITEBYTECODE
|