Skip to contentSkip to conversation

Pull request for branch yem-export-vars

GIT PULL New Yann E. MORIN 2 participants 10 messages Jan 13, 2013 – Jan 14, 2013 Kbuild

lore
Share & tools
lore
#0 lore raw

Hello All!

This series introduces exporting a variable, $(BUILDROOT_CONFIG), that contains the fully-qualified path to out .config.

In some cases, scripts in support/ need to parse our .config (eg. the dependency-checking script needs to check the conformity of rxternal toolchain features).

Also, some Makefile fragments (eg. the crosstool-Ng backend) need to refer to this config file for make-dependency-checking.

This was currently done in different ad-hoc manners, and is not scalable.

I'll also use it later to retrieve the password encoding scheme when creating users from packages.

Changes v1 -> v2:
- rename BR2_CONFIG_FILE -> BUILDROOT_CONFIG (Arnout)
- use $(BUILDROOT_CONFIG) in top-level Makefile, too (Arnout)

The following changes since commit 766862434b728c3d647b5544844d305edd5f541a:

qwt: bump version (2013-01-13 22:43:23 +0100)

are available in the git repository at:
git://gitorious.org/buildroot/buildroot.git yem-export-vars

Yann E. MORIN (4):
Makefile: export a few variables to help support scripts
Makefile: use newly-introduced BUILDROOT_CONFIG support/dependencies: use newly-introduced BUILDROOT_CONFIG toolchain/crostool-ng: use newly-introduced BUILDROOT_CONFIG

 Makefile                                         |   27 ++++--
 docs/manual/customize-rootfs.txt                 |    7 ++
 support/dependencies/dependencies.mk             |    1 -
 support/dependencies/dependencies.sh             |   10 +-
 toolchain/toolchain-crosstool-ng/crosstool-ng.mk |  114 +++++++++++-----------
 5 files changed, 88 insertions(+), 71 deletions(-)

Regards,
Yann E. MORIN

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#1 lore raw

PATCH 1/4 Makefile: export a few variables to help support scripts

Support scripts (in support/) may need to parse the .config file, so give them an easy access to it, by exporting BUILDROOT_CONFIG with the fully- qualified path to .config.

Also, post-build scripts may need to reference a few locations, so export those, too.

Note: we export both O and BASE_DIR. Although they are the same, BASE_DIR is used internally, while O is used on the command line, which makes it a bit ambiguous to know which to use. As users use O= on the command line, they will probably tend to use that in their post-build scripts.

Update doc accordingly.

Cc Arnout Vandecappelle <[email protected]>
Cc Thomas Petazzoni <[email protected]>
cc Peter Korsgaard <[email protected]>
---
 Makefile                         |   11 +++++++++++
 docs/manual/customize-rootfs.txt |    7 +++++++
 2 files changed, 18 insertions(+), 0 deletions(-)
Makefile +11 -0
index 074674a..5a83251 100644
@@ -91,6 +91,8 @@ EXTRAMAKEARGS = O=$(O)
 NEED_WRAPPER=y
 endif
 
+BUILDROOT_CONFIG=$(CONFIG_DIR)/.config
+
 # Pull in the user's configuration file
 ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
 -include $(CONFIG_DIR)/.config
@@ -282,6 +284,15 @@ HOSTCC  := $(CCACHE) $(HOSTCC)
 HOSTCXX := $(CCACHE) $(HOSTCXX)
 endif
 
+# Scripts in support/ or post-build scripts may need to reference
+# these locations, so export them so it is easier to use
+export BUILDROOT_CONFIG
+export TARGET_DIR
+export STAGING_DIR
+export HOST_DIR
+export BINARIES_DIR
+export BASE_DIR O   # O and BASE_DIR are the same
+
 #############################################################
 #
 # You should probably leave this stuff alone unless you know
docs/manual/customize-rootfs.txt +7 -0
index a1a556b..fe3ea7e 100644
@@ -37,6 +37,13 @@ there are a few ways to customize the resulting target filesystem.
   certain package generates wrong or unneeded files, you should fix
   that package rather than work around it with a post-build cleanup
   script. _Among these first 3 methods, this one should be preferred_.
