From 4bd4f58dbef026a749864571860bac4b18fd991c Mon Sep 17 00:00:00 2001 From: "Sascha Kuehndel (InuSasha)" Date: Mon, 17 Jun 2019 19:49:58 +0200 Subject: [PATCH] buildsystem: allow to set BUILD_ROOT via BUILD_DIR --- .gitignore | 1 + config/path | 7 ++++--- packages/readme.md | 2 +- scripts/build | 2 +- scripts/clean | 2 +- tools/dashboard | 7 +++++-- 6 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index ac9936c8728..b439be10294 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # build directorys /build.*/ +/builds /.fakeroot.* # automatically downloaded source files diff --git a/config/path b/config/path index f6b781428c0..d941c66f192 100644 --- a/config/path +++ b/config/path @@ -8,6 +8,7 @@ set -e SCRIPTS=scripts PACKAGES=packages SOURCES=${SOURCES_DIR:-$ROOT/sources} + BUILD_ROOT=${BUILD_DIR:-$ROOT} BUILD_BASE=build TARGET_IMG=${TARGET_DIR:-$ROOT/target} ADDONS=addons @@ -20,9 +21,9 @@ set -e [ -z "${HOST_NAME}" ] && export HOST_NAME="$($LOCAL_CC -dumpmachine)" TARGET_NAME=$TARGET_GCC_ARCH-libreelec-linux-gnu${TARGET_ABI} -BUILD=$ROOT/$BUILD_BASE.$DISTRONAME-${DEVICE:-$PROJECT}.$TARGET_ARCH-$LIBREELEC_VERSION -if [ "$LIBREELEC_VERSION" = "devel" ] ; then - BUILD=$ROOT/$BUILD_BASE.$DISTRONAME-${DEVICE:-$PROJECT}.$TARGET_ARCH-$OS_VERSION-$LIBREELEC_VERSION +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} fi if [ -n "$BUILD_SUFFIX" ]; then diff --git a/packages/readme.md b/packages/readme.md index e67a1c6e33b..1d32d63c995 100644 --- a/packages/readme.md +++ b/packages/readme.md @@ -266,7 +266,7 @@ Issue | Level | Meaning | * when it extend an existing package, add it there to the `PKG_DEPENDS_TARGET`/`PKG_DEPENDS_HOST` etc. * take a look into the path `packages/virtual`, there you should find a virtual packages, that match your new package (misc-packages should be the last option) 5. Now you can build your image - * after the build, inside the `build-*` folder you should find a directory with your package name and -version, eg. `widget-1.2.3`. + * after the build, inside the `BUILD_DIR` (normally build.*) folder you should find a directory with your package name and -version, eg. `widget-1.2.3`. ## Example ``` diff --git a/scripts/build b/scripts/build index c8592f6717f..db060437343 100755 --- a/scripts/build +++ b/scripts/build @@ -12,7 +12,7 @@ fi if [ "${1}" = "--all" ]; then if [ -n "${2}" ]; then - for build_dir in $(ls -1d ${ROOT}/build.*); do + for build_dir in $(ls -1d ${BUILD_ROOT}/${BUILD_BASE}.*); do load_build_config ${build_dir} && ${SCRIPTS}/build "${2}" done fi diff --git a/scripts/clean b/scripts/clean index 36ac2394d19..82f40e02831 100755 --- a/scripts/clean +++ b/scripts/clean @@ -35,7 +35,7 @@ clean_package() { } if [ "${1}" = "--all" -a -n "${2}" ]; then - for build_dir in $(ls -1d "${ROOT}/build."*); do + for build_dir in $(ls -1d "${BUILD_ROOT}/${BUILD_BASE}."*); do load_build_config "${build_dir}" && "${SCRIPTS}/clean" "${2}" done elif [ -n "${1}" ]; then diff --git a/tools/dashboard b/tools/dashboard index 825b00d9ed2..b8126f649ef 100755 --- a/tools/dashboard +++ b/tools/dashboard @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e # SPDX-License-Identifier: GPL-2.0 # Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) @@ -6,7 +6,10 @@ cd "$(readlink -f "$(dirname "$0")")/.." if [ -n "${PROJECT}" -a "$1" != "auto" ]; then + # loads project config and sets THREAD_CONTROL . config/options "" +else + BUILD_PREFIX=$(. config/options "" && echo ${BUILD_ROOT}/${BUILD_BASE}) fi _find_latest_tcdir() { @@ -15,7 +18,7 @@ _find_latest_tcdir() { if [ -n "${THREAD_CONTROL}" ]; then echo "${THREAD_CONTROL}" else - for dir in $(ls -1td "${PWD}"/build.*/.threads 2>/dev/null); do + for dir in $(ls -1td ${BUILD_PREFIX}.*/.threads 2>/dev/null); do [ -f "${dir}/parallel.pid" ] && echo "${dir}" && break done fi