Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] RFC: toolchain wrapper for external toolchains
@ 2011-05-03 14:40 Peter Korsgaard
  2011-05-03 14:40 ` [Buildroot] [PATCH 1/2] Add " Peter Korsgaard
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Peter Korsgaard @ 2011-05-03 14:40 UTC (permalink / raw)
  To: buildroot

This patch series adds a toolchain wrapper for external toolchains as
discussed during the Buildroot dev day after FOSDEM.

This brings two advantages:
 - External toolchains are easier to use outside of Buildroot as no
   special compiler arguments have to be used. They behave just
   like the internal toolchain.
 - The code to ensure --sysroot was used everywhere (and the workarounds
   for packages like Qt and cmake) can be removed.

It has so far been tested with Codesourcery toolchains and a number of
package combinations.

 Makefile                                           |   12 +--
 package/Makefile.in                                |   53 ++-----------
 package/qt/qt.mk                                   |    8 +-
 toolchain/toolchain-external/ext-tool.mk           |   88 ++++++++++++++++++--
 .../toolchain-external/ext-toolchain-wrapper.c     |   75 +++++++++++++++++
 5 files changed, 171 insertions(+), 65 deletions(-)


--
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/2] Add toolchain wrapper for external toolchains
  2011-05-03 14:40 [Buildroot] RFC: toolchain wrapper for external toolchains Peter Korsgaard
@ 2011-05-03 14:40 ` Peter Korsgaard
  2011-05-03 14:40 ` [Buildroot] [PATCH 2/2] Get rid of unneeded CFLAGS Peter Korsgaard
  2011-05-05 21:44 ` [Buildroot] RFC: toolchain wrapper for external toolchains Peter Korsgaard
  2 siblings, 0 replies; 7+ messages in thread
From: Peter Korsgaard @ 2011-05-03 14:40 UTC (permalink / raw)
  To: buildroot

Add a simple toolchain wrapper for external toolchains, which forces the
correct sysroot/march/mtune/floating point options needed to use it
with buildroot.

With this in place the external toolchain behaves similar to the internal
ones, and the special handling can be removed. This also means that the
toolchain is usable outside buildroot without having to pass any special
compiler flags.

Also adjust the downloadable external toolchain support to install under
HOST_DIR so it can be used after the temporary build files are removed.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
---
 Makefile                                           |    4 +-
 package/Makefile.in                                |   12 +---
 toolchain/toolchain-external/ext-tool.mk           |   84 ++++++++++++++++++--
 .../toolchain-external/ext-toolchain-wrapper.c     |   75 +++++++++++++++++
 4 files changed, 154 insertions(+), 21 deletions(-)
 create mode 100644 toolchain/toolchain-external/ext-toolchain-wrapper.c

diff --git a/Makefile b/Makefile
index d4f5e15..2c5aefe 100644
--- a/Makefile
+++ b/Makefile
@@ -284,7 +284,6 @@ STAMP_DIR:=$(BASE_DIR)/stamps
 BINARIES_DIR:=$(BASE_DIR)/images
 TARGET_DIR:=$(BASE_DIR)/target
 TOOLCHAIN_DIR=$(BASE_DIR)/toolchain
-TOOLCHAIN_EXTERNAL_DIR=$(BASE_DIR)/external-toolchain
 TARGET_SKELETON=$(TOPDIR)/fs/skeleton
 
 BR2_DEPENDS_DIR=$(BUILD_DIR)/buildroot-config
@@ -625,8 +624,7 @@ endif
 
 clean:
 	rm -rf $(STAGING_DIR) $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
-		$(STAMP_DIR) $(BUILD_DIR) $(TOOLCHAIN_DIR) $(BASE_DIR)/staging \
-		$(TOOLCHAIN_EXTERNAL_DIR)
+		$(STAMP_DIR) $(BUILD_DIR) $(TOOLCHAIN_DIR) $(BASE_DIR)/staging
 
 distclean: clean
 ifeq ($(DL_DIR),$(TOPDIR)/dl)
diff --git a/package/Makefile.in b/package/Makefile.in
index 391777e..faab365 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -103,18 +103,8 @@ TARGET_SYSROOT_OPT=--sysroot=$(STAGING_DIR)
 
 ifeq ($(BR2_TOOLCHAIN_BUILDROOT)$(BR2_TOOLCHAIN_CTNG),y)
 TARGET_CROSS=$(HOST_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-
-else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
-TOOLCHAIN_EXTERNAL_PREFIX=$(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PREFIX))
-ifeq ($(BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD),y)
-TOOLCHAIN_EXTERNAL_LOCATION=$(TOOLCHAIN_EXTERNAL_DIR)
 else
