Save the toolchain configuration to its own file, as an auto-extracting shell script:
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Wed Oct 01 18:10:40 2008 +0000 (2008-10-01)
changeset 894c444ce4b51b9
parent 893 c4f2c434448c
child 895 f673bc71d376
Save the toolchain configuration to its own file, as an auto-extracting shell script:
- get rid of the 'extractconfig' action, it was cumbersome to use, and badly documented,
- introduce a skeleton for the config script,
- update auto-completion,
- document the config script.

/trunk/kconfig/kconfig.mk | 9 2 7 0 ++-------
/trunk/scripts/crosstool.sh | 6 5 1 0 +++++-
/trunk/docs/overview.txt | 21 9 12 0 +++++++++------------
/trunk/tools/toolchain-config.in | 8 8 0 0 ++++++++
/trunk/ct-ng.comp | 2 1 1 0 +-
5 files changed, 25 insertions(+), 21 deletions(-)
ct-ng.comp
docs/overview.txt
kconfig/kconfig.mk
scripts/crosstool.sh
tools/toolchain-config.in
     1.1 --- a/ct-ng.comp	Tue Sep 30 18:19:48 2008 +0000
     1.2 +++ b/ct-ng.comp	Wed Oct 01 18:10:40 2008 +0000
     1.3 @@ -13,7 +13,7 @@
     1.4      start_steps=$(echo "${steps}" |sed -r -e 's/(^| )/\1+/;')
     1.5      stop_steps=$(echo "${steps}" |sed -r -e 's/(^| )/+\1/;')
     1.6  
     1.7 -    actions='config menuconfig oldconfig saveconfig extractconfig
     1.8 +    actions='config menuconfig oldconfig saveconfig
     1.9               list-samples build list-steps regtest regtest-local
    1.10               regtest-global clean distclean wiki-samples updatetools
    1.11               tarball'
     2.1 --- a/docs/overview.txt	Tue Sep 30 18:19:48 2008 +0000
     2.2 +++ b/docs/overview.txt	Wed Oct 01 18:10:40 2008 +0000
     2.3 @@ -283,19 +283,16 @@
     2.4  
     2.5  If you have an existing toolchain, you can re-use the options used to build it
     2.6  to create a new toolchain. That needs a very little bit of effort on your side
     2.7 -but is quite easy. The options to build a toolchain are saved in the build log
     2.8 -file that is saved within the toolchain. crosstool-NG can extract those options
     2.9 -to recreate a new configuration:
    2.10 -  ct-ng extractconfig </path/to/your/build.log >.config
    2.11 +but is quite easy. The options to build a toolchain are saved with the
    2.12 +toolchain, and you can retrieve this configuration by running:
    2.13 +  ${CT_TARGET}-config
    2.14  
    2.15 -will extract those options, prompt you for the new ones, which you can later
    2.16 -edit with menuconfig.
    2.17 +This will dump the configuration to stdout, so to rebuild a toolchain with this
    2.18 +configuration, the following is all you need to do:
    2.19 +  ${CT_TARGET}-config >.config
    2.20  
    2.21 -Of course, if your build log was compressed, you'd have to use something like:
    2.22 -  bzcat /path/to/your/build.log.bz2 |ct-ng extractconfig >.config
    2.23 -
    2.24 -Then, once the configuration has been extracted, run:
    2.25 -  ct-ng oldconfig
    2.26 +Then, you can review and change the configuration by running:
    2.27 +  ct-ng menuconfig
    2.28  
    2.29  ________________________
    2.30                         /
     3.1 --- a/kconfig/kconfig.mk	Tue Sep 30 18:19:48 2008 +0000
     3.2 +++ b/kconfig/kconfig.mk	Wed Oct 01 18:10:40 2008 +0000
     3.3 @@ -7,7 +7,7 @@
     3.4  
     3.5  KCONFIG_TOP = config/config.in
     3.6  obj = $(CT_TOP_DIR)/kconfig
     3.7 -PHONY += clean help oldconfig menuconfig config defoldconfig extractconfig
     3.8 +PHONY += clean help oldconfig menuconfig config defoldconfig
     3.9  
    3.10  # Darwin (MacOS-X) does not have proper libintl support
    3.11  ifeq ($(shell uname -s),Darwin)
    3.12 @@ -114,7 +114,7 @@
    3.13  	  echo "endmenu";                                                   \
    3.14  	 ) >$@
    3.15  
    3.16 -config menuconfig oldconfig defoldconfig extractconfig: $(KCONFIG_TOP)
    3.17 +config menuconfig oldconfig defoldconfig: $(KCONFIG_TOP)
    3.18  
    3.19  $(KCONFIG_TOP):
    3.20  	@ln -sf $(CT_LIB_DIR)/config config
    3.21 @@ -131,16 +131,11 @@
    3.22  defoldconfig: $(CONFIG_FILES) $(obj)/conf
    3.23  	@yes "" |$(obj)/conf -s $(KCONFIG_TOP)
    3.24  
    3.25 -extractconfig: $(CONFIG_FILES) $(obj)/conf
    3.26 -	@$(CT_LIB_DIR)/tools/extract-config.sh >.config
    3.27 -	@$(obj)/conf -s $(KCONFIG_TOP)
    3.28 -
    3.29  # Help text used by make help
    3.30  help-config::
    3.31  	@echo  '  config             - Update current config using a line-oriented program'
    3.32  	@echo  '  menuconfig         - Update current config using a menu based program'
    3.33  	@echo  '  oldconfig          - Update current config using a provided .config as base'
    3.34 -	@echo  '  extractconfig      - Create a new config using options extracted from a'
    3.35  	@echo  '                       build log piped into stdin'
    3.36  
    3.37  # Cheesy build
     4.1 --- a/scripts/crosstool.sh	Tue Sep 30 18:19:48 2008 +0000
     4.2 +++ b/scripts/crosstool.sh	Wed Oct 01 18:10:40 2008 +0000
     4.3 @@ -36,7 +36,7 @@
     4.4  # renice oursleves
     4.5  CT_DoExecLog DEBUG renice ${CT_NICE} $$
     4.6  
     4.7 -CT_DoStep DEBUG "Dumping crosstool-NG configuration"
     4.8 +CT_DoStep DEBUG "Dumping user-supplied crosstool-NG configuration"
     4.9  cat "${CT_TOP_DIR}/.config" |egrep '^(# |)CT_' |CT_DoLog DEBUG
    4.10  CT_EndStep
    4.11  
    4.12 @@ -341,6 +341,10 @@
    4.13      [ ${CT_LOAD} -ne 0 ] && PARALLELMFLAGS="${PARALLELMFLAGS} -l${CT_LOAD}"
    4.14      export PARALLELMFLAGS
    4.15  
    4.16 +    CT_DoLog EXTRA "Installing user-supplied crosstool-NG configuration"
    4.17 +    CT_DoExecLog DEBUG install -m 0755 "${CT_LIB_DIR}/tools/toolchain-config.in" "${CT_PREFIX_DIR}/bin/${CT_TARGET}.ct-ng.config"
    4.18 +    bzip2 -c -9 .config >>"${CT_PREFIX_DIR}/bin/${CT_TARGET}.ct-ng.config"
    4.19 +
    4.20      CT_DoStep EXTRA "Dumping internal crosstool-NG configuration"
    4.21      CT_DoLog EXTRA "Building a toolchain for:"
    4.22      CT_DoLog EXTRA "  build  = ${CT_BUILD}"
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/tools/toolchain-config.in	Wed Oct 01 18:10:40 2008 +0000
     5.3 @@ -0,0 +1,8 @@
     5.4 +#!/bin/sh
     5.5 +
     5.6 +SKIP_ME="### CT_NG SKIP ME ###"
     5.7 +skip_me=$(($(cat "${0}" |grep --binary-files=text -o -b -E "^${SKIP_ME}$" |cut -d : -f 1)+${#SKIP_ME}+1))
     5.8 +dd if="${0}" bs=${skip_me} skip=1 2>/dev/null |bzcat
     5.9 +exit 0
    5.10 +
    5.11 +### CT_NG SKIP ME ###