diff mbox

Fix 'make toolchain-external-reinstall'

Message ID 1474993712-27904-1-git-send-email-jezz@sysmic.org
State Changes Requested
Headers show

Commit Message

Jérôme Pouiller Sept. 27, 2016, 4:28 p.m. UTC
toolchain-wrapper was not reinstalled on 'make
toolchain-external-reinstall'

In add, normalize variable name: s/TOOLCHAIN_BUILD_WRAPPER/TOOLCHAIN_WRAPPER_BUILD/

Signed-off-by: Jérôme Pouiller <jezz@sysmic.org>
---
 toolchain/toolchain-external/toolchain-external.mk |  3 ++-
 toolchain/toolchain-wrapper.mk                     | 12 ++++++++----
 2 files changed, 10 insertions(+), 5 deletions(-)

Comments

Thomas Petazzoni Sept. 27, 2016, 4:52 p.m. UTC | #1
Hello,

On Tue, 27 Sep 2016 18:28:32 +0200, Jérôme Pouiller wrote:

> diff --git a/toolchain/toolchain-wrapper.mk b/toolchain/toolchain-wrapper.mk
> index af39071..21690fd 100644
> --- a/toolchain/toolchain-wrapper.mk
> +++ b/toolchain/toolchain-wrapper.mk
> @@ -30,11 +30,15 @@ ifeq ($(BR2_CCACHE_USE_BASEDIR),y)
>  TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE_BASEDIR='"$(BASE_DIR)"'
>  endif
>  
> -# For simplicity, build directly into the install location
> -define TOOLCHAIN_BUILD_WRAPPER
> -	$(Q)mkdir -p $(HOST_DIR)/usr/bin
> +define TOOLCHAIN_WRAPPER_BUILD

If you rename this, you should fix the gcc package, which also uses the
same variable. As it is, your patch breaks the internal toolchain
backend.

>  	$(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_WRAPPER_ARGS) \
>  		-s -Wl,--hash-style=$(TOOLCHAIN_WRAPPER_HASH_STYLE) \
>  		toolchain/toolchain-wrapper.c \
> -		-o $(HOST_DIR)/usr/bin/toolchain-wrapper
> +		-o toolchain/toolchain-wrapper

This is not good: it generates a file in the source tree. You should
consider the source tree as read-only. Anything built by Buildroot
should be generated in the output directory. So, I'd suggest to
generate it in $(@D)/toolchain-wrapper maybe?


> +define TOOLCHAIN_WRAPPER_INSTALL
> +	$(Q)mkdir -p $(HOST_DIR)/usr/bin

Not needed, just use $(INSTALL) with the -D option.

Other than those implementation issues, I agree with the general
principle: the installation to the host directory should only take
place at install time.

Best regards,

Thomas
diff mbox

Patch

diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
index 6fd2742..e9e6340 100644
--- a/toolchain/toolchain-external/toolchain-external.mk
+++ b/toolchain/toolchain-external/toolchain-external.mk
@@ -787,9 +787,10 @@  define TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO
 	fi
 endef
 
-TOOLCHAIN_EXTERNAL_BUILD_CMDS = $(TOOLCHAIN_BUILD_WRAPPER)
+TOOLCHAIN_EXTERNAL_BUILD_CMDS = $(TOOLCHAIN_WRAPPER_BUILD)
 
 define TOOLCHAIN_EXTERNAL_INSTALL_STAGING_CMDS
+	$(TOOLCHAIN_WRAPPER_INSTALL)
 	$(TOOLCHAIN_EXTERNAL_CREATE_STAGING_LIB_SYMLINK)
 	$(TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS)
 	$(TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS_BFIN_FDPIC)
diff --git a/toolchain/toolchain-wrapper.mk b/toolchain/toolchain-wrapper.mk
index af39071..21690fd 100644
--- a/toolchain/toolchain-wrapper.mk
+++ b/toolchain/toolchain-wrapper.mk
@@ -30,11 +30,15 @@  ifeq ($(BR2_CCACHE_USE_BASEDIR),y)
 TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE_BASEDIR='"$(BASE_DIR)"'
 endif
 
-# For simplicity, build directly into the install location
-define TOOLCHAIN_BUILD_WRAPPER
-	$(Q)mkdir -p $(HOST_DIR)/usr/bin
+define TOOLCHAIN_WRAPPER_BUILD
 	$(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_WRAPPER_ARGS) \
 		-s -Wl,--hash-style=$(TOOLCHAIN_WRAPPER_HASH_STYLE) \
 		toolchain/toolchain-wrapper.c \
-		-o $(HOST_DIR)/usr/bin/toolchain-wrapper
+		-o toolchain/toolchain-wrapper
+endef
+
+define TOOLCHAIN_WRAPPER_INSTALL
+	$(Q)mkdir -p $(HOST_DIR)/usr/bin
+	$(INSTALL) -m 0755 toolchain/toolchain-wrapper \
+	    $(HOST_DIR)/usr/bin/toolchain-wrapper
 endef