aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2012-01-18 03:08:09 +0000
committerJo-Philipp Wich <jow@openwrt.org>2012-01-18 03:08:09 +0000
commitac2f1b4f014f36e7490df7a5b31aa1fb4bd377ee (patch)
tree5882c76d27659554dfaae43b1c02487bdd358478
parent39407a1e6e22fdedfe9ecb6734b0303dd5c395b6 (diff)
downloadupstream-ac2f1b4f014f36e7490df7a5b31aa1fb4bd377ee.tar.gz
upstream-ac2f1b4f014f36e7490df7a5b31aa1fb4bd377ee.tar.bz2
upstream-ac2f1b4f014f36e7490df7a5b31aa1fb4bd377ee.zip
[buildroot] use ext-toolchain.sh to integrate external toolchains
Use ext-toolchain.sh to wrap external toolchain commands, abort build if certain features such as CONFIG_SOFT_FLOAT or CONFIG_IPV6 are enabled but not supported by the toolchain. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@29766 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--rules.mk2
-rw-r--r--toolchain/Makefile2
-rw-r--r--toolchain/wrapper/Makefile62
3 files changed, 64 insertions, 2 deletions
diff --git a/rules.mk b/rules.mk
index ef61c4d749..6c7514f2a7 100644
--- a/rules.mk
+++ b/rules.mk
@@ -148,7 +148,7 @@ ifndef DUMP
ifneq ($(TOOLCHAIN_LIB_DIRS),)
TARGET_LDFLAGS+= $(patsubst %,-L%,$(TOOLCHAIN_LIB_DIRS))
endif
- TOOLCHAIN_DIR:=$(TOOLCHAIN_ROOT_DIR)
+ TARGET_PATH:=$(TOOLCHAIN_DIR)/bin:$(TARGET_PATH)
endif
endif
endif
diff --git a/toolchain/Makefile b/toolchain/Makefile
index 0443924c53..3a9cd0b2f8 100644
--- a/toolchain/Makefile
+++ b/toolchain/Makefile
@@ -28,7 +28,7 @@
curdir:=toolchain
# subdirectories to descend into
-$(curdir)/builddirs := $(if $(CONFIG_GDB),gdb) $(if $(CONFIG_INSIGHT),insight) $(if $(CONFIG_EXTERNAL_TOOLCHAIN),,kernel-headers binutils gcc/minimal gcc/initial gcc/final $(LIBC) $(if $(CONFIG_GLIBC_PORTS),glibc-ports))
+$(curdir)/builddirs := $(if $(CONFIG_GDB),gdb) $(if $(CONFIG_INSIGHT),insight) $(if $(CONFIG_EXTERNAL_TOOLCHAIN),wrapper,kernel-headers binutils gcc/minimal gcc/initial gcc/final $(LIBC) $(if $(CONFIG_GLIBC_PORTS),glibc-ports))
$(curdir)/builddirs-compile:=$($(curdir)/builddirs-prepare)
$(curdir)/builddirs-install:=$($(curdir)/builddirs-compile)
diff --git a/toolchain/wrapper/Makefile b/toolchain/wrapper/Makefile
new file mode 100644
index 0000000000..417ed8cd37
--- /dev/null
+++ b/toolchain/wrapper/Makefile
@@ -0,0 +1,62 @@
+#
+# Copyright (C) 2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=wrapper
+PKG_VERSION:=1
+
+include $(INCLUDE_DIR)/toolchain-build.mk
+
+
+# 1: args
+define toolchain_util
+$(strip $(SCRIPT_DIR)/ext-toolchain.sh --toolchain $(CONFIG_TOOLCHAIN_ROOT) \
+ --cflags $(CONFIG_TARGET_OPTIMIZATION) \
+ --cflags "-muclibc $(if $(CONFIG_SOFT_FLOAT),-msoft-float)" \
+ --cflags "$(patsubst ./%,-I$(TOOLCHAIN_ROOT_DIR)/%,$(call qstrip,$(CONFIG_TOOLCHAIN_INC_PATH)))" \
+ --cflags "$(patsubst ./%,-L$(TOOLCHAIN_ROOT_DIR)/%,$(call qstrip,$(CONFIG_TOOLCHAIN_LIB_PATH)))" \
+ $(1))
+endef
+
+# 1: config symbol
+# 2: feature
+define toolchain_test
+$$(if $$($(1)), \
+ @echo -n "Testing external toolchain for $(2) support ... "; \
+ if $(call toolchain_util,--test "$(2)"); then \
+ echo "ok"; exit 0; \
+ else \
+ echo "failed"; \
+ echo "ERROR: $(1) is enabled but the external toolchain does not support it"; \
+ exit 1; \
+ fi)
+endef
+
+
+define Host/Prepare
+ $(call toolchain_test,CONFIG_SOFT_FLOAT,softfloat)
+ $(call toolchain_test,CONFIG_IPV6,ipv6)
+ $(call toolchain_test,CONFIG_NLS,wchar)
+ $(call toolchain_test,CONFIG_PACKAGE_libpthread,threads)
+endef
+
+define Host/Configure
+endef
+
+define Host/Compile
+endef
+
+define Host/Install
+ $(call toolchain_util,--wrap "$(TOOLCHAIN_DIR)/bin")
+endef
+
+define Host/Clean
+ rm -rf $(TOOLCHAIN_DIR)/bin
+endef
+
+$(eval $(call HostBuild))