mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-20 05:17:54 +00:00
Make build-all rely on kconfig options.
For that, make CT_BUILD_TOP_DIR a non-settable config option (so that it is recursively expanded with CT_HOST/CT_TARGET). Use a common prefix, with same default as for regular sample build. Use showConfig.sh to determine host toolchain path (for canadian crosses) and build directory to be removed. Remove LIBC_SYSROOT_ARG (unused). Signed-off-by: Alexey Neyman <stilor@att.net>
This commit is contained in:
parent
7fad393635
commit
832bee87c0
@ -40,10 +40,14 @@ config WORK_DIR
|
||||
|
||||
Do *NOT* change it if you don't know better.
|
||||
|
||||
config BUILD_TOP_DIR
|
||||
string
|
||||
default "${CT_WORK_DIR}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}"
|
||||
|
||||
config PREFIX_DIR
|
||||
string
|
||||
prompt "Prefix directory" if ! BACKEND
|
||||
default "${HOME}/x-tools/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}"
|
||||
default "${CT_PREFIX:-${HOME}/x-tools}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}"
|
||||
help
|
||||
This is the path the toolchain will run from.
|
||||
|
||||
|
@ -26,7 +26,7 @@ help-samples::
|
||||
@echo ' show-<sample> - show a brief overview of <sample> (list with list-samples)'
|
||||
@echo ' <sample> - preconfigure crosstool-NG with <sample> (list with list-samples)'
|
||||
@echo ' build-all[.#] - Build *all* samples (list with list-samples) and install in'
|
||||
@echo ' $${CT_PREFIX} (which you must set)'
|
||||
@echo ' $${CT_PREFIX} (set to ~/x-tools by default)'
|
||||
|
||||
help-distrib::
|
||||
@echo ' check-samples - Verify if samples need updates due to Kconfig changes'
|
||||
@ -177,14 +177,7 @@ $(CT_SAMPLES): config_files
|
||||
|
||||
# ----------------------------------------------------------
|
||||
# Some helper functions
|
||||
|
||||
# Construct a CT_PREFIX_DIR path from the sample name. Sample names use
|
||||
# comma as a separator between host and target triplets in canadian cross
|
||||
# configurations, but ct-ng does not allow commas in the path. Substitute
|
||||
# with = (equal sign).
|
||||
# $1: sample
|
||||
__comma = ,
|
||||
prefix_dir = $(CT_PREFIX)/$(subst $(__comma),=,$(1))
|
||||
host_triplet = $(if $(findstring $(__comma),$(1)),$(firstword $(subst $(__comma), ,$(1))))
|
||||
target_triplet = $(if $(findstring $(__comma),$(1)),$(word 2,$(subst $(__comma), ,$(1))),$(1))
|
||||
|
||||
@ -193,16 +186,15 @@ target_triplet = $(if $(findstring $(__comma),$(1)),$(word 2,$(subst $(__comma),
|
||||
define build_sample
|
||||
@$(CT_ECHO) ' CONF $(1)'
|
||||
$(SILENT)$(CONF) -s --defconfig=$(call sample_dir,$(1))/crosstool.config $(KCONFIG_TOP)
|
||||
$(SILENT)$(sed) -i -r -e 's:^(CT_PREFIX_DIR=).*$$:\1"$(call prefix_dir,$(1))":;' .config
|
||||
$(SILENT)[ -n "$(CT_PREFIX)" ] && $(sed) -i -r -e 's:^(CT_PREFIX=).*$$:\1"$(CT_PREFIX)":;' .config || :
|
||||
$(SILENT)$(sed) -i -r -e 's:^.*(CT_LOG_(WARN|INFO|EXTRA|DEBUG|ALL)).*$$:# \1 is not set:;' .config
|
||||
$(SILENT)$(sed) -i -r -e 's:^.*(CT_LOG_ERROR).*$$:\1=y:;' .config
|
||||
$(SILENT)$(sed) -i -r -e 's:^(CT_LOG_LEVEL_MAX)=.*$$:\1="ERROR":;' .config
|
||||
$(SILENT)$(sed) -i -r -e 's:^.*(CT_LOG_TO_FILE).*$$:\1=y:;' .config
|
||||
$(SILENT)$(sed) -i -r -e 's:^.*(CT_LOG_PROGRESS_BAR).*$$:\1=y:;' .config
|
||||
$(SILENT)$(CONF) -s --oldconfig $(KCONFIG_TOP)
|
||||
@$(CT_ECHO) ' BUILD $(1)'
|
||||
$(SILENT)if [ ! -z "$(call host_triplet,$(1))" -a -d "$(call prefix_dir,$(call host_triplet,$(1)))" ]; then \
|
||||
PATH="$$PATH:$(call prefix_dir,$(call host_triplet,$(1)))/bin"; \
|
||||
$(SILENT)h=$(call host_triplet,$(1)); \
|
||||
if [ -n "$${h}" -a -r ".build-all/PASS/$${h}/prefix" ]; then \
|
||||
PATH=`cat .build-all/PASS/$${h}/prefix`/bin:$${PATH}; \
|
||||
fi; \
|
||||
if $(MAKE) -rf $(CT_NG) V=0 build; then \
|
||||
status=PASS; \
|
||||
@ -214,7 +206,12 @@ define build_sample
|
||||
printf '\r %-5s %s\n' $$status '$(1)'; \
|
||||
mkdir -p .build-all/$$status/$(1); \
|
||||
bzip2 < build.log > .build-all/$$status/$(1)/build.log.bz2; \
|
||||
[ "$$status" = PASS -a -z "$(CT_PRESERVE_PASSED_BUILDS)" ] && rm -rf .build/$(call target_triplet,$(1)) || :
|
||||
if [ "$$status" = PASS ]; then \
|
||||
blddir=`$(bash) $(CT_LIB_DIR)/scripts/showConfig.sh '$${CT_BUILD_TOP_DIR}'`; \
|
||||
[ -z "$(CT_PRESERVE_PASSED_BUILDS)" ] && rm -rf $${blddir}; \
|
||||
$(bash) $(CT_LIB_DIR)/scripts/showConfig.sh '$${CT_PREFIX_DIR}' > .build-all/PASS/$(1)/prefix; \
|
||||
fi; \
|
||||
:
|
||||
endef
|
||||
|
||||
# ----------------------------------------------------------
|
||||
@ -224,10 +221,6 @@ endef
|
||||
ifneq ($(strip $(MAKECMDGOALS)),)
|
||||
ifneq ($(strip $(filter $(patsubst %,build-%,$(CT_SAMPLES)) build-all,$(MAKECMDGOALS))),)
|
||||
|
||||
ifeq ($(strip $(CT_PREFIX)),)
|
||||
$(error Please set 'CT_PREFIX' to where you want to install generated toolchain samples!)
|
||||
endif
|
||||
|
||||
endif # MAKECMDGOALS contains a build sample rule
|
||||
endif # MAKECMDGOALS != ""
|
||||
|
||||
|
@ -19,12 +19,12 @@
|
||||
# - don't hash commands lookups,
|
||||
. "${CT_LIB_DIR}/scripts/functions"
|
||||
|
||||
# Yes! We can do full logging from now on!
|
||||
CT_LogEnable
|
||||
|
||||
# Read the sample settings
|
||||
CT_LoadConfig
|
||||
|
||||
# Yes! We can do full logging from now on!
|
||||
CT_LogEnable
|
||||
|
||||
# Check running as root
|
||||
if [ -z "${CT_ALLOW_BUILD_AS_ROOT_SURE}" ]; then
|
||||
if [ $(id -u) -eq 0 ]; then
|
||||
@ -156,8 +156,8 @@ CT_PKGVERSION="crosstool-NG ${CT_VERSION}${CT_TOOLCHAIN_PKGVERSION:+ - ${CT_TOOL
|
||||
# Compute the working directories names
|
||||
CT_TARBALLS_DIR="${CT_WORK_DIR}/tarballs"
|
||||
CT_SRC_DIR="${CT_WORK_DIR}/src"
|
||||
CT_BUILD_DIR="${CT_WORK_DIR}/${CT_TARGET}/build"
|
||||
CT_BUILDTOOLS_PREFIX_DIR="${CT_WORK_DIR}/${CT_TARGET}/buildtools"
|
||||
CT_BUILD_DIR="${CT_BUILD_TOP_DIR}/build"
|
||||
CT_BUILDTOOLS_PREFIX_DIR="${CT_BUILD_TOP_DIR}/buildtools"
|
||||
CT_STATE_DIR="${CT_WORK_DIR}/${CT_TARGET}/state"
|
||||
# Note about HOST_COMPLIBS_DIR: it's always gonna be in the buildtools dir, or a
|
||||
# sub-dir. So we won't have to save/restore it, not even create it.
|
||||
@ -288,7 +288,6 @@ if [ -z "${CT_RESTART}" ]; then
|
||||
BINUTILS_SYSROOT_ARG="--with-sysroot=${CT_SYSROOT_DIR}"
|
||||
CC_CORE_SYSROOT_ARG="--with-sysroot=${CT_SYSROOT_DIR}"
|
||||
CC_SYSROOT_ARG="--with-sysroot=${CT_SYSROOT_DIR}"
|
||||
LIBC_SYSROOT_ARG=""
|
||||
# glibc's prefix must be exactly /usr, else --with-sysroot'd gcc will get
|
||||
# confused when $sysroot/usr/include is not present.
|
||||
# Note: --prefix=/usr is magic!
|
||||
@ -307,7 +306,6 @@ if [ -z "${CT_RESTART}" ]; then
|
||||
# building libgcc, and you'll have no profiling
|
||||
CC_CORE_SYSROOT_ARG="--without-headers"
|
||||
CC_SYSROOT_ARG="--with-headers=${CT_HEADERS_DIR}"
|
||||
LIBC_SYSROOT_ARG="prefix="
|
||||
fi
|
||||
CT_DoExecLog ALL mkdir -p "${CT_SYSROOT_DIR}"
|
||||
CT_DoExecLog ALL mkdir -p "${CT_DEBUGROOT_DIR}"
|
||||
|
Loading…
Reference in New Issue
Block a user