-TOOLCHAIN_EXTERNAL_LOCATION=$(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PATH))
-endif
-ifneq ($(TOOLCHAIN_EXTERNAL_LOCATION),)
-TARGET_CROSS=$(TOOLCHAIN_EXTERNAL_LOCATION)/bin/$(TOOLCHAIN_EXTERNAL_PREFIX)-
-else
-TARGET_CROSS=$(TOOLCHAIN_EXTERNAL_PREFIX)-
-endif
+TARGET_CROSS=$(HOST_DIR)/usr/bin/$(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PREFIX))-
 endif
 
 # Quotes are needed for spaces et al in path components.
diff --git a/toolchain/toolchain-external/ext-tool.mk b/toolchain/toolchain-external/ext-tool.mk
index f6249ef..0034ddf 100644
--- a/toolchain/toolchain-external/ext-tool.mk
+++ b/toolchain/toolchain-external/ext-tool.mk
@@ -41,8 +41,16 @@
 #  packages when using external toolchains. So in the end, only the
 #  cross-compiler binaries remains external, all libraries and headers
 #  are imported into the Buildroot tree.
+#
+#  4. Build a toolchain wrapper which executes the external toolchain
+#  with a number of arguments (sysroot/march/mtune/..) hardcoded,
+#  so we're sure the correct configuration is always used and the
+#  toolchain behaves similar to an internal toolchain.
+#  This toolchain wrapper and symlinks are installed into
+#  $(HOST_DIR)/usr/bin like for the internal toolchains, and the rest
+#  of Buildroot is handled identical for the 2 toolchain types.
 
-uclibc: dependencies $(STAMP_DIR)/ext-toolchain-installed
+uclibc: dependencies $(HOST_DIR)/usr/bin/ext-toolchain-wrapper
 
 LIB_EXTERNAL_LIBS=ld*.so libc.so libcrypt.so libdl.so libgcc_s.so libm.so libnsl.so libresolv.so librt.so libutil.so
 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC),y)
@@ -97,7 +105,51 @@ endif # ! no threads
 # present in the main sysroot, and only the libraries are available in
 # each variant-specific sysroot directory.
 
-TARGET_CC_NO_SYSROOT=$(filter-out --sysroot=%,$(TARGET_CC_NOCCACHE))
+
+TOOLCHAIN_EXTERNAL_PREFIX=$(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PREFIX))
+ifeq ($(BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD),y)
+TOOLCHAIN_EXTERNAL_DIR=$(HOST_DIR)/opt/ext-toolchain
+else
+TOOLCHAIN_EXTERNAL_DIR=$(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PATH))
+endif
+
+ifeq ($(TOOLCHAIN_EXTERNAL_DIR),)
+# if no path set, figure it out from path
+TOOLCHAIN_EXTERNAL_BIN:=$(shell dirname $(shell which $(TOOLCHAIN_EXTERNAL_PREFIX)-gcc))
+else
+TOOLCHAIN_EXTERNAL_BIN:=$(TOOLCHAIN_EXTERNAL_DIR)/bin
+endif
+
+TOOLCHAIN_EXTERNAL_CROSS=$(TOOLCHAIN_EXTERNAL_BIN)/$(TOOLCHAIN_EXTERNAL_PREFIX)-
+TOOLCHAIN_EXTERNAL_CC=$(TOOLCHAIN_EXTERNAL_CROSS)gcc
+TOOLCHAIN_EXTERNAL_WRAPPER_ARGS = \
+	-DBR_CROSS_PATH='"$(TOOLCHAIN_EXTERNAL_BIN)/"' \
+	-DBR_SYSROOT='"$(STAGING_DIR)"'
+
+# march/mtune/floating point mode needs to be passed to the external toolchain
+# to select the right multilib variant
+ifneq ($(CC_TARGET_TUNE_),)
+TOOLCHAIN_EXTERNAL_CFLAGS += -mtune=$(CC_TARGET_TUNE_)
+TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_TUNE='"$(CC_TARGET_TUNE_)"'
+endif
+ifneq ($(CC_TARGET_ARCH_),)
+TOOLCHAIN_EXTERNAL_CFLAGS += -march=$(CC_TARGET_ARCH_)
+TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_ARCH='"$(CC_TARGET_ARCH_)"'
+endif
+ifneq ($(CC_TARGET_ABI_),)
+TOOLCHAIN_EXTERNAL_CFLAGS += -mabi=$(CC_TARGET_ABI_)
+TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_ABI='"$(CC_TARGET_ABI_)"'
+endif
+
+ifeq ($(BR2_SOFT_FLOAT),y)
+TOOLCHAIN_EXTERNAL_CFLAGS += -msoft-float
+TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_SOFTFLOAT=1
+endif
+
+ifeq ($(BR2_VFP_FLOAT),y)
+TOOLCHAIN_EXTERNAL_CFLAGS += -mfpu=vfp
+TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_VFPFLOAT=1
+endif
 
 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD),y)
 TOOLCHAIN_EXTERNAL_DEPENDENCIES = $(TOOLCHAIN_EXTERNAL_DIR)/.extracted