+  You may also use these variables in your post-build script:
+    - +BUILDROOT_CONFIG+: the path to the Buildroot .config file
+    - +HOST_DIR+, +STAGING_DIR+, +TARGET_DIR+: see
+      xref:generic-package-reference[]
+    - +BINARIES_DIR+: the place were all binary files (aka images) are
+      stored
+    - +BASE_DIR+ (or +O+): the base output directory
 
 * A special package, 'customize', stored in +package/customize+ can be
   used. You can put all the files that you want to see in the final
Signature · 1 line
1.7.2.5
#2 lore raw

PATCH 1/4 Makefile: export a few variables to help support scripts

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Yann> Support scripts (in support/) may need to parse the .config file, so give Yann> them an easy access to it, by exporting BUILDROOT_CONFIG with the fully- Yann> qualified path to .config.

Yann> Also, post-build scripts may need to reference a few locations, so export Yann> those, too.

Yann> Note: we export both O and BASE_DIR. Although they are the same, Yann> BASE_DIR is used internally, while O is used on the command line, Yann> which makes it a bit ambiguous to know which to use. As users use Yann> O= on the command line, they will probably tend to use that in Yann> their post-build scripts.

Ok. I guess most people don't need the upper O/BASE_DIR variables, but lets add the for completeness.

Yann> +++ b/docs/manual/customize-rootfs.txt
Yann> @@ -37,6 +37,13 @@ there are a few ways to customize the resulting target filesystem.

 Yann>    certain package generates wrong or unneeded files, you should fix
 Yann>    that package rather than work around it with a post-build cleanup
 Yann>    script. _Among these first 3 methods, this one should be preferred_.
 Yann> +  You may also use these variables in your post-build script:

Yann> + - +BUILDROOT_CONFIG+: the path to the Buildroot .config file
Yann> + - +HOST_DIR+, +STAGING_DIR+, +TARGET_DIR+: see
Yann> + xref:generic-package-reference[]
Yann> + - +BINARIES_DIR+: the place were all binary files (aka images) are

s/were/where/

Committed with the typo fixed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH 1/4 Makefile: export a few variables to help support scripts

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

"Peter" == Peter Korsgaard <[email protected]> writes:

"Yann" == Yann E MORIN <[email protected]> writes:

Yann> Support scripts (in support/) may need to parse the .config file, so give Yann> them an easy access to it, by exporting BUILDROOT_CONFIG with the fully- Yann> qualified path to .config.

Yann> Also, post-build scripts may need to reference a few locations, so export Yann> those, too.

Yann> Note: we export both O and BASE_DIR. Although they are the same, Yann> BASE_DIR is used internally, while O is used on the command line, Yann> which makes it a bit ambiguous to know which to use. As users use Yann> O= on the command line, they will probably tend to use that in Yann> their post-build scripts.

Peter> Ok. I guess most people don't need the upper O/BASE_DIR variables, but Peter> lets add the for completeness.

And even worse, other projects also use the O=<dir> syntax for out of tree, and atleast uClibc doesn't check that it gets explictly passed on the command line, breaking the build.

So I'll remove the O.

Signature · 1 line
Bye, Peter Korsgaard
#4 lore raw

PATCH 1/4 Makefile: export a few variables to help support scripts

Peter, All,

On Monday 14 January 2013 Peter Korsgaard wrote:
[--SNIP--]

Quoted 5 lines

And even worse, other projects also use the O=<dir> syntax for out of tree, and atleast uClibc doesn't check that it gets explictly passed on the command line, breaking the build.

So I'll remove the O.

Yes, as an afterthought, exporting $(O) was bad.

I was able to build both busybox and the Linux kernel with $(O), and I did not think about uClibc. Ough... :-( And yesterday was too late for me to spend more time on it, and removing $(O) would have been the first thing I would have tried tonight. Sorry for the mess...

Thanks for the quick fix!

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#5 lore raw

PATCH 1/4 Makefile: export a few variables to help support scripts

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Hi,

Yann> Yes, as an afterthought, exporting $(O) was bad.

Yann> I was able to build both busybox and the Linux kernel with $(O), Yann> and I did not think about uClibc. Ough... :-( And yesterday was Yann> too late for me to spend more time on it, and removing $(O) would Yann> have been the first thing I would have tried tonight. Sorry for Yann> the mess...

No problem...

Signature · 1 line
Bye, Peter Korsgaard
#6 lore raw

PATCH 2/4 Makefile: use newly-introduced BUILDROOT_CONFIG

In reply to Yann E. MORIN
---
 Makefile |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
Makefile +8 -8
index 5a83251..16b5ef4 100644
@@ -95,7 +95,7 @@ BUILDROOT_CONFIG=$(CONFIG_DIR)/.config
 
 # Pull in the user's configuration file
 ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
--include $(CONFIG_DIR)/.config
+-include $(BUILDROOT_CONFIG)
 endif
 
 # To put more focus on warnings, be less verbose as default
@@ -383,7 +383,7 @@ dirs: $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
 
 $(BASE_TARGETS): dirs $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake
 
-$(BUILD_DIR)/buildroot-config/auto.conf: $(CONFIG_DIR)/.config
+$(BUILD_DIR)/buildroot-config/auto.conf: $(BUILDROOT_CONFIG)
 	$(MAKE) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" silentoldconfig
 
 prepare: $(BUILD_DIR)/buildroot-config/auto.conf
@@ -557,7 +557,7 @@ legal-info-prepare: $(LEGAL_INFO_DIR)
 	@$(call legal-manifest,buildroot,$(BR2_VERSION_FULL),GPLv2+,COPYING,not saved)
 	@$(call legal-warning,the Buildroot source code has not been saved)
 	@$(call legal-warning,the toolchain has not been saved)
-	@cp $(CONFIG_DIR)/.config $(LEGAL_INFO_DIR)/buildroot.config
+	@cp $(BUILDROOT_CONFIG) $(LEGAL_INFO_DIR)/buildroot.config
 
 legal-info: dirs legal-info-clean legal-info-prepare $(REDIST_SOURCES_DIR) \
 		$(TARGETS_LEGAL_INFO)
@@ -590,7 +590,7 @@ COMMON_CONFIG_ENV = \
 	KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
 	KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
 	KCONFIG_TRISTATE=$(BUILD_DIR)/buildroot-config/tristate.config \
-	BUILDROOT_CONFIG=$(CONFIG_DIR)/.config
+	BUILDROOT_CONFIG=$(BUILDROOT_CONFIG)
 
 xconfig: $(BUILD_DIR)/buildroot-config/qconf outputmakefile
 	@mkdir -p $(BUILD_DIR)/buildroot-config
@@ -630,7 +630,7 @@ allnoconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 
 randpackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 	@mkdir -p $(BUILD_DIR)/buildroot-config
-	@grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg
+	@grep -v BR2_PACKAGE_ $(BUILDROOT_CONFIG) > $(CONFIG_DIR)/.config.nopkg
 	@grep '^config BR2_PACKAGE_' Config.in.legacy | \
 		while read config pkg; do \
 		echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
@@ -641,7 +641,7 @@ randpackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 
 allyespackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 	@mkdir -p $(BUILD_DIR)/buildroot-config
-	@grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg
+	@grep -v BR2_PACKAGE_ $(BUILDROOT_CONFIG) > $(CONFIG_DIR)/.config.nopkg
 	@grep '^config BR2_PACKAGE_' Config.in.legacy | \
 		while read config pkg; do \
 		echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
@@ -652,7 +652,7 @@ allyespackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 
 allnopackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
 	@mkdir -p $(BUILD_DIR)/buildroot-config
-	@grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg
+	@grep -v BR2_PACKAGE_ $(BUILDROOT_CONFIG) > $(CONFIG_DIR)/.config.nopkg
 	@$(COMMON_CONFIG_ENV) \
 		KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
 		$< --allnoconfig $(CONFIG_CONFIG_IN)
@@ -706,7 +706,7 @@ endif
 ifeq ($(O),output)
 	rm -rf $(O)
 endif
-	rm -rf $(CONFIG_DIR)/.config $(CONFIG_DIR)/.config.old $(CONFIG_DIR)/.auto.deps
+	rm -rf $(BUILDROOT_CONFIG) $(CONFIG_DIR)/.config.old $(CONFIG_DIR)/.auto.deps
 
 cross: $(BASE_TARGETS)
 
Signature · 1 line
1.7.2.5
#7 lore raw

PATCH 3/4 support/dependencies: use newly-introduced BUILDROOT_CONFIG

In reply to Yann E. MORIN

No need to recreate a path we already have.

---
 support/dependencies/dependencies.mk |    1 -
 support/dependencies/dependencies.sh |   10 +++++-----
 2 files changed, 5 insertions(+), 6 deletions(-)
support/dependencies/dependencies.mk +0 -1
index cee2a48..ebe743a 100644
@@ -22,7 +22,6 @@ endif
 
 core-dependencies:
 	@HOSTCC="$(firstword $(HOSTCC))" MAKE="$(MAKE)" \
-		CONFIG_FILE="$(CONFIG_DIR)/.config" \
 		DL_TOOLS="$(sort $(DL_TOOLS_DEPENDENCIES))" \
 		$(TOPDIR)/support/dependencies/dependencies.sh
 
support/dependencies/dependencies.sh +5 -5
index ca58450..acba57c 100755
@@ -147,8 +147,8 @@ for prog in awk bison flex msgfmt makeinfo patch gzip bzip2 perl tar wget cpio p
     fi
 done
 
-if grep ^BR2_TOOLCHAIN_BUILDROOT=y $CONFIG_FILE > /dev/null && \
-   grep ^BR2_ENABLE_LOCALE=y       $CONFIG_FILE > /dev/null ; then
+if grep ^BR2_TOOLCHAIN_BUILDROOT=y $BUILDROOT_CONFIG > /dev/null && \
+   grep ^BR2_ENABLE_LOCALE=y       $BUILDROOT_CONFIG > /dev/null ; then
    if ! which locale > /dev/null ; then
        /bin/echo -e "\nYou need locale support on your build machine to build a toolchain supporting locales\n"
        exit 1 ;
@@ -159,7 +159,7 @@ if grep ^BR2_TOOLCHAIN_BUILDROOT=y $CONFIG_FILE > /dev/null && \
    fi
 fi
 
-if grep -q ^BR2_PACKAGE_CLASSPATH=y $CONFIG_FILE ; then
+if grep -q ^BR2_PACKAGE_CLASSPATH=y $BUILDROOT_CONFIG ; then
     for prog in javac jar; do
 	if ! which $prog > /dev/null ; then
 	    /bin/echo -e "\nYou must install '$prog' on your build machine\n" >&2
@@ -168,7 +168,7 @@ if grep -q ^BR2_PACKAGE_CLASSPATH=y $CONFIG_FILE ; then
     done
 fi
 
-if grep -E '^BR2_TARGET_GENERIC_ROOT_PASSWD=".+"$' $CONFIG_FILE > /dev/null 2>&1; then
+if grep -E '^BR2_TARGET_GENERIC_ROOT_PASSWD=".+"$' $BUILDROOT_CONFIG > /dev/null 2>&1; then
     if ! which mkpasswd > /dev/null 2>&1; then
         /bin/echo -e "\nYou need the 'mkpasswd' utility to set the root password\n"
         /bin/echo -e "(in Debian/ubuntu, 'mkpasswd' provided by the whois package)\n"
@@ -176,7 +176,7 @@ if grep -E '^BR2_TARGET_GENERIC_ROOT_PASSWD=".+"$' $CONFIG_FILE > /dev/null 2>&1
     fi
 fi
 
-if grep -q ^BR2_HOSTARCH_NEEDS_IA32_LIBS=y $CONFIG_FILE ; then
+if grep -q ^BR2_HOSTARCH_NEEDS_IA32_LIBS=y $BUILDROOT_CONFIG ; then
     if test ! -f /lib/ld-linux.so.2 ; then
 	/bin/echo -e "\nYour Buildroot configuration uses pre-built tools for the x86 architecture,"
 	/bin/echo -e "but your build machine uses the x86-64 architecture without the 32 bits compatibility"
Signature · 1 line
1.7.2.5
#8 lore raw

PATCH 4/4 toolchain/crostool-ng: use newly-introduced BUILDROOT_CONFIG

In reply to Yann E. MORIN

No need to recreate a path we already have.

---
 toolchain/toolchain-crosstool-ng/crosstool-ng.mk |  114 +++++++++++-----------
 1 files changed, 57 insertions(+), 57 deletions(-)
toolchain/toolchain-crosstool-ng/crosstool-ng.mk +57 -57
index 553c9ee..c09f732 100644
@@ -99,9 +99,9 @@ $(STAMP_DIR)/ct-ng-toolchain-built: $(CTNG_DIR)/.config
 # - 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  :=
+CTNG_FIX_BUILDROOT_CONFIG_SED       :=
+CTNG_FIX_BUILDROOT_CONFIG_PATHS_SED :=
+CTNG_FIX_BUILDROOT_CONFIG_LIBC_SED  :=
 
 #--------------
 # A few generic functions
@@ -200,72 +200,72 @@ endif
 # with BR2 config options.
 # Known missing: arch options, uClibc/eglibc config...
 #
-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:;
-CTNG_FIX_DOT_CONFIG_SED += s:^(|\# )(CT_ARCH_(32|64)).*:\# \2 is not set:;
-CTNG_FIX_DOT_CONFIG_SED += s:^\# (CT_ARCH_$(CTNG_BIT)) is not set:\1=y:;
-CTNG_FIX_DOT_CONFIG_SED += s:^(CT_TARGET_VENDOR)=.*:\1="buildroot":;
-CTNG_FIX_DOT_CONFIG_SED += s:^(CT_TARGET_ALIAS)=.*:\1="$(ARCH)-linux":;
-CTNG_FIX_DOT_CONFIG_SED += s:^(CT_TOOLCHAIN_PKGVERSION)="(.*)":\1="buildroot $(BR2_VERSION_FULL)":;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^(CT_INSTALL_DIR_RO)=y:\# \1 is not set:;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^(|\# )(CT_ARCH_[BL]E).*:\# \2 is not set:;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^\# (CT_ARCH_$(CTNG_ENDIAN)) is not set:\1=y:;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^(|\# )(CT_ARCH_(32|64)).*:\# \2 is not set:;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^\# (CT_ARCH_$(CTNG_BIT)) is not set:\1=y:;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^(CT_TARGET_VENDOR)=.*:\1="buildroot":;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^(CT_TARGET_ALIAS)=.*:\1="$(ARCH)-linux":;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^(CT_TOOLCHAIN_PKGVERSION)="(.*)":\1="buildroot $(BR2_VERSION_FULL)":;
 ifneq ($(call qstrip,$(BR2_USE_MMU)),)
-CTNG_FIX_DOT_CONFIG_SED += s:^\# (CT_ARCH_USE_MMU) is not set:\1=y:;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^\# (CT_ARCH_USE_MMU) is not set:\1=y:;
 else
-CTNG_FIX_DOT_CONFIG_SED += s:^(CT_ARCH_USE_MMU)=y:\# \1 is not set:;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^(CT_ARCH_USE_MMU)=y:\# \1 is not set:;
 endif
 ifneq ($(call qstrip,$(BR2_PACKAGE_GDB_SERVER))$(call qstrip,$(BR2_PACKAGE_GDB_HOST)),)
-CTNG_FIX_DOT_CONFIG_SED += s:^(CT_DEBUG_gdb)=.*:\# \1 is not set:;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^(CT_DEBUG_gdb)=.*:\# \1 is not set:;
 endif
 ifeq ($(call qstrip,$(BR2_TOOLCHAIN_CTNG_CXX)),y)
-CTNG_FIX_DOT_CONFIG_SED += s:^\# (CT_CC_LANG_CXX) is not set:\1=y:;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^\# (CT_CC_LANG_CXX) is not set:\1=y:;
 else
-CTNG_FIX_DOT_CONFIG_SED += s:^(CT_CC_LANG_CXX)=.*:\# \1 is not set:;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^(CT_CC_LANG_CXX)=.*:\# \1 is not set:;
 endif
 
 # Shoe-horn CPU variant now
 ifneq ($(call qstrip,$(BR2_GCC_TARGET_ARCH)),)
-CTNG_FIX_DOT_CONFIG_SED += s:^(CT_ARCH_ARCH)=.*:\1=$(BR2_GCC_TARGET_ARCH):;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^(CT_ARCH_ARCH)=.*:\1=$(BR2_GCC_TARGET_ARCH):;
 endif
 ifneq ($(call qstrip,$(BR2_GCC_TARGET_TUNE)),)
-CTNG_FIX_DOT_CONFIG_SED += s:^(CT_ARCH_TUNE)=.*:\1=$(BR2_GCC_TARGET_TUNE):;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^(CT_ARCH_TUNE)=.*:\1=$(BR2_GCC_TARGET_TUNE):;
 endif
 
 # And floating point now
 ifeq ($(call qstrip,$(BR2_SOFT_FLOAT)),)
-CTNG_FIX_DOT_CONFIG_SED += s:^\# (CT_ARCH_FLOAT_HW) is not set:\1=y:;
-CTNG_FIX_DOT_CONFIG_SED += s:^(CT_ARCH_FLOAT_SW)=y:\# \1 is not set:;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^\# (CT_ARCH_FLOAT_HW) is not set:\1=y:;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^(CT_ARCH_FLOAT_SW)=y:\# \1 is not set:;
 else
-CTNG_FIX_DOT_CONFIG_SED += s:^(CT_ARCH_FLOAT_HW)=y:\# \1 is not set:;
-CTNG_FIX_DOT_CONFIG_SED += s:^\# (CT_ARCH_FLOAT_SW) is not set:\1=y:;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^(CT_ARCH_FLOAT_HW)=y:\# \1 is not set:;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^\# (CT_ARCH_FLOAT_SW) is not set:\1=y:;
 endif
 
 # Thread implementation selection
-CTNG_FIX_DOT_CONFIG_SED += s:^(|\# )(CT_THREADS_NONE).*:\# \2 is not set:;
-CTNG_FIX_DOT_CONFIG_SED += s:^(|\# )(CT_THREADS_LINUXTHREADS).*:\# \2 is not set:;
-CTNG_FIX_DOT_CONFIG_SED += s:^(|\# )(CT_THREADS_NPTL).*:\# \2 is not set:;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^(|\# )(CT_THREADS_NONE).*:\# \2 is not set:;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^(|\# )(CT_THREADS_LINUXTHREADS).*:\# \2 is not set:;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^(|\# )(CT_THREADS_NPTL).*:\# \2 is not set:;
 ifneq ($(call qstrip,$(BR2_TOOLCHAIN_CTNG_THREADS_PTHREADS))$(call qstrip,$(BR2_TOOLCHAIN_CTNG_THREADS_PTHREADS_OLD)),)
-CTNG_FIX_DOT_CONFIG_SED += s:^(|\# )(CT_THREADS_LINUXTHREADS).*:\2=y:;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^(|\# )(CT_THREADS_LINUXTHREADS).*:\2=y:;
  ifneq ($(call qstrip,$(BR2_TOOLCHAIN_CTNG_uClibc)),)
   ifneq ($(call qstrip,$(BR2_TOOLCHAIN_CTNG_THREADS_PTHREADS_OLD)),)
-CTNG_FIX_DOT_CONFIG_SED += s:^(|\# )(CT_LIBC_UCLIBC_LNXTHRD_NEW).*:\# \2 is not set:;
-CTNG_FIX_DOT_CONFIG_SED += s:^(|\# )(CT_LIBC_UCLIBC_LNXTHRD_OLD).*:\2=y:;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^(|\# )(CT_LIBC_UCLIBC_LNXTHRD_NEW).*:\# \2 is not set:;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^(|\# )(CT_LIBC_UCLIBC_LNXTHRD_OLD).*:\2=y:;
   else
-CTNG_FIX_DOT_CONFIG_SED += s:^(|\# )(CT_LIBC_UCLIBC_LNXTHRD_OLD).*:\# \2 is not set:;
-CTNG_FIX_DOT_CONFIG_SED += s:^(|\# )(CT_LIBC_UCLIBC_LNXTHRD_NEW).*:\2=y:;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^(|\# )(CT_LIBC_UCLIBC_LNXTHRD_OLD).*:\# \2 is not set:;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^(|\# )(CT_LIBC_UCLIBC_LNXTHRD_NEW).*:\2=y:;
   endif
  endif
 else ifneq ($(call qstrip,$(BR2_TOOLCHAIN_CTNG_THREADS_NPTL)),)
-CTNG_FIX_DOT_CONFIG_SED += s:^(|\# )(CT_THREADS_NPTL).*:\2=y:;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^(|\# )(CT_THREADS_NPTL).*:\2=y:;
 else ifneq ($(call qstrip,$(BR2_TOOLCHAIN_CTNG_THREADS_NONE)),)
-CTNG_FIX_DOT_CONFIG_SED += s:^(|\# )(CT_THREADS_NONE).*:\2=y:;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^(|\# )(CT_THREADS_NONE).*:\2=y:;
 endif
 
 #--------------
 # And the specials for paths
-CTNG_FIX_DOT_CONFIG_PATHS_SED += s:^(CT_PREFIX_DIR)=.*:\1="$(HOST_DIR)/usr":;
-CTNG_FIX_DOT_CONFIG_PATHS_SED += s:^(CT_LOCAL_TARBALLS_DIR)=.*:\1="$(DL_DIR)":;
-CTNG_FIX_DOT_CONFIG_PATHS_SED += s:^(CT_SYSROOT_NAME)=.*:\1="sysroot":;
-CTNG_FIX_DOT_CONFIG_PATHS_SED += s:^(CT_SYSROOT_DIR_PREFIX)=.*:\1="":;
+CTNG_FIX_BUILDROOT_CONFIG_PATHS_SED += s:^(CT_PREFIX_DIR)=.*:\1="$(HOST_DIR)/usr":;
+CTNG_FIX_BUILDROOT_CONFIG_PATHS_SED += s:^(CT_LOCAL_TARBALLS_DIR)=.*:\1="$(DL_DIR)":;
+CTNG_FIX_BUILDROOT_CONFIG_PATHS_SED += s:^(CT_SYSROOT_NAME)=.*:\1="sysroot":;
+CTNG_FIX_BUILDROOT_CONFIG_PATHS_SED += s:^(CT_SYSROOT_DIR_PREFIX)=.*:\1="":;
 
 #--------------
 # uClibc specific options
@@ -273,53 +273,53 @@ ifeq ($(BR2_TOOLCHAIN_CTNG_uClibc),y)
 
 # Handle the locales option
 ifneq ($(call qstrip,$(BR2_TOOLCHAIN_CTNG_uClibc_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:;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^\# (CT_LIBC_UCLIBC_LOCALES) is not set:\1=y\n\# CT_LIBC_UCLIBC_LOCALES_PREGEN_DATA is not set:;
+CTNG_FIX_BUILDROOT_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:;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^(CT_LIBC_UCLIBC_LOCALES)=.*:\# \1 is not set:;
 endif
 
 # Handle the wide-char option
 ifneq ($(call qstrip,$(BR2_TOOLCHAIN_CTNG_uClibc_WCHAR)),)
-CTNG_FIX_DOT_CONFIG_SED += s:^\# (CT_LIBC_UCLIBC_WCHAR) is not set:\1=y:;
+CTNG_FIX_BUILDROOT_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:;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^(CT_LIBC_UCLIBC_WCHAR)=.*:\# \1 is not set:;
 endif
 
 # Handle the LFS option
 ifneq ($(call qstrip,$(BR2_TOOLCHAIN_CTNG_uClibc_LARGEFILE)),)
-CTNG_FIX_DOT_CONFIG_LIBC_SED += s:^\# (UCLIBC_HAS_LFS) is not set:\1=y:;
+CTNG_FIX_BUILDROOT_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:;
+CTNG_FIX_BUILDROOT_CONFIG_LIBC_SED += s:^(UCLIBC_HAS_LFS)=.*:\# \1 is not set:;
 endif
 
 # Handle the IPv6 option
 ifneq ($(call qstrip,$(BR2_TOOLCHAIN_CTNG_uClibc_INET_IPV6)),)
-CTNG_FIX_DOT_CONFIG_LIBC_SED += s:^\# (UCLIBC_HAS_IPV6) is not set:\1=y:;
+CTNG_FIX_BUILDROOT_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:;
+CTNG_FIX_BUILDROOT_CONFIG_LIBC_SED += s:^(UCLIBC_HAS_IPV6)=.*:\# \1 is not set:;
 endif
 
 # Handle the RPC option
 ifneq ($(call qstrip,$(BR2_TOOLCHAIN_CTNG_uClibc_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:;
+CTNG_FIX_BUILDROOT_CONFIG_LIBC_SED += s:^\# (UCLIBC_HAS_RPC) is not set:\1=y\nUCLIBC_HAS_FULL_RPC=y\nUCLIBC_HAS_REENTRANT_RPC=y:;
+CTNG_FIX_BUILDROOT_CONFIG_LIBC_SED += s:^\# (UCLIBC_HAS_FULL_RPC) is not set:\1=y:;
+CTNG_FIX_BUILDROOT_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:;
+CTNG_FIX_BUILDROOT_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":;
+CTNG_FIX_BUILDROOT_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) $(CONFIG_DIR)/.config
+$(CTNG_DIR)/libc.config: $(CTNG_UCLIBC_CONFIG_FILE) $(BUILDROOT_CONFIG)
 	-$(Q)cp -a $@ [email protected]
 	$(Q)cp -f $< $@
-	$(call ctng-fix-dot-config,$@,$(CTNG_FIX_DOT_CONFIG_LIBC_SED))
+	$(call ctng-fix-dot-config,$@,$(CTNG_FIX_BUILDROOT_CONFIG_LIBC_SED))
 	$(call ctng-check-config-changed,$@,[email protected])
 	$(Q)rm -f [email protected]
 
@@ -330,10 +330,10 @@ endif # LIBC is uClibc
 ifeq ($(BR2_TOOLCHAIN_CTNG_glibc)$(BR2_TOOLCHAIN_CTNG_eglibc),y)
 
 # Force unwind support
-CTNG_FIX_DOT_CONFIG_SED += s:^\# (CT_LIBC_GLIBC_FORCE_UNWIND) is not set:\1=y:;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^\# (CT_LIBC_GLIBC_FORCE_UNWIND) is not set:\1=y:;
 
 # Force non-fortified build
-CTNG_FIX_DOT_CONFIG_SED += s:^(CT_LIBC_ENABLE_FORTIFIED_BUILD)=y:\# \1 is not set:;
+CTNG_FIX_BUILDROOT_CONFIG_SED += s:^(CT_LIBC_ENABLE_FORTIFIED_BUILD)=y:\# \1 is not set:;
 
 endif # LIBC is glibc or eglibc
 
@@ -347,14 +347,14 @@ endif # LIBC is glibc or eglibc
 # or a feature of kconfig?)
 # $1: the .config file to munge
 define ctng-oldconfig
-	$(call ctng-fix-dot-config,$(1),$(CTNG_FIX_DOT_CONFIG_SED))
+	$(call ctng-fix-dot-config,$(1),$(CTNG_FIX_BUILDROOT_CONFIG_SED))
 	$(Q)yes ''                                             |\
 	$(call ctng,CT_IS_A_BACKEND=y                           \
 	            CT_BACKEND_ARCH=$(CTNG_ARCH)                \
 	            CT_BACKEND_KERNEL=linux                     \
 	            CT_BACKEND_LIBC=$(BR2_TOOLCHAIN_CTNG_LIBC)  \
 	            oldconfig                                   )
-	$(call ctng-fix-dot-config,$(1),$(CTNG_FIX_DOT_CONFIG_PATHS_SED))
+	$(call ctng-fix-dot-config,$(1),$(CTNG_FIX_BUILDROOT_CONFIG_PATHS_SED))
 endef
 
 # We need the host crosstool-NG before we can even begin working
@@ -372,7 +372,7 @@ $(CTNG_DIR)/.config: | host-crosstool-ng
 # 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) $(CONFIG_DIR)/.config
+$(CTNG_DIR)/.config: $(CTNG_CONFIG_FILE) $(BUILDROOT_CONFIG)
 	$(Q)if [ ! -f $@ ]; then                                                        \
 	        mkdir -p "$(CTNG_DIR)";                                                 \
 	        libc="$$(awk -F '"' '$$1=="CT_LIBC=" { print $$2; }' "$<")";            \
Signature · 1 line
1.7.2.5
#9 lore raw
In reply to Yann E. MORIN
Quoted 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 series introduces exporting a variable, $(BUILDROOT_CONFIG), that Yann> contains the fully-qualified path to out .config.

Yann> In some cases, scripts in support/ need to parse our .config (eg. the Yann> dependency-checking script needs to check the conformity of rxternal Yann> toolchain features).

Yann> Also, some Makefile fragments (eg. the crosstool-Ng backend) need to Yann> refer to this config file for make-dependency-checking.

Yann> This was currently done in different ad-hoc manners, and is not scalable.

Yann> I'll also use it later to retrieve the password encoding scheme when Yann> creating users from packages.

Yann> Changes v1 -> v2:
Yann> - rename BR2_CONFIG_FILE -> BUILDROOT_CONFIG (Arnout)
Yann> - use $(BUILDROOT_CONFIG) in top-level Makefile, too (Arnout)

Committed series, thanks.

Signature · 1 line
Bye, Peter Korsgaard