Support out-of-tree local builds

Signed-off-by: Alexey Neyman <stilor@att.net>
This commit is contained in:
Alexey Neyman 2018-04-07 14:39:56 -07:00
parent 7eb903667b
commit 4e7d0906c1
6 changed files with 17 additions and 9 deletions

View File

@ -17,7 +17,7 @@ export CT_TOP_DIR:=$(shell pwd)
ifeq (@enable_local@,yes)
# automake does not allow to set pkgxxxdir, they are always derived from
# a respective xxxdir. So, for enable-local case, set them directly here.
export CT_LIB_DIR:=$(CT_TOP_DIR)
export CT_LIB_DIR:=$(shell cd "@srcdir@" && pwd)
export CT_LIBEXEC_DIR:=$(CT_TOP_DIR)/kconfig
export CT_DOC_DIR:=$(CT_TOP_DIR)/docs
else

View File

@ -111,7 +111,7 @@ CT_TestOrAbort "The CONFIG_SHELL '${CT_CONFIG_SHELL}' is not valid" -f "${CT_CON
CT_TOOLS_OVERRIDE_DIR="${CT_WORK_DIR}/tools"
CT_DoLog DEBUG "Creating bin-override for tools in '${CT_TOOLS_OVERRIDE_DIR}'"
CT_DoExecLog DEBUG mkdir -p "${CT_TOOLS_OVERRIDE_DIR}/bin"
cat "${CT_LIB_DIR}/paths.sh" |while read trash line; do
cat "${paths_sh_location}" |while read trash line; do
tool="${line%%=*}"
# Suppress extra quoting
eval path=${line#*=}

View File

@ -985,7 +985,7 @@ CT_GetFile()
# Two wrappers to call config.(guess|sub) either from CT_TOP_DIR or CT_LIB_DIR.
# Those from CT_TOP_DIR, if they exist, will be be more recent than those from CT_LIB_DIR.
CT_DoConfigGuess() {
if [ -x "${CT_TOP_DIR}/scripts/config.guess" ]; then
if [ -r "${CT_TOP_DIR}/scripts/config.guess" ]; then
"${CT_CONFIG_SHELL}" "${CT_TOP_DIR}/scripts/config.guess"
else
"${CT_CONFIG_SHELL}" "${CT_LIB_DIR}/scripts/config.guess"
@ -993,7 +993,7 @@ CT_DoConfigGuess() {
}
CT_DoConfigSub() {
if [ -x "${CT_TOP_DIR}/scripts/config.sub" ]; then
if [ -r "${CT_TOP_DIR}/scripts/config.sub" ]; then
"${CT_CONFIG_SHELL}" "${CT_TOP_DIR}/scripts/config.sub" "$@"
else
"${CT_CONFIG_SHELL}" "${CT_LIB_DIR}/scripts/config.sub" "$@"
@ -2283,3 +2283,16 @@ CT_GetChoicePkgBuildVersion()
eval "component=\${CT_${choice}_CHOICE_KSYM}"
CT_GetPkgBuildVersion "${choice}" "${component}" "${var}"
}
# Finally, load paths.sh. For --enable-local build, it is located in
# the current directory (CT_TOP_DIR) while the rest of the scripts are
# in the source directory (CT_LIB_DIR). For other setups, paths.sh
# is in CT_LIB_DIR.
if [ -r "${CT_LIB_DIR}/paths.sh" ]; then
paths_sh_location="${CT_LIB_DIR}/paths.sh"
elif [ -r "${CT_TOP_DIR}/paths.sh" ]; then
paths_sh_location="${CT_TOP_DIR}/paths.sh"
else
CT_Error "Not found: paths.sh"
fi
. "${paths_sh_location}"

View File

@ -7,7 +7,6 @@
# - info about who reported the sample
# Parse the tools' paths configuration
. "${CT_LIB_DIR}/paths.sh"
. "${CT_LIB_DIR}/scripts/functions"
CT_LoadConfig

View File

@ -2,7 +2,6 @@
# the versions of the main tools
# Use tools discovered by ./configure
. "${CT_LIB_DIR}/paths.sh"
. "${CT_LIB_DIR}/scripts/functions"
[ "$1" = "-v" ] && opt="$1" && shift

View File

@ -1,9 +1,6 @@
# What we need:
# - the .config file
# Parse the tools' paths configuration
. "${CT_LIB_DIR}/paths.sh"
# Parse the common functions
. "${CT_LIB_DIR}/scripts/functions"