@@ -146,9 +198,9 @@ $(TOOLCHAIN_EXTERNAL_DIR)/.extracted: $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE)
 $(STAMP_DIR)/ext-toolchain-checked:
 	@echo "Checking external toolchain settings"
 	$(Q)$(call check_cross_compiler_exists)
-	$(Q)SYSROOT_DIR=`$(TARGET_CC_NO_SYSROOT) -print-sysroot 2>/dev/null` ; \
+	$(Q)SYSROOT_DIR=`$(TOOLCHAIN_EXTERNAL_CC) -print-sysroot 2>/dev/null` ; \
 	if test -z "$${SYSROOT_DIR}" ; then \
-		SYSROOT_DIR=`readlink -f $$(LANG=C $(TARGET_CC_NO_SYSROOT) -print-file-name=libc.a) |sed -r -e 's:usr/lib/libc\.a::;'` ; \
+		SYSROOT_DIR=`readlink -f $$(LANG=C $(TOOLCHAIN_EXTERNAL_CC) -print-file-name=libc.a) |sed -r -e 's:usr/lib/libc\.a::;'` ; \
 	fi ; \
 	if test -z "$${SYSROOT_DIR}" ; then \
 		@echo "External toolchain doesn't support --sysroot. Cannot use." ; \
@@ -172,15 +224,15 @@ $(STAMP_DIR)/ext-toolchain-checked:
 # the $(TARGET_DIR) and copy the whole sysroot (libraries and headers)
 # to $(STAGING_DIR).
 $(STAMP_DIR)/ext-toolchain-installed: $(TOOLCHAIN_EXTERNAL_DEPENDENCIES)
-	$(Q)SYSROOT_DIR=`$(TARGET_CC_NO_SYSROOT) -print-sysroot 2>/dev/null` ; \
+	$(Q)SYSROOT_DIR=`$(TOOLCHAIN_EXTERNAL_CC) -print-sysroot 2>/dev/null` ; \
 	if test -z "$${SYSROOT_DIR}" ; then \
-		SYSROOT_DIR=`readlink -f $$(LANG=C $(TARGET_CC_NO_SYSROOT) -print-file-name=libc.a) |sed -r -e 's:usr/lib/libc\.a::;'` ; \
+		SYSROOT_DIR=`readlink -f $$(LANG=C $(TOOLCHAIN_EXTERNAL_CC) -print-file-name=libc.a) |sed -r -e 's:usr/lib/libc\.a::;'` ; \
 	fi ; \
 	if test -z "$${SYSROOT_DIR}" ; then \
 		@echo "External toolchain doesn't support --sysroot. Cannot use." ; \
 		exit 1 ; \
 	fi ; \
-	ARCH_SUBDIR=`$(TARGET_CC_NO_SYSROOT) $(TARGET_CFLAGS) -print-multi-directory` ; \
+	ARCH_SUBDIR=`$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS) -print-multi-directory` ; \
 	ARCH_SYSROOT_DIR=$${SYSROOT_DIR}/$${ARCH_SUBDIR} ; \
 	mkdir -p $(TARGET_DIR)/lib ; \
 	echo "Copy external toolchain libraries to target..." ; \
