mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-25 16:31:13 +00:00
0e161968a7
Currently when external toolchain is used, a info.mk is created (with to-be-filled values) but is never actually filled with real values and is never actually used in rules.mk. This info.mk is used down the code with special packages like libgcc to reference info like gcc version and package special library. To mimic what is done with internal toolchain, add the include in rules.mk for info.mk also for external library and in fix toolchain/wrapper to fill the staging_dir info.mk. The logic is to check if the external toolchain provide an info.mk and if it doesn't we at least fill the GCC_VERSION with the value set in the .config file. With this special library like libgcc correctly reference and have set the GCC_VERSION variable. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
73 lines
1.8 KiB
Makefile
73 lines
1.8 KiB
Makefile
#
|
|
# 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 "$(if $(call qstrip,$(CONFIG_TOOLCHAIN_LIBC)),-m$(call qstrip,$(CONFIG_TOOLCHAIN_LIBC))) $(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/SetToolchainInfo
|
|
if [ -f $(CONFIG_TOOLCHAIN_ROOT)/info.mk ]; then \
|
|
$(CP) $(CONFIG_TOOLCHAIN_ROOT)/info.mk $(TOOLCHAIN_DIR)/; \
|
|
else \
|
|
$(SED) 's,GCC_VERSION=.*,GCC_VERSION=$(CONFIG_GCC_VERSION),' $(TOOLCHAIN_DIR)/info.mk; \
|
|
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")
|
|
$(call Host/SetToolchainInfo)
|
|
endef
|
|
|
|
define Host/Clean
|
|
rm -rf $(TOOLCHAIN_DIR)/bin
|
|
rm -rf $(TOOLCHAIN_DIR)/info.mk
|
|
endef
|
|
|
|
$(eval $(call HostBuild))
|