From mboxrd@z Thu Jan 1 00:00:00 1970 From: Romain Naour Date: Mon, 1 Feb 2016 16:34:28 +0100 Subject: [Buildroot] [PATCH v3 2/2] toolchain-external: move the sysroot toolchain support check to helper function In-Reply-To: <1454340868-2040-1-git-send-email-romain.naour@gmail.com> References: <1454340868-2040-1-git-send-email-romain.naour@gmail.com> Message-ID: <1454340868-2040-2-git-send-email-romain.naour@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: buildroot@busybox.net The sysroot toolchain support check is duplicated at three locations in the external toolchain infra. So move it inside the check_unusable_toolchain helper that is called when the toolchain package is configured (TOOLCHAIN_EXTERNAL_CONFIGURE_CMDS). All checks in TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS and TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS can be safely removed since it's already done in TOOLCHAIN_EXTERNAL_CONFIGURE_CMDS. Signed-off-by: Romain Naour Cc: "Yann E. MORIN" --- v3: add missing exit 1 s/$(__CROSS_CC)/$${__CROSS_CC}/ Improve commit log (ThomasP) v2: new patch --- toolchain/helpers.mk | 5 +++++ toolchain/toolchain-external/toolchain-external.mk | 14 +------------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk index 6102371..8a776f2 100644 --- a/toolchain/helpers.mk +++ b/toolchain/helpers.mk @@ -423,6 +423,11 @@ check_unusable_toolchain = \ if test "$${libc_a_path}" = "libc.a" ; then \ echo "Unable to detect the toolchain sysroot, Buildroot cannot handle this toolchain." ; \ exit 1 ; \ + fi ; \ + sysroot_dir="$(call toolchain_find_sysroot,$${__CROSS_CC})" ; \ + if test -z "$${sysroot_dir}" ; then \ + echo "External toolchain doesn't support --sysroot. Cannot use." ; \ + exit 1 ; \ fi # diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk index 518afd6..5ad6309 100644 --- a/toolchain/toolchain-external/toolchain-external.mk +++ b/toolchain/toolchain-external/toolchain-external.mk @@ -467,17 +467,13 @@ $$(printf $(call toolchain_find_libc_a,$(1)) | sed -r -e 's:.*/(usr/)?(lib(32|64 endef # Checks for an already installed toolchain: check the toolchain -# location, check that it supports sysroot, and then verify that it +# location, check that it is usable, and then verify that it # matches the configuration provided in Buildroot: ABI, C++ support, # kernel headers version, type of C library and all C library features. define TOOLCHAIN_EXTERNAL_CONFIGURE_CMDS $(Q)$(call check_cross_compiler_exists,$(TOOLCHAIN_EXTERNAL_CC)) $(Q)$(call check_unusable_toolchain,$(TOOLCHAIN_EXTERNAL_CC)) $(Q)SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \ - if test -z "$${SYSROOT_DIR}" ; then \ - @echo "External toolchain doesn't support --sysroot. Cannot use." ; \ - exit 1 ; \ - fi ; \ $(call check_kernel_headers_version,\ $(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC)),\ $(call qstrip,$(BR2_TOOLCHAIN_HEADERS_AT_LEAST))); \ @@ -588,10 +584,6 @@ endef define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS $(Q)SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \ - if test -z "$${SYSROOT_DIR}" ; then \ - @echo "External toolchain doesn't support --sysroot. Cannot use." ; \ - exit 1 ; \ - fi ; \ ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \ ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \ SUPPORT_LIB_DIR="" ; \ @@ -633,10 +625,6 @@ endef define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS $(Q)SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \ - if test -z "$${SYSROOT_DIR}" ; then \ - @echo "External toolchain doesn't support --sysroot. Cannot use." ; \ - exit 1 ; \ - fi ; \ ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \ ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \ SUPPORT_LIB_DIR="" ; \ -- 2.4.3