Patchwork toolchain/crosstool-NG: do not depend on the top-level Buildroot's .config

login
register
mail settings
Submitter Yann E. MORIN
Date March 14, 2013, 6:44 p.m.
Message ID <1363286650-11208-1-git-send-email-yann.morin.1998@free.fr>
Download mbox | patch
Permalink /patch/227782/
State Changes Requested
Headers show

Comments

Yann E. MORIN - March 14, 2013, 6:44 p.m.
Previously, the crosstool-NG backend did depend on the top-level
Buildroot's .config to detect changes in the toolchain options,
using a tentatively-clever heuristic, which also included the full
Buildroot's version string to push down to set the components' versions
strings.

In doing so, any commit in the Buildroot tree would imply a complete
rebuild of the toolchain, even in the case the toolchain options did
not change, thus being a large annoyance (to say the least).

As Buildroot never guaranteed that toolchain options would be detected,
even less handled, and that the internal backend does neither detect nor
act on toolchain options changes, and delegate that to the user, there
is no point in individualising the crosstool-NG backend's behaviour.

So, just drop the not-so-clever heuristic, and just build the toolchain
once, leaving to the user the responsibility to explictly ask Buildroot
to rebuild it.

Reported-by: "Przemyslaw Wrzos" <przemyslaw.wrzos@calyptech.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: "Przemyslaw Wrzos" <przemyslaw.wrzos@calyptech.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 toolchain/toolchain-crosstool-ng/crosstool-ng.mk |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)
Przemyslaw Wrzos - March 15, 2013, 12:08 a.m.
Hello Yann,

On Fri, 15 Mar 2013 at 05:44:10, Yann E. MORIN wrote:

> Previously, the crosstool-NG backend did depend on the top-level
> Buildroot's .config to detect changes in the toolchain options, using
a
> tentatively-clever heuristic, which also included the full Buildroot's
> version string to push down to set the components' versions strings.
>
> (...)
>
> -
> -$(CTNG_DIR)/.config: $(CTNG_CONFIG_FILE) $(BUILDROOT_CONFIG)
> +$(CTNG_DIR)/.config:
>  	$(Q)if [ ! -f $@ ]; then
\
>  	        mkdir -p "$(CTNG_DIR)";
\
>  	        libc="$$(awk -F '"' '$$1=="CT_LIBC=" { print $$2; }'
"$<")";            \
> @@ -383,11 +380,8 @@ $(CTNG_DIR)/.config: $(CTNG_CONFIG_FILE)
> $(BUILDROOT_CONFIG)
>  	        fi;

>            \ 	        cp -f $< $@;

>                        \ 	    fi -	$(Q)cp -a $@
$@.timestamp 	$(call
>  ctng-oldconfig,$@) 	$(call ctng-oldconfig,$@)
> -	$(call ctng-check-config-changed,$@,$@.timestamp)
> -	$(Q)rm -f $@.timestamp
> 
>  # Manual configuration
>  ctng-menuconfig: $(CTNG_DIR)/.config

I think you'll need to replace $< with a direct reference to
$(CTNG_CONFIG_FILE) to make that work.

Cheers,
Przemyslaw Wrzos
Yann E. MORIN - March 15, 2013, 5:52 p.m.
Przemyslaw, All,

On Friday 15 March 2013 Przemyslaw Wrzos wrote:
> On Fri, 15 Mar 2013 at 05:44:10, Yann E. MORIN wrote:
[--SNIP--]
> $@.timestamp 	$(call
> >  ctng-oldconfig,$@) 	$(call ctng-oldconfig,$@)
> > -	$(call ctng-check-config-changed,$@,$@.timestamp)
> > -	$(Q)rm -f $@.timestamp
> > 
> >  # Manual configuration
> >  ctng-menuconfig: $(CTNG_DIR)/.config
> 
> I think you'll need to replace $< with a direct reference to
> $(CTNG_CONFIG_FILE) to make that work.

Indeed. That did not help testing the change with an already-built
toolchain present... :-(

Will resend, thank you!

Regards,
Yann E. MORIN.

Patch

diff --git a/toolchain/toolchain-crosstool-ng/crosstool-ng.mk b/toolchain/toolchain-crosstool-ng/crosstool-ng.mk
index 6554982..9d503b0 100644
--- a/toolchain/toolchain-crosstool-ng/crosstool-ng.mk
+++ b/toolchain/toolchain-crosstool-ng/crosstool-ng.mk
@@ -362,16 +362,13 @@  endef
 $(CTNG_DIR)/.config: | host-crosstool-ng
 
 # Default configuration
-# Depends on top-level .config because it has options we have to shoe-horn
-# into crosstool-NG's .config
 # Only copy the original .config file if we don't have one already.
 # Check that given config file matches selected C library.
 # We need to call oldconfig twice in a row to ensure the options
 # are correctly set ( eg. if an option is new, then the initial sed
 # can't do anything about it ) Ideally, this should go in oldconfig
 # itself, but it's much easier to handle here.
-
-$(CTNG_DIR)/.config: $(CTNG_CONFIG_FILE) $(BUILDROOT_CONFIG)
+$(CTNG_DIR)/.config:
 	$(Q)if [ ! -f $@ ]; then                                                        \
 	        mkdir -p "$(CTNG_DIR)";                                                 \
 	        libc="$$(awk -F '"' '$$1=="CT_LIBC=" { print $$2; }' "$<")";            \
@@ -383,11 +380,8 @@  $(CTNG_DIR)/.config: $(CTNG_CONFIG_FILE) $(BUILDROOT_CONFIG)
 	        fi;                                                                     \
 	        cp -f $< $@;                                                            \
 	    fi
-	$(Q)cp -a $@ $@.timestamp
 	$(call ctng-oldconfig,$@)
 	$(call ctng-oldconfig,$@)
-	$(call ctng-check-config-changed,$@,$@.timestamp)
-	$(Q)rm -f $@.timestamp
 
 # Manual configuration
 ctng-menuconfig: $(CTNG_DIR)/.config