toolchain/crosstool-NG: fixes before release, v2
cover toolchain/crosstool-NG: fixes before release, v2
Hello All!
This patch series enables building on a minimalistic host (patch 1, tested in the same mini-environemnt as Thomas), adds some infrastructure (patches 2-5) to be able to push Buildroot options down to uClibc's config (patches 6-10).
Changes since v1:
- use order-only dependencies on host tools
[PATCH 01/10] toolchain/crosstool-NG: add dependencies on host- tools [PATCH 02/10] toolchain/crosstool-NG: reorder sed expressions [PATCH 03/10] toolchain/crosstool-NG: use a copy of the uClibc .config [PATCH 04/10] toolchain/crosstool-NG: move munging functions [PATCH 05/10] toolchain/crosstool-NG: add C library config munging [PATCH 06/10] toolchain/crosstool-NG: use wide-char option [PATCH 07/10] toolchain/crosstool-NG: use locales option [PATCH 08/10] toolchain/crosstool-NG: use LFS option
[PATCH 09/10] toolchain/crosstool-NG: use IPv6 option [PATCH 10/10] toolchain/crosstool-NG: use RPC option
toolchain/toolchain-crosstool-ng/001-no-cvs.patch | 15 ++ toolchain/toolchain-crosstool-ng/crosstool-ng.mk | 146 ++++++++++++++++----- 2 files changed, 127 insertions(+), 34 deletions(-)
Regards,
Yann E. MORIN.
PATCH 1/10 toolchain/crosstool-NG: add dependencies on host- tools
Depends on:
- GNU awk --> host-gawk
- GNU automake --> host-automake
Remove dependency on 'cvs'. cvs is used to retrieve newlib, which is not supported under Buildroot.
--- toolchain/toolchain-crosstool-ng/001-no-cvs.patch | 15 +++++++++++++++ toolchain/toolchain-crosstool-ng/crosstool-ng.mk | 10 +++++++++- 2 files changed, 24 insertions(+), 1 deletions(-) create mode 100644 toolchain/toolchain-crosstool-ng/001-no-cvs.patch
toolchain/toolchain-crosstool-ng/001-no-cvs.patch new file +15 -0
@@ -0,0 +1,15 @@ +Remove dependency on cvs. + +cvs is used to retrieve newlib, which is not supported +under Buildroot, so cvs is not required. + +--- crosstool-ng-1.8.0/configure.orig 2010-11-27 15:43:52.000000000 +0000 ++++ crosstool-ng-1.8.0/configure 2010-11-27 15:44:10.000000000 +0000 +@@ -359,7 +359,6 @@ + err="'libtool' 1.5.26 or above was not found" + has_or_abort prog=stat + has_or_abort prog="aria2c curl wget" +-has_or_abort prog=cvs + has_or_abort prog=patch + has_or_abort prog=tar + has_or_abort prog=gzip
toolchain/toolchain-crosstool-ng/crosstool-ng.mk +9 -1
@@ -267,8 +267,16 @@ $(CTNG_DIR)/.patched: $(CTNG_DIR)/.unpacked \*.patch.$(ARCH) $(Q)touch $@ +# Use order-only dependencies on host-* as they +# are virtual targets with no rules, and so are +# considered always remade. But we do not want +# to reconfigure and rebuild ct-ng every time +# we need to run it... +$(CTNG_DIR)/.configured: | host-gawk \ + host-automake + $(CTNG_DIR)/.configured: $(CTNG_DIR)/.patched - $(Q)cd $(CTNG_DIR) && ./configure --local + $(Q)cd $(CTNG_DIR) && PATH=$(HOST_PATH) ./configure --local $(Q)touch $@ $(CTNG_DIR)/ct-ng: $(CTNG_DIR)/.configured
Signature · 1 line
1.7.1
PATCH 2/10 toolchain/crosstool-NG: reorder sed expressions
In reply to Yann E. MORIN--- toolchain/toolchain-crosstool-ng/crosstool-ng.mk | 20 +++++++++++++++++--- 1 files changed, 17 insertions(+), 3 deletions(-)
toolchain/toolchain-crosstool-ng/crosstool-ng.mk +17 -3
@@ -85,6 +85,15 @@ $(STAMP_DIR)/ct-ng-toolchain-built: $(CTNG_DIR)/.config #----------------------------------------------------------------------------- # Configuring the toolchain +#-------------- +# We push BR options down to CT-NG, munging the default configuration +# with sed expressions. +# - first one for non-path options +# - second for path options (because they have no prompt, they +# always get set to the default value) +CTNG_FIX_DOT_CONFIG_SED := +CTNG_FIX_DOT_CONFIG_PATHS_SED := + # Note: a lot of the following tricks would become unneeded if one day # buildroot and crosstool-NG had matching options, especially for the # target description: arch name, bitness, endianness...
@@ -151,8 +160,6 @@ endif # with BR2 config options. # Known missing: arch variant & options, floating point (HW/SW), uClibc/eglibc config... # - -CTNG_FIX_DOT_CONFIG_SED := CTNG_FIX_DOT_CONFIG_SED += s:^(CT_INSTALL_DIR_RO)=y:\# \1 is not set:; CTNG_FIX_DOT_CONFIG_SED += s:^(|\# )(CT_ARCH_[BL]E).*:\# \2 is not set:; CTNG_FIX_DOT_CONFIG_SED += s:^\# (CT_ARCH_$(CTNG_ENDIAN)) is not set:\1=y:;
@@ -173,10 +180,12 @@ endif #-------------- # And the specials for paths -CTNG_FIX_DOT_CONFIG_PATHS_SED := CTNG_FIX_DOT_CONFIG_PATHS_SED += s:^(CT_PREFIX_DIR)=.*:\1="$(TOOLCHAIN_DIR)":; CTNG_FIX_DOT_CONFIG_PATHS_SED += s:^(CT_LOCAL_TARBALLS_DIR)=.*:\1="$(DL_DIR)":; CTNG_FIX_DOT_CONFIG_PATHS_SED += s:^(CT_SYSROOT_DIR_PREFIX)=.*:\1="":; + +#-------------- +# uClibc specific options ifeq ($(BR2_TOOLCHAIN_CTNG_uClibc),y) CTNG_FIX_DOT_CONFIG_PATHS_SED += s:^(CT_LIBC_UCLIBC_CONFIG_FILE)=.*:\1="$(CTNG_UCLIBC_CONFIG_FILE)":; endif
@@ -230,9 +239,14 @@ endef # 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 +# 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) $(CTNG_DIR)/ct-ng $(CONFIG_DIR)/.config $(Q)[ -f $@ ] && cp -a $@ [email protected] || cp -f $< $@ $(call ctng-oldconfig,$@) + $(call ctng-oldconfig,$@) $(call ctng-check-config-changed,$@,[email protected]) $(Q)rm -f [email protected]
Signature · 1 line
1.7.1
PATCH 3/10 toolchain/crosstool-NG: use a copy of the uClibc .config
In reply to Yann E. MORINBefore we can munge the uClibc .config file, we have to use a copy.
--- toolchain/toolchain-crosstool-ng/crosstool-ng.mk | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-)
toolchain/toolchain-crosstool-ng/crosstool-ng.mk +14 -2
@@ -76,6 +76,8 @@ $(STAMP_DIR)/ct-ng-toolchain-installed: $(STAMP_DIR)/ct-ng-toolchain-built #----------------------------------------------------------------------------- # Building the toolchain +# Note: $(STAMP_DIR)/ct-ng-toolchain-built can have more dependencies, +# depending on the selected C library. Those deps are added later $(STAMP_DIR)/ct-ng-toolchain-built: $(CTNG_DIR)/.config $(Q)$(call ctng,build.$(BR2_JLEVEL))
@@ -187,8 +189,18 @@ CTNG_FIX_DOT_CONFIG_PATHS_SED += s:^(CT_SYSROOT_DIR_PREFIX)=.*:\1="":; #-------------- # uClibc specific options ifeq ($(BR2_TOOLCHAIN_CTNG_uClibc),y) -CTNG_FIX_DOT_CONFIG_PATHS_SED += s:^(CT_LIBC_UCLIBC_CONFIG_FILE)=.*:\1="$(CTNG_UCLIBC_CONFIG_FILE)":; -endif + +# Instruct CT-NG's .config where to find the uClibc's .config +CTNG_FIX_DOT_CONFIG_PATHS_SED += s:^(CT_LIBC_UCLIBC_CONFIG_FILE)=.*:\1="$(CTNG_DIR)/libc.config":; + +# And add this to the toolchain build dependency +$(STAMP_DIR)/ct-ng-toolchain-built: $(CTNG_DIR)/libc.config + +# And here is how we get this uClibc's .config +$(CTNG_DIR)/libc.config: $(CTNG_UCLIBC_CONFIG_FILE) + $(Q)cp -f $< $@ + +endif # LIBC is uClibc #-------------- # Small functions to shoe-horn the above into crosstool-NG's .config
Signature · 1 line
1.7.1
PATCH 4/10 toolchain/crosstool-NG: move munging functions
In reply to Yann E. MORIN--- toolchain/toolchain-crosstool-ng/crosstool-ng.mk | 62 ++++++++++++---------- 1 files changed, 34 insertions(+), 28 deletions(-)
toolchain/toolchain-crosstool-ng/crosstool-ng.mk +34 -28
@@ -96,15 +96,46 @@ $(STAMP_DIR)/ct-ng-toolchain-built: $(CTNG_DIR)/.config CTNG_FIX_DOT_CONFIG_SED := CTNG_FIX_DOT_CONFIG_PATHS_SED := +#-------------- +# A few generic functions + +# Munge a config file, given a sed expression +# $1: the .config file to munge +# $2: the sed expression to apply +define ctng-fix-dot-config + $(Q)sed -r -e '$(2)' $(1) >$(1).sed + $(Q)cmp $(1) $(1).sed >/dev/null 2>&1 && rm -f $(1).sed || mv -f $(1).sed $(1) +endef + +# This function checks the .config did actually change +# If not changed, then current .config will be touched with reference to the +# stamp file. If the configuration did change, nothing is done. +# $1: the current .config to check +# $2: the time-stamped .config file +define ctng-check-config-changed + $(Q)old_md5="$$( grep -v -E '^(#|$$)' $(2) 2>/dev/null \ + |md5sum \ + |cut -d ' ' -f 1 \ + )"; \ + new_md5="$$( grep -v -E '^(#|$$)' $(1) 2>/dev/null \ + |md5sum \ + |cut -d ' ' -f 1 \ + )"; \ + if [ $${old_md5} = $${new_md5} -a -f $(2) ]; then \ + touch -r $(2) $(1); \ + fi +endef + +#-------------- +# Massage BR2_ARCH so that it matches CT-NG's ARCH +# # Note: a lot of the following tricks would become unneeded if one day # buildroot and crosstool-NG had matching options, especially for the # target description: arch name, bitness, endianness... - +# # Note-2: missing conformity check between BR's .config and libc features. # Use check_uclibc or check_glibc. -#-------------- -# Massage BR2_ARCH so that it matches CT-NG's ARCH # Defaults: CTNG_ARCH := $(CTNG_BR2_ARCH) CTNG_ENDIAN :=
@@ -204,12 +235,6 @@ endif # LIBC is uClibc #-------------- # Small functions to shoe-horn the above into crosstool-NG's .config -# $1: the .config file to munge -# $2: the sed expression to apply -define ctng-fix-dot-config - $(Q)sed -r -e '$(2)' $(1) >$(1).sed - $(Q)cmp $(1) $(1).sed >/dev/null 2>&1 && rm -f $(1).sed || mv -f $(1).sed $(1) -endef # Function to update the .config # We first munge the .config to shoe-horn defaults, then we push that unto
@@ -228,25 +253,6 @@ define ctng-oldconfig $(call ctng-fix-dot-config,$(1),$(CTNG_FIX_DOT_CONFIG_PATHS_SED)) endef -# This function checks the confguration of the toolchain did actually change -# If not changed, then current .config will be touched with reference to the -# stamp file. If the configuration did change, nothing is done. -# $1: the current .config to check -# $2: the time-stamped .config file -define ctng-check-config-changed - $(Q)old_md5="$$( grep -v -E '^(#|$$)' $(2) 2>/dev/null \ - |md5sum \ - |cut -d ' ' -f 1 \ - )"; \ - new_md5="$$( grep -v -E '^(#|$$)' $(1) 2>/dev/null \ - |md5sum \ - |cut -d ' ' -f 1 \ - )"; \ - if [ $${old_md5} = $${new_md5} -a -f $(2) ]; then \ - touch -r $(2) $(1); \ - fi -endef - # Default configuration # Depends on top-level .config because it has options we have to shoe-horn # into crosstool-NG's .config
Signature · 1 line
1.7.1
PATCH 5/10 toolchain/crosstool-NG: add C library config munging
In reply to Yann E. MORINFor some C libraries, it can be necessary to push the BR settings down to the libc configuration file. Prepare the infrastructure.
(Note: it will apply only to uClibc for now, and although eglibc can also be configured, it is not currently supported)
--- toolchain/toolchain-crosstool-ng/crosstool-ng.mk | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
toolchain/toolchain-crosstool-ng/crosstool-ng.mk +7 -1
@@ -93,8 +93,10 @@ $(STAMP_DIR)/ct-ng-toolchain-built: $(CTNG_DIR)/.config # - first one for non-path options # - second for path options (because they have no prompt, they # always get set to the default value) +# - third for C library .config (if it has one, eg. uClibc) CTNG_FIX_DOT_CONFIG_SED := CTNG_FIX_DOT_CONFIG_PATHS_SED := +CTNG_FIX_DOT_CONFIG_LIBC_SED := #-------------- # A few generic functions
@@ -228,8 +230,12 @@ CTNG_FIX_DOT_CONFIG_PATHS_SED += s:^(CT_LIBC_UCLIBC_CONFIG_FILE)=.*:\1="$(CTNG_D $(STAMP_DIR)/ct-ng-toolchain-built: $(CTNG_DIR)/libc.config # And here is how we get this uClibc's .config -$(CTNG_DIR)/libc.config: $(CTNG_UCLIBC_CONFIG_FILE) +$(CTNG_DIR)/libc.config: $(CTNG_UCLIBC_CONFIG_FILE) $(CONFIG_DIR)/.config + -$(Q)cp -a $@ [email protected] $(Q)cp -f $< $@ + $(call ctng-fix-dot-config,$@,$(CTNG_FIX_DOT_CONFIG_LIBC_SED)) + $(call ctng-check-config-changed,$@,[email protected]) + $(Q)rm -f [email protected] endif # LIBC is uClibc
Signature · 1 line
1.7.1
PATCH 6/10 toolchain/crosstool-NG: use wide-char option
In reply to Yann E. MORINPush the wide-char options down to crosstool-NG config
--- toolchain/toolchain-crosstool-ng/crosstool-ng.mk | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
toolchain/toolchain-crosstool-ng/crosstool-ng.mk +7 -0
@@ -223,6 +223,13 @@ CTNG_FIX_DOT_CONFIG_PATHS_SED += s:^(CT_SYSROOT_DIR_PREFIX)=.*:\1="":; # uClibc specific options ifeq ($(BR2_TOOLCHAIN_CTNG_uClibc),y) +# Handle the wide-char option +ifneq ($(call qstrip,$(BR2_USE_WCHAR)),) +CTNG_FIX_DOT_CONFIG_SED += s:^\# (CT_LIBC_UCLIBC_WCHAR) is not set:\1=y:; +else +CTNG_FIX_DOT_CONFIG_SED += s:^(CT_LIBC_UCLIBC_WCHAR)=.*:\# \1 is not set:; +endif + # Instruct CT-NG's .config where to find the uClibc's .config CTNG_FIX_DOT_CONFIG_PATHS_SED += s:^(CT_LIBC_UCLIBC_CONFIG_FILE)=.*:\1="$(CTNG_DIR)/libc.config":;
Signature · 1 line
1.7.1
PATCH 7/10 toolchain/crosstool-NG: use locales option
In reply to Yann E. MORINPush the locales option down to crosstool-NG config
--- toolchain/toolchain-crosstool-ng/crosstool-ng.mk | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
toolchain/toolchain-crosstool-ng/crosstool-ng.mk +8 -0
@@ -223,6 +223,14 @@ CTNG_FIX_DOT_CONFIG_PATHS_SED += s:^(CT_SYSROOT_DIR_PREFIX)=.*:\1="":; # uClibc specific options ifeq ($(BR2_TOOLCHAIN_CTNG_uClibc),y) +# Handle the locales option +ifneq ($(call qstrip,$(BR2_ENABLE_LOCALE)),) +CTNG_FIX_DOT_CONFIG_SED += s:^\# (CT_LIBC_UCLIBC_LOCALES) is not set:\1=y\n\# CT_LIBC_UCLIBC_LOCALES_PREGEN_DATA is not set:; +CTNG_FIX_DOT_CONFIG_SED += s:^(CT_LIBC_UCLIBC_LOCALES_PREGEN_DATA)=.*:\# \1 is not set:; +else +CTNG_FIX_DOT_CONFIG_SED += s:^(CT_LIBC_UCLIBC_LOCALES)=.*:\# \1 is not set:; +endif + # Handle the wide-char option ifneq ($(call qstrip,$(BR2_USE_WCHAR)),) CTNG_FIX_DOT_CONFIG_SED += s:^\# (CT_LIBC_UCLIBC_WCHAR) is not set:\1=y:;
Signature · 1 line
1.7.1
PATCH 8/10 toolchain/crosstool-NG: use LFS option
In reply to Yann E. MORINPush the LFS option down to uClibc config
--- toolchain/toolchain-crosstool-ng/crosstool-ng.mk | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
toolchain/toolchain-crosstool-ng/crosstool-ng.mk +7 -0
@@ -238,6 +238,13 @@ else CTNG_FIX_DOT_CONFIG_SED += s:^(CT_LIBC_UCLIBC_WCHAR)=.*:\# \1 is not set:; endif +# Handle the LFS option +ifneq ($(call qstrip,$(BR2_LARGEFILE)),) +CTNG_FIX_DOT_CONFIG_LIBC_SED += s:^\# (UCLIBC_HAS_LFS) is not set:\1=y:; +else +CTNG_FIX_DOT_CONFIG_LIBC_SED += s:^(UCLIBC_HAS_LFS)=.*:\# \1 is not set:; +endif + # Instruct CT-NG's .config where to find the uClibc's .config CTNG_FIX_DOT_CONFIG_PATHS_SED += s:^(CT_LIBC_UCLIBC_CONFIG_FILE)=.*:\1="$(CTNG_DIR)/libc.config":;
Signature · 1 line
1.7.1
PATCH 9/10 toolchain/crosstool-NG: use IPv6 option
In reply to Yann E. MORINPush the IPv6 option down to uClibc config
--- toolchain/toolchain-crosstool-ng/crosstool-ng.mk | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
toolchain/toolchain-crosstool-ng/crosstool-ng.mk +7 -0
@@ -245,6 +245,13 @@ else CTNG_FIX_DOT_CONFIG_LIBC_SED += s:^(UCLIBC_HAS_LFS)=.*:\# \1 is not set:; endif +# Handle the IPv6 option +ifneq ($(call qstrip,$(BR2_INET_IPV6)),) +CTNG_FIX_DOT_CONFIG_LIBC_SED += s:^\# (UCLIBC_HAS_IPV6) is not set:\1=y:; +else +CTNG_FIX_DOT_CONFIG_LIBC_SED += s:^(UCLIBC_HAS_IPV6)=.*:\# \1 is not set:; +endif + # Instruct CT-NG's .config where to find the uClibc's .config CTNG_FIX_DOT_CONFIG_PATHS_SED += s:^(CT_LIBC_UCLIBC_CONFIG_FILE)=.*:\1="$(CTNG_DIR)/libc.config":;
Signature · 1 line
1.7.1
PATCH 10/10 toolchain/crosstool-NG: use RPC option
In reply to Yann E. MORINPush the RPC option down to uClibc config
--- toolchain/toolchain-crosstool-ng/crosstool-ng.mk | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
toolchain/toolchain-crosstool-ng/crosstool-ng.mk +9 -0
@@ -252,6 +252,15 @@ else CTNG_FIX_DOT_CONFIG_LIBC_SED += s:^(UCLIBC_HAS_IPV6)=.*:\# \1 is not set:; endif +# Handle the RPC option +ifneq ($(call qstrip,$(BR2_INET_RPC)),) +CTNG_FIX_DOT_CONFIG_LIBC_SED += s:^\# (UCLIBC_HAS_RPC) is not set:\1=y\nUCLIBC_HAS_FULL_RPC=y\nUCLIBC_HAS_REENTRANT_RPC=y:; +CTNG_FIX_DOT_CONFIG_LIBC_SED += s:^\# (UCLIBC_HAS_FULL_RPC) is not set:\1=y:; +CTNG_FIX_DOT_CONFIG_LIBC_SED += s:^\# (UCLIBC_HAS_REENTRANT_RPC) is not set:\1=y:; +else +CTNG_FIX_DOT_CONFIG_LIBC_SED += s:^(UCLIBC_HAS_RPC)=.*:\# \1 is not set:; +endif + # Instruct CT-NG's .config where to find the uClibc's .config CTNG_FIX_DOT_CONFIG_PATHS_SED += s:^(CT_LIBC_UCLIBC_CONFIG_FILE)=.*:\1="$(CTNG_DIR)/libc.config":;
Signature · 1 line
1.7.1
cover toolchain/crosstool-NG: fixes before release, v2
In reply to Yann E. MORINQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Yann" == Yann E MORIN <[email protected]> writes:
Yann> Hello All!
Yann> This patch series enables building on a minimalistic host (patch Yann> 1, tested in the same mini-environemnt as Thomas), adds some Yann> infrastructure (patches 2-5) to be able to push Buildroot options Yann> down to uClibc's config (patches 6-10).
Committed, thanks!
Yann> Changes since v1:
Yann> - use order-only dependencies on host tools
Signature · 1 line
Bye, Peter Korsgaard