[OpenWrt-Devel] [PATCH 06/14] toolchain: Allow to set libc type for external toolchains

openwrt at daniel.thecshore.com openwrt at daniel.thecshore.com
Sun Jan 3 01:02:54 EST 2016


From: Daniel Dickinson <openwrt at daniel.thecshore.com>

An external toolchain, if glibc, uclibc, or musl, can benefit
from enabling the appropriate USE_<libc> configure flags so that
packages compile correctly for the libc type

Signed-off-by: Daniel Dickinson <openwrt at daniel.thecshore.com>
---
 rules.mk                   |  2 +-
 toolchain/Config.in        | 21 +++++++++++++--------
 toolchain/glibc/Config.in  |  2 +-
 toolchain/musl/Config.in   |  2 +-
 toolchain/uClibc/Config.in |  2 +-
 5 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/rules.mk b/rules.mk
index 1e7549f..eb5665d 100644
--- a/rules.mk
+++ b/rules.mk
@@ -89,7 +89,7 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
   REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-openwrt-linux$(if $(TARGET_SUFFIX),-$(TARGET_SUFFIX))
   GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-openwrt-linux
   DIR_SUFFIX:=_$(LIBC)-$(LIBCV)$(if $(CONFIG_arm),_eabi)
-  BIN_DIR:=$(BIN_DIR)$(if $(CONFIG_USE_MUSL),,-$(LIBC))
+  BIN_DIR:=$(BIN_DIR)$(if $(CONFIG_USE_MUSL),$(if $(CONFIG_USE_EXTERNAL_LIBC),-$(LIBC)),-$(LIBC))
   TARGET_DIR_NAME = target-$(ARCH)$(ARCH_SUFFIX)$(DIR_SUFFIX)$(if $(BUILD_SUFFIX),_$(BUILD_SUFFIX))
   TOOLCHAIN_DIR_NAME = toolchain-$(ARCH)$(ARCH_SUFFIX)_gcc-$(GCCV)$(DIR_SUFFIX)
 else
diff --git a/toolchain/Config.in b/toolchain/Config.in
index c7072fc..1f6f753 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -143,6 +143,11 @@ menuconfig TOOLCHAINOPTS
 	bool "Toolchain Options"  if DEVEL
 	depends on NEED_TOOLCHAIN
 
+menuconfig EXTERNAL_TOOLCHAIN_OPTS
+	bool "Define external toolchain options" if DEVEL
+	depends on !NEED_TOOLCHAIN
+
+
 menuconfig EXTRA_TARGET_ARCH
 	bool
 	prompt "Enable an extra toolchain target architecture" if TOOLCHAINOPTS
@@ -178,7 +183,7 @@ menuconfig EXTRA_TARGET_ARCH
 
 
 	choice
-		prompt "MIPS64 user-land ABI" if TOOLCHAINOPTS && (mips64 || mips64el)
+		prompt "MIPS64 user-land ABI" if ( TOOLCHAINOPTS || EXTERNAL_TOOLCHAIN_OPTS ) && (mips64 || mips64el)
 		default MIPS64_ABI_N64
 		help
 		   MIPS64 supports 3 different user-land ABIs: o32 (legacy),
@@ -209,7 +214,7 @@ comment "C Library"
 	depends on TOOLCHAINOPTS
 
 choice
-	prompt "C Library implementation" if TOOLCHAINOPTS
+	prompt "C Library implementation" if ( TOOLCHAINOPTS || EXTERNAL_TOOLCHAIN_OPTS )
 	default LIBC_USE_GLIBC if mips64 || mips64el
 	default LIBC_USE_UCLIBC if arc
 	default LIBC_USE_MUSL
@@ -281,15 +286,15 @@ source "toolchain/musl/Config.version"
 
 config LIBC
 	string
-	default "glibc"   if USE_GLIBC
-	default "uClibc"  if USE_UCLIBC
-	default "musl"	  if USE_MUSL
+	default "glibc"   if ( USE_GLIBC && !EXTERNAL_TOOLCHAIN )
+	default "uClibc"  if ( USE_UCLIBC && !EXTERNAL_TOOLCHAIN )
+	default "musl"	  if ( USE_MUSL && !EXTERNAL_TOOLCHAIN )
 
 config LIBC_VERSION
 	string
-	default GLIBC_VERSION   if USE_GLIBC
-	default UCLIBC_VERSION  if USE_UCLIBC
-	default MUSL_VERSION	if USE_MUSL
+	default GLIBC_VERSION   if ( USE_GLIBC && !EXTERNAL_TOOLCHAIN )
+	default UCLIBC_VERSION  if ( USE_UCLIBC && !EXTERNAL_TOOLCHAIN )
+	default MUSL_VERSION	if ( USE_MUSL && !EXTERNAL_TOOLCHAIN )
 
 config TARGET_SUFFIX
 	string
diff --git a/toolchain/glibc/Config.in b/toolchain/glibc/Config.in
index 66ff2f4..fcda4c9 100644
--- a/toolchain/glibc/Config.in
+++ b/toolchain/glibc/Config.in
@@ -16,6 +16,6 @@ choice
 endchoice
 
 menu "eglibc configuration"
-	depends on TOOLCHAINOPTS && USE_GLIBC && EGLIBC_USE_VERSION_2_19
+	depends on TOOLCHAINOPTS && USE_GLIBC && EGLIBC_USE_VERSION_2_19 && !EXTERNAL_TOOLCHAIN
 	source toolchain/glibc/config/Config.in
 endmenu
diff --git a/toolchain/musl/Config.in b/toolchain/musl/Config.in
index 05caa6a..50cac24 100644
--- a/toolchain/musl/Config.in
+++ b/toolchain/musl/Config.in
@@ -2,5 +2,5 @@
 
 config MUSL_ENABLE_DEBUG
 	bool "Build with debug information"
-	depends on TOOLCHAINOPTS && USE_MUSL
+	depends on TOOLCHAINOPTS && USE_MUSL && !EXTERNAL_TOOLCHAIN
 	default n
diff --git a/toolchain/uClibc/Config.in b/toolchain/uClibc/Config.in
index 5793bb7..3bcb003 100644
--- a/toolchain/uClibc/Config.in
+++ b/toolchain/uClibc/Config.in
@@ -2,5 +2,5 @@
 
 config UCLIBC_ENABLE_DEBUG
 	bool "Build with debug information"
-	depends on TOOLCHAINOPTS && USE_UCLIBC
+	depends on TOOLCHAINOPTS && USE_UCLIBC && !EXTERNAL_TOOLCHAIN
 	default n
-- 
2.4.3
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list