@@ -196,3 +248,21 @@ $(STAMP_DIR)/ext-toolchain-installed: $(TOOLCHAIN_EXTERNAL_DEPENDENCIES)
 		$(call create_lib64_symlinks) ; \
 	fi ; \
 	touch $@
+
+# Build toolchain wrapper for preprocessor, C and C++ compiler, and setup
+# symlinks for everything else
+$(HOST_DIR)/usr/bin/ext-toolchain-wrapper: $(STAMP_DIR)/ext-toolchain-installed
+	mkdir -p $(HOST_DIR)/usr/bin; cd $(HOST_DIR)/usr/bin; \
+	for i in $(TOOLCHAIN_EXTERNAL_CROSS)*; do \
+		case "$$i" in \
+		*cc|*cc-*|*++|*++-*|*cpp) \
+			base=$${i##*/}; \
+			ln -sf $(@F) $$base; \
+			;; \
+		*) \
+			ln -sf $$i .; \
+			;; \
+		esac; \
+	done ;
+	$(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_EXTERNAL_WRAPPER_ARGS) -s \
+		toolchain/toolchain-external/ext-toolchain-wrapper.c -o $@
diff --git a/toolchain/toolchain-external/ext-toolchain-wrapper.c b/toolchain/toolchain-external/ext-toolchain-wrapper.c
new file mode 100644
index 0000000..a485e74
--- /dev/null
+++ b/toolchain/toolchain-external/ext-toolchain-wrapper.c
@@ -0,0 +1,75 @@
+/**
+ * Buildroot wrapper for external toolchains. This simply executes the real
+ * toolchain with a number of arguments (sysroot/arch/..) hardcoded,
+ * to ensure the external toolchain uses the correct configuration.
+ *
+ * (C) 2011 Peter Korsgaard <jacmet@sunsite.dk>
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <limits.h>
+#include <unistd.h>
+
+#define MAXARGS 1000
+
+static char path[PATH_MAX] = BR_CROSS_PATH;
+
+static char *args[MAXARGS] = {
+	path,
+	"--sysroot", BR_SYSROOT,
+#ifdef BR_ARCH
+	"-march=" BR_ARCH,
+#endif /* BR_ARCH */
+#ifdef BR_TUNE
+	"-mtune=" BR_TUNE,
+#endif /* BR_TUNE */
+#ifdef BR_ABI
+	"-mabi=" BR_ABI,
+#endif
+#ifdef BR_SOFTFLOAT
+	"-msoft-float",
+#endif /* BR_SOFTFLOAT */
+#ifdef BR_VFPFLOAT
+	"-mfpu=vfp",
+#endif /* BR_VFPFLOAT */
+};
+
+static const char *get_basename(const char *name)
+{
+	const char *base;
+
+	base = strrchr(name, '/');
+	if (base)
+		base++;
+	else
+		base = name;
+
+	return base;
+}
+
+int main(int argc, char **argv)
+{
+	int i;
+
+	for (i=0; args[i]; i++);
+
+	if ((argc+i) >= MAXARGS) {
+		fputs("Too many arguments\n", stderr);
+		return 1;
+	}
+
+	/* forward args */
+	memcpy(&args[i], &argv[1], sizeof(argv[0]) * (argc - 1));
+
+	strcat(path, get_basename(argv[0]));
+
+	if (execv(path, args))
+		perror(path);
+
+	return 2;
+}
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 2/2] Get rid of unneeded CFLAGS
  2011-05-03 14:40 [Buildroot] RFC: toolchain wrapper for external toolchains Peter Korsgaard
  2011-05-03 14:40 ` [Buildroot] [PATCH 1/2] Add " Peter Korsgaard
@ 2011-05-03 14:40 ` Peter Korsgaard
  2011-05-05 21:44 ` [Buildroot] RFC: toolchain wrapper for external toolchains Peter Korsgaard
  2 siblings, 0 replies; 7+ messages in thread
From: Peter Korsgaard @ 2011-05-03 14:40 UTC (permalink / raw)
  To: buildroot

Now that we use a wrapper for external toolchains (and internal ones
default to the correct setting), we no longer need to explicitly pass
sysroot/march/mtune/mabi/floating point mode in TARGET_CFLAGS.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
---
 Makefile                                 |    8 +++---
 package/Makefile.in                      |   41 +++--------------------------
 package/qt/qt.mk                         |    8 +++---
 toolchain/toolchain-external/ext-tool.mk |    4 +++
 4 files changed, 17 insertions(+), 44 deletions(-)

diff --git a/Makefile b/Makefile
index 2c5aefe..5f61b93 100644
--- a/Makefile
+++ b/Makefile
@@ -375,10 +375,10 @@ world: prepare dependencies dirs $(BASE_TARGETS) $(TARGETS_ALL)
 $(O)/toolchainfile.cmake:
 	@echo -en "\
 	set(CMAKE_SYSTEM_NAME Linux)\n\
-	set(CMAKE_C_COMPILER $(CMAKE_TARGET_CC))\n\
-	set(CMAKE_CXX_COMPILER $(CMAKE_TARGET_CXX))\n\
-	set(CMAKE_C_FLAGS \"\$${CMAKE_C_FLAGS} $(CMAKE_TARGET_CFLAGS)\" CACHE STRING \"Buildroot CFLAGS\" FORCE)\n\
-	set(CMAKE_CXX_FLAGS \"\$${CMAKE_CXX_FLAGS} $(CMAKE_TARGET_CXXFLAGS)\" CACHE STRING \"Buildroot CXXFLAGS\" FORCE)\n\
+	set(CMAKE_C_COMPILER $(TARGET_CC_NOCCACHE))\n\
+	set(CMAKE_CXX_COMPILER $(TARGET_CXX_NOCCACHE))\n\
+	set(CMAKE_C_FLAGS \"\$${CMAKE_C_FLAGS} $(TARGET_CFLAGS)\" CACHE STRING \"Buildroot CFLAGS\" FORCE)\n\
+	set(CMAKE_CXX_FLAGS \"\$${CMAKE_CXX_FLAGS} $(TARGET_CXXFLAGS)\" CACHE STRING \"Buildroot CXXFLAGS\" FORCE)\n\
 	set(CMAKE_INSTALL_SO_NO_EXE 0)\n\
 	set(CMAKE_PROGRAM_PATH \"$(HOST_DIR)/usr/bin\")\n\
 	set(CMAKE_FIND_ROOT_PATH \"$(STAGING_DIR)\")\n\
diff --git a/package/Makefile.in b/package/Makefile.in
index faab365..31a9639 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -62,34 +62,12 @@ endif
 
 TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)
 
-CC_TARGET_TUNE_:=$(call qstrip,$(BR2_GCC_TARGET_TUNE))
-CC_TARGET_ARCH_:=$(call qstrip,$(BR2_GCC_TARGET_ARCH))
-CC_TARGET_ABI_:=$(call qstrip,$(BR2_GCC_TARGET_ABI))
-
-ifneq ($(CC_TARGET_TUNE_),)
-TARGET_CFLAGS+=-mtune=$(CC_TARGET_TUNE_)
-endif
-ifneq ($(CC_TARGET_ARCH_),)
-TARGET_CFLAGS+=-march=$(CC_TARGET_ARCH_)
-endif
-ifneq ($(CC_TARGET_ABI_),)
-TARGET_CFLAGS+=-mabi=$(CC_TARGET_ABI_)
-endif
-
 ifneq ($(BR2_PREFER_STATIC_LIB),y)
 ifeq ($(BR2_x86_64),y)
 TARGET_CFLAGS+=-fPIC -DPIC
 endif # PIC for dynamic objects on x86_64
 endif
 
-ifeq ($(BR2_SOFT_FLOAT),y)
-TARGET_CFLAGS+=-msoft-float
-endif
-
-ifeq ($(BR2_VFP_FLOAT),y)
-TARGET_CFLAGS+=-mfpu=vfp
-endif
-
 ifeq ($(findstring yy,$(BR2_mips)$(BR2_MIPS_ABI64)),yy)
 TARGET_CFLAGS+=-fno-pic -mno-abicalls
 endif
@@ -99,7 +77,6 @@ TARGET_CFLAGS+=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
 endif
 
 TARGET_CXXFLAGS=$(TARGET_CFLAGS)
-TARGET_SYSROOT_OPT=--sysroot=$(STAGING_DIR)
 
 ifeq ($(BR2_TOOLCHAIN_BUILDROOT)$(BR2_TOOLCHAIN_CTNG),y)
 TARGET_CROSS=$(HOST_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-
@@ -114,11 +91,11 @@ TARGET_PATH="$(HOST_DIR)/bin:$(HOST_DIR)/usr/bin:$(HOST_DIR)/usr/sbin/:$(PATH)"
 # including the --sysroot option where necessary.
 TARGET_AR       = $(TARGET_CROSS)ar
 TARGET_AS       = $(TARGET_CROSS)as
-TARGET_CC       = $(TARGET_CROSS)gcc $(TARGET_SYSROOT_OPT)
-TARGET_CPP      = $(TARGET_CROSS)cpp $(TARGET_SYSROOT_OPT)
-TARGET_CXX      = $(TARGET_CROSS)g++ $(TARGET_SYSROOT_OPT)
-TARGET_FC       = $(TARGET_CROSS)gfortran $(TARGET_SYSROOT_OPT)
-TARGET_LD       = $(TARGET_CROSS)ld $(TARGET_SYSROOT_OPT)
+TARGET_CC       = $(TARGET_CROSS)gcc
+TARGET_CPP      = $(TARGET_CROSS)cpp
+TARGET_CXX      = $(TARGET_CROSS)g++
+TARGET_FC       = $(TARGET_CROSS)gfortran
+TARGET_LD       = $(TARGET_CROSS)ld
 TARGET_NM       = $(TARGET_CROSS)nm
 TARGET_RANLIB   = $(TARGET_CROSS)ranlib
 TARGET_OBJCOPY  = $(TARGET_CROSS)objcopy
@@ -132,14 +109,6 @@ TARGET_CC  := $(CCACHE) $(TARGET_CC)
 TARGET_CXX := $(CCACHE) $(TARGET_CXX)
 endif
 
-# * CMake doesn't support having the --sysroot option directly in the
-#   compiler path, so move this option to CFLAGS/CXXFLAGS variables.
-# * Don't use ccache because then CMake will fail to detect compiler.
-CMAKE_TARGET_CC = $(filter-out --sysroot=%,$(TARGET_CC_NOCCACHE))
-CMAKE_TARGET_CXX = $(filter-out --sysroot=%,$(TARGET_CXX_NOCCACHE))
-CMAKE_TARGET_CFLAGS = $(filter --sysroot=%,$(TARGET_CC_NOCCACHE)) $(TARGET_CFLAGS)
-CMAKE_TARGET_CXXFLAGS = $(filter --sysroot=%,$(TARGET_CXX_NOCCACHE)) $(TARGET_CXXFLAGS)
-
 ifeq ($(BR2_STRIP_strip),y)
 STRIP_DISCARD_ALL:=--discard-all
 STRIP_STRIP_UNNEEDED:=--strip-unneeded
diff --git a/package/qt/qt.mk b/package/qt/qt.mk
index 8d7238e..7ec7ccc 100644
--- a/package/qt/qt.mk
+++ b/package/qt/qt.mk
@@ -451,16 +451,16 @@ define QT_CONFIGURE_CMDS
 	$(QT_CONFIGURE_IPV6)
 	$(QT_CONFIGURE_CONFIG_FILE)
 	# Fix compiler path
-	$(call QT_QMAKE_SET,CC,$(filter-out --sysroot=%,$(TARGET_CC)),$(@D))
-	$(call QT_QMAKE_SET,CXX,$(filter-out --sysroot=%,$(TARGET_CXX)),$(@D))
+	$(call QT_QMAKE_SET,CC,$(TARGET_CC),$(@D))
+	$(call QT_QMAKE_SET,CXX,$(TARGET_CXX),$(@D))
 	$(call QT_QMAKE_SET,LINK,$(TARGET_CXX),$(@D))
 	$(call QT_QMAKE_SET,LINK_SHLIB,$(TARGET_CXX),$(@D))
 	$(call QT_QMAKE_SET,AR,$(TARGET_AR) cqs,$(@D))
 	$(call QT_QMAKE_SET,OBJCOPY,$(TARGET_OBJCOPY),$(@D))
 	$(call QT_QMAKE_SET,RANLIB,$(TARGET_RANLIB),$(@D))
 	$(call QT_QMAKE_SET,STRIP,$(TARGET_STRIP),$(@D))
-	$(call QT_QMAKE_SET,CFLAGS,$(TARGET_SYSROOT_OPT) $(TARGET_CFLAGS),$(@D))
-	$(call QT_QMAKE_SET,CXXFLAGS,$(TARGET_SYSROOT_OPT) $(TARGET_CXXFLAGS),$(@D))
+	$(call QT_QMAKE_SET,CFLAGS,$(TARGET_CFLAGS),$(@D))
+	$(call QT_QMAKE_SET,CXXFLAGS,$(TARGET_CXXFLAGS),$(@D))
 	$(call QT_QMAKE_SET,LFLAGS,$(TARGET_LDFLAGS),$(@D))
 # Don't use TARGET_CONFIGURE_OPTS here, qmake would be compiled for the target
 # instead of the host then. So set PKG_CONFIG* manually.
diff --git a/toolchain/toolchain-external/ext-tool.mk b/toolchain/toolchain-external/ext-tool.mk
index 0034ddf..328f908 100644
--- a/toolchain/toolchain-external/ext-tool.mk
+++ b/toolchain/toolchain-external/ext-tool.mk
@@ -126,6 +126,10 @@ TOOLCHAIN_EXTERNAL_WRAPPER_ARGS = \
 	-DBR_CROSS_PATH='"$(TOOLCHAIN_EXTERNAL_BIN)/"' \
 	-DBR_SYSROOT='"$(STAGING_DIR)"'
 
+CC_TARGET_TUNE_:=$(call qstrip,$(BR2_GCC_TARGET_TUNE))
+CC_TARGET_ARCH_:=$(call qstrip,$(BR2_GCC_TARGET_ARCH))
+CC_TARGET_ABI_:=$(call qstrip,$(BR2_GCC_TARGET_ABI))
+
 # march/mtune/floating point mode needs to be passed to the external toolchain
 # to select the right multilib variant
 ifneq ($(CC_TARGET_TUNE_),)
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] RFC: toolchain wrapper for external toolchains
  2011-05-03 14:40 [Buildroot] RFC: toolchain wrapper for external toolchains Peter Korsgaard
  2011-05-03 14:40 ` [Buildroot] [PATCH 1/2] Add " Peter Korsgaard
  2011-05-03 14:40 ` [Buildroot] [PATCH 2/2] Get rid of unneeded CFLAGS Peter Korsgaard
@ 2011-05-05 21:44 ` Peter Korsgaard
  2011-05-08 17:01   ` Thomas Petazzoni
  2 siblings, 1 reply; 7+ messages in thread
From: Peter Korsgaard @ 2011-05-05 21:44 UTC (permalink / raw)
  To: buildroot

On Tue, May 3, 2011 at 4:40 PM, Peter Korsgaard <jacmet@sunsite.dk> wrote:
> This patch series adds a toolchain wrapper for external toolchains as
> discussed during the Buildroot dev day after FOSDEM.

I didn't hear any negative comments either on the list or on IRC, so
I've committed this.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] RFC: toolchain wrapper for external toolchains
  2011-05-05 21:44 ` [Buildroot] RFC: toolchain wrapper for external toolchains Peter Korsgaard
@ 2011-05-08 17:01   ` Thomas Petazzoni
  2011-05-08 20:16     ` Peter Korsgaard
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2011-05-08 17:01 UTC (permalink / raw)
  To: buildroot

Hello,

On Thu, 5 May 2011 23:44:04 +0200
Peter Korsgaard <jacmet@sunsite.dk> wrote:

> I didn't hear any negative comments either on the list or on IRC, so
> I've committed this.

I am not entirely happy with how things went with this patch set. It
touches a fairly major mechanism in the external toolchain support, and
it has been committed without an official Acked-by from the most active
contributor in this area.

Moreover, it has been committed only two days after the proposal, a
duration which is very short for the other contributors to take the
time to test the patches and give their opinion. This is also very
short compared to the amount of time many other contributions have been
waiting for being merged. For example, have a look at the patch set I
contributed on April, 2nd
(http://lists.busybox.net/pipermail/buildroot/2011-April/042309.html),
which is also something that has been discussed during the FOSDEM
meeting.

And finally, I am also unhappy because these changes were broken in a
basic way: the first test I did with a basic CodeSourcery external
toolchain failed (see the patch I just sent). I don't, by far, claim to
always post well-tested and perfect patches. However, added to the very
quick post-to-commit delay and the absence of real ACK from other
contributors, it makes me a little bit unhappy.

In the future, would it be possible to leave more time between post and
commit, for such major infrastructure changes ?

Thanks,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] RFC: toolchain wrapper for external toolchains
  2011-05-08 17:01   ` Thomas Petazzoni
@ 2011-05-08 20:16     ` Peter Korsgaard
  2011-05-09  7:09       ` Thomas Petazzoni
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Korsgaard @ 2011-05-08 20:16 UTC (permalink / raw)
  To: buildroot

>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:

Hi,

 Thomas> I am not entirely happy with how things went with this patch
 Thomas> set. It touches a fairly major mechanism in the external
 Thomas> toolchain support, and it has been committed without an
 Thomas> official Acked-by from the most active contributor in this
 Thomas> area.

I understand your frustration and agree that this could have been
handled better.

 Thomas> Moreover, it has been committed only two days after the
 Thomas> proposal, a duration which is very short for the other
 Thomas> contributors to take the time to test the patches and give
 Thomas> their opinion. This is also very short compared to the amount
 Thomas> of time many other contributions have been waiting for being
 Thomas> merged. For example, have a look at the patch set I contributed
 Thomas> on April, 2nd
 Thomas> (http://lists.busybox.net/pipermail/buildroot/2011-April/042309.html),
 Thomas> which is also something that has been discussed during the
 Thomas> FOSDEM meeting.

Yes. The config option rename is naturally massively intrusive, so I
didn't want to rush to apply it (E.G. see the recent discussion about
differing between what the toolchain has for ext toolchains and what we
want to enable - E.G. ipv6 support)

 Thomas> And finally, I am also unhappy because these changes were
 Thomas> broken in a basic way: the first test I did with a basic
 Thomas> CodeSourcery external toolchain failed (see the patch I just
 Thomas> sent). I don't, by far, claim to always post well-tested and
 Thomas> perfect patches. However, added to the very quick
 Thomas> post-to-commit delay and the absence of real ACK from other
 Thomas> contributors, it makes me a little bit unhappy.

I agree. I rushed things a bit too much because of other real life
issues and the fact that we're already late for -rc1. Sorry about this.

 Thomas> In the future, would it be possible to leave more time between
 Thomas> post and commit, for such major infrastructure changes ?

Sure.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] RFC: toolchain wrapper for external toolchains
  2011-05-08 20:16     ` Peter Korsgaard
@ 2011-05-09  7:09       ` Thomas Petazzoni
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2011-05-09  7:09 UTC (permalink / raw)
  To: buildroot

Hello,

On Sun, 08 May 2011 22:16:41 +0200
Peter Korsgaard <jacmet@uclibc.org> wrote:

>  Thomas> Moreover, it has been committed only two days after the
>  Thomas> proposal, a duration which is very short for the other
>  Thomas> contributors to take the time to test the patches and give
>  Thomas> their opinion. This is also very short compared to the amount
>  Thomas> of time many other contributions have been waiting for being
>  Thomas> merged. For example, have a look at the patch set I
>  Thomas> contributed on April, 2nd
>  Thomas> (http://lists.busybox.net/pipermail/buildroot/2011-April/042309.html),
>  Thomas> which is also something that has been discussed during the
>  Thomas> FOSDEM meeting.
> 
> Yes. The config option rename is naturally massively intrusive, so I
> didn't want to rush to apply it (E.G. see the recent discussion about
> differing between what the toolchain has for ext toolchains and what
> we want to enable - E.G. ipv6 support)

Yes, I indeed understand that this patch set is intrusive :-)

>  Thomas> In the future, would it be possible to leave more time
>  Thomas> between post and commit, for such major infrastructure
>  Thomas> changes ?
> 
> Sure.

Thanks a lot. I strongly appreciate that it is possible to have this
kind of open discussion on the development process without entering any
sort of aggression or fight.

Regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-05-09  7:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-03 14:40 [Buildroot] RFC: toolchain wrapper for external toolchains Peter Korsgaard
2011-05-03 14:40 ` [Buildroot] [PATCH 1/2] Add " Peter Korsgaard
2011-05-03 14:40 ` [Buildroot] [PATCH 2/2] Get rid of unneeded CFLAGS Peter Korsgaard
2011-05-05 21:44 ` [Buildroot] RFC: toolchain wrapper for external toolchains Peter Korsgaard
2011-05-08 17:01   ` Thomas Petazzoni
2011-05-08 20:16     ` Peter Korsgaard
2011-05-09  7:09       ` Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox