* [Buildroot] [PATCH 0/4] Preparatory work on toolchains - v4
@ 2010-07-27 22:08 Yann E. MORIN
2010-07-27 22:08 ` [Buildroot] [PATCH 1/4] toolchain: move helper functions from external toolchain Yann E. MORIN
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Yann E. MORIN @ 2010-07-27 22:08 UTC (permalink / raw)
To: buildroot
Hello All!
These are preparatory work on toolchain, laying ground to later add
crosstool-NG as a backend.
Changes since v3:
- rebased against latest tree
- removed patch #5 (rename base makefile target) as there's issue
with it
Changes since v2:
- rebased againts latest tree
- enhance commit message for 3rd patch
Changes since v1:
- rebased against latest tree
- patches formatted to detect renames/copies
Yann E. MORIN (4):
toolchain: move helper functions from external toolchain
toolchain: rename external toolchain dir
toolchain: move makefile includes
toolchain: move buildroot config files
Makefile | 15 +-
toolchain/Config.in | 16 +-
toolchain/external-toolchain/ext-tool.mk | 356 --------------------
toolchain/helpers.mk | 244 ++++++++++++++
toolchain/toolchain-buildroot.mk | 12 +
.../{Config.in.1 => toolchain-buildroot/Config.in} | 2 +-
toolchain/toolchain-buildroot/Config.in.2 | 37 ++
toolchain/{Config.in.2 => toolchain-common.in} | 46 +--
toolchain/toolchain-external.mk | 14 +
.../Config.in | 0
.../Config.in.2 | 0
toolchain/toolchain-external/ext-tool.mk | 115 +++++++
12 files changed, 439 insertions(+), 418 deletions(-)
delete mode 100644 toolchain/external-toolchain/ext-tool.mk
create mode 100644 toolchain/helpers.mk
create mode 100644 toolchain/toolchain-buildroot.mk
rename toolchain/{Config.in.1 => toolchain-buildroot/Config.in} (82%)
create mode 100644 toolchain/toolchain-buildroot/Config.in.2
rename toolchain/{Config.in.2 => toolchain-common.in} (84%)
create mode 100644 toolchain/toolchain-external.mk
rename toolchain/{external-toolchain => toolchain-external}/Config.in (100%)
rename toolchain/{external-toolchain => toolchain-external}/Config.in.2 (100%)
create mode 100644 toolchain/toolchain-external/ext-tool.mk
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 1/4] toolchain: move helper functions from external toolchain
2010-07-27 22:08 [Buildroot] [PATCH 0/4] Preparatory work on toolchains - v4 Yann E. MORIN
@ 2010-07-27 22:08 ` Yann E. MORIN
2010-07-27 22:08 ` [Buildroot] [PATCH 2/4] toolchain: rename external toolchain dir Yann E. MORIN
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2010-07-27 22:08 UTC (permalink / raw)
To: buildroot
The helper functions used for external toolchains may also be useful
to alternate toolchain backends (currently, the external toolchain is
the sole user).
Signed-off-by: Yann E. MORIN <yann.morin.1998@anciens.enib.fr>
---
Makefile | 1 +
toolchain/external-toolchain/ext-tool.mk | 241 -----------------------------
toolchain/helpers.mk | 244 ++++++++++++++++++++++++++++++
3 files changed, 245 insertions(+), 241 deletions(-)
create mode 100644 toolchain/helpers.mk
diff --git a/Makefile b/Makefile
index a864aae..b1d5079 100644
--- a/Makefile
+++ b/Makefile
@@ -307,6 +307,7 @@ include toolchain/mklibs/mklibs.mk
include toolchain/sstrip/sstrip.mk
include toolchain/uClibc/uclibc.mk
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
+include toolchain/helpers.mk
include toolchain/*/*.mk
endif
diff --git a/toolchain/external-toolchain/ext-tool.mk b/toolchain/external-toolchain/ext-tool.mk
index 8be86f5..7e4645d 100644
--- a/toolchain/external-toolchain/ext-tool.mk
+++ b/toolchain/external-toolchain/ext-tool.mk
@@ -37,247 +37,6 @@
# cross-compiler binaries remains external, all libraries and headers
# are imported into the Buildroot tree.
-#
-# Copy a toolchain library and its symbolic links from the sysroot
-# directory to the target directory. Also optionaly strips the
-# library.
-#
-# Most toolchains have their libraries either in /lib or /usr/lib
-# relative to their ARCH_SYSROOT_DIR. Buildroot toolchains, however,
-# have basic libraries in /lib, and libstdc++/libgcc_s in
-# /usr/<target-name>/lib(64).
-#
-# $1: arch specific sysroot directory
-# $2: library name
-# $3: destination directory of the libary, relative to $(TARGET_DIR)
-# $4: strip (y|n), default is to strip
-#
-copy_toolchain_lib_root = \
- ARCH_SYSROOT_DIR="$(strip $1)"; \
- LIB="$(strip $2)"; \
- DESTDIR="$(strip $3)" ; \
- STRIP="$(strip $4)"; \
- \
- LIBS=`(cd $${ARCH_SYSROOT_DIR}; \
- find -L . -path "./lib/$${LIB}.*" -o \
- -path "./usr/lib/$${LIB}.*" -o \
- -path "./usr/$(TOOLCHAIN_EXTERNAL_PREFIX)/lib*/$${LIB}.*" \
- )` ; \
- for FILE in $${LIBS} ; do \
- LIB=`basename $${FILE}`; \
- LIBDIR=`dirname $${FILE}` ; \
- while test \! -z "$${LIB}"; do \
- FULLPATH="$${ARCH_SYSROOT_DIR}/$${LIBDIR}/$${LIB}" ; \
- rm -fr $(TARGET_DIR)/$${DESTDIR}/$${LIB}; \
- mkdir -p $(TARGET_DIR)/$${DESTDIR}; \
- if test -h $${FULLPATH} ; then \
- cp -d $${FULLPATH} $(TARGET_DIR)/$${DESTDIR}/; \
- elif test -f $${FULLPATH}; then \
- $(INSTALL) -D -m0755 $${FULLPATH} $(TARGET_DIR)/$${DESTDIR}/$${LIB}; \
- case "$${STRIP}" in \
- (0 | n | no) \
-;; \
- (*) \
- $(TARGET_CROSS)strip "$(TARGET_DIR)/$${DESTDIR}/$${LIB}"; \
-;; \
- esac; \
- else \
- exit -1; \
- fi; \
- LIB="`readlink $${FULLPATH}`"; \
- done; \
- done; \
- \
- echo -n
-
-#
-# Copy the full external toolchain sysroot directory to the staging
-# dir. The operation of this function is rendered a little bit
-# complicated by the support for multilib toolchains.
-#
-# We start by copying etc, lib, sbin and usr from the sysroot of the
-# selected architecture variant (as pointed by ARCH_SYSROOT_DIR). This
-# allows to import into the staging directory the C library and
-# companion libraries for the correct architecture variant. We
-# explictly only copy etc, lib, sbin and usr since other directories
-# might exist for other architecture variants (on Codesourcery
-# toolchain, the sysroot for the default architecture variant contains
-# the armv4t and thumb2 subdirectories, which are the sysroot for the
-# corresponding architecture variants), and we don't want to import
-# them.
-#
-# Then, if the selected architecture variant is not the default one
-# (i.e, if SYSROOT_DIR != ARCH_SYSROOT_DIR), then we :
-#
-# * Import the header files from the default architecture
-# variant. Header files are typically shared between the sysroots
-# for the different architecture variants. If we use the
-# non-default one, header files were not copied by the previous
-# step, so we copy them here from the sysroot of the default
-# architecture variant.
-#
-# * Create a symbolic link that matches the name of the subdirectory
-# for the architecture variant in the original sysroot. This is
-# required as the compiler will by default look in
-# sysroot_dir/arch_variant/ for libraries and headers, when the
-# non-default architecture variant is used. Without this, the
-# compiler fails to find libraries and headers.
-#
-# $1: main sysroot directory of the toolchain
-# $2: arch specific sysroot directory of the toolchain
-# $3: arch specific subdirectory in the sysroot
-#
-copy_toolchain_sysroot = \
- SYSROOT_DIR="$(strip $1)"; \
- ARCH_SYSROOT_DIR="$(strip $2)"; \
- ARCH_SUBDIR="$(strip $3)"; \
- for i in etc lib sbin usr ; do \
- if [ -d $${ARCH_SYSROOT_DIR}/$$i ] ; then \
- cp -a $${ARCH_SYSROOT_DIR}/$$i $(STAGING_DIR)/ ; \
- fi ; \
- done ; \
- if [ `readlink -f $${SYSROOT_DIR}` != `readlink -f $${ARCH_SYSROOT_DIR}` ] ; then \
- if [ ! -d $${ARCH_SYSROOT_DIR}/usr/include ] ; then \
- cp -a $${SYSROOT_DIR}/usr/include $(STAGING_DIR)/usr ; \
- fi ; \
- ln -s . $(STAGING_DIR)/$(ARCH_SUBDIR) ; \
- fi ; \
- find $(STAGING_DIR) -type d | xargs chmod 755
-
-#
-# Create lib64 -> lib and usr/lib64 -> usr/lib symbolic links in the
-# target and staging directories. This is needed for some 64 bits
-# toolchains such as the Crosstool-NG toolchains, for which the path
-# to the dynamic loader and other libraries is /lib64, but the
-# libraries are stored in /lib.
-#
-create_lib64_symlinks = \
- (cd $(TARGET_DIR) ; ln -s lib lib64) ; \
- (cd $(TARGET_DIR)/usr ; ln -s lib lib64) ; \
- (cd $(STAGING_DIR) ; ln -s lib lib64) ; \
- (cd $(STAGING_DIR)/usr ; ln -s lib lib64)
-
-#
-# Check the availability of a particular glibc feature. We assume that
-# all Buildroot toolchain options are supported by glibc, so we just
-# check that they are enabled.
-#
-# $1: Buildroot option name
-# $2: feature description
-#
-check_glibc_feature = \
- if [ x$($(1)) != x"y" ] ; then \
- echo "$(2) available in C library, please enable $(1)" ; \
- exit 1 ; \
- fi
-
-#
-# Check the correctness of a glibc external toolchain configuration.
-# 1. Check that the C library selected in Buildroot matches the one
-# of the external toolchain
-# 2. Check that all the C library-related features are enabled in the
-# config, since glibc always supports all of them
-#
-# $1: sysroot directory
-#
-check_glibc = \
- SYSROOT_DIR="$(strip $1)"; \
- if ! test -f $${SYSROOT_DIR}/lib/ld-linux*.so.* -o -f $${SYSROOT_DIR}/lib/ld.so.* ; then \
- echo "Incorrect selection of the C library"; \
- exit -1; \
- fi; \
- $(call check_glibc_feature,BR2_LARGEFILE,Large file support) ;\
- $(call check_glibc_feature,BR2_INET_IPV6,IPv6 support) ;\
- $(call check_glibc_feature,BR2_INET_RPC,RPC support) ;\
- $(call check_glibc_feature,BR2_ENABLE_LOCALE,Locale support) ;\
- $(call check_glibc_feature,BR2_USE_WCHAR,Wide char support) ;\
- $(call check_glibc_feature,BR2_PROGRAM_INVOCATION,Program invocation support)
-
-#
-# Check the conformity of Buildroot configuration with regard to the
-# uClibc configuration of the external toolchain, for a particular
-# feature.
-#
-# $1: uClibc macro name
-# $2: Buildroot option name
-# $3: uClibc config file
-# $4: feature description
-#
-check_uclibc_feature = \
- IS_IN_LIBC=`grep -q "\#define $(1) 1" $(3) && echo y` ; \
- if [ x$($(2)) != x"y" -a x$${IS_IN_LIBC} == x"y" ] ; then \
- echo "$(4) available in C library, please enable $(2)" ; \
- exit 1 ; \
- fi ; \
- if [ x$($(2)) == x"y" -a x$${IS_IN_LIBC} != x"y" ] ; then \
- echo "$(4) not available in C library, please disable $(2)" ; \
- exit 1 ; \
- fi
-
-#
-# Check the correctness of a uclibc external toolchain configuration
-# 1. Check that the C library selected in Buildroot matches the one
-# of the external toolchain
-# 2. Check that the features enabled in the Buildroot configuration
-# match the features available in the uClibc of the external
-# toolchain
-#
-# $1: sysroot directory
-#
-check_uclibc = \
- SYSROOT_DIR="$(strip $1)"; \
- if ! test -f $${SYSROOT_DIR}/lib/ld*-uClibc.so.* ; then \
- echo "Incorrect selection of the C library"; \
- exit -1; \
- fi; \
- UCLIBC_CONFIG_FILE=$${SYSROOT_DIR}/usr/include/bits/uClibc_config.h ; \
- $(call check_uclibc_feature,__UCLIBC_HAS_LFS__,BR2_LARGEFILE,$${UCLIBC_CONFIG_FILE},Large file support) ;\
- $(call check_uclibc_feature,__UCLIBC_HAS_IPV6__,BR2_INET_IPV6,$${UCLIBC_CONFIG_FILE},IPv6 support) ;\
- $(call check_uclibc_feature,__UCLIBC_HAS_RPC__,BR2_INET_RPC,$${UCLIBC_CONFIG_FILE},RPC support) ;\
- $(call check_uclibc_feature,__UCLIBC_HAS_LOCALE__,BR2_ENABLE_LOCALE,$${UCLIBC_CONFIG_FILE},Locale support) ;\
- $(call check_uclibc_feature,__UCLIBC_HAS_WCHAR__,BR2_USE_WCHAR,$${UCLIBC_CONFIG_FILE},Wide char support) ;\
- $(call check_uclibc_feature,__UCLIBC_HAS_PROGRAM_INVOCATION_NAME__,BR2_PROGRAM_INVOCATION,$${UCLIBC_CONFIG_FILE},Program invocation support) ;\
-
-#
-# Check that the Buildroot configuration of the ABI matches the
-# configuration of the external toolchain.
-#
-check_arm_abi = \
- EXT_TOOLCHAIN_TARGET=$(shell LANG=C $(TARGET_CC) -v 2>&1 | grep ^Target | cut -f2 -d ' ') ; \
- if echo $${EXT_TOOLCHAIN_TARGET} | grep -q 'eabi$$' ; then \
- EXT_TOOLCHAIN_ABI="eabi" ; \
- else \
- EXT_TOOLCHAIN_ABI="oabi" ; \
- fi ; \
- if [ x$(BR2_ARM_OABI) == x"y" -a $${EXT_TOOLCHAIN_ABI} == "eabi" ] ; then \
- echo "Incorrect ABI setting" ; \
- exit 1 ; \
- fi ; \
- if [ x$(BR2_ARM_EABI) == x"y" -a $${EXT_TOOLCHAIN_ABI} == "oabi" ] ; then \
- echo "Incorrect ABI setting" ; \
- exit 1 ; \
- fi ; \
-
-#
-# Check that the external toolchain supports C++
-#
-check_cplusplus = \
- $(TARGET_CXX) -v > /dev/null 2>&1 ; \
- if test $$? -ne 0 ; then \
- echo "BR2_INSTALL_LIBSTDCPP is selected but C++ support not available in external toolchain" ; \
- exit 1 ; \
- fi ; \
-
-#
-# Check that the cross-compiler given in the configuration exists
-#
-check_cross_compiler_exists = \
- $(TARGET_CC) -v > /dev/null 2>&1 ; \
- if test $$? -ne 0 ; then \
- echo "Cannot execute cross-compiler '$(TARGET_CC)'" ; \
- exit 1 ; \
- fi ; \
-
uclibc: dependencies $(STAMP_DIR)/ext-toolchain-installed
LIB_EXTERNAL_LIBS=ld*.so libc.so libcrypt.so libdl.so libgcc_s.so libm.so libnsl.so libresolv.so librt.so libutil.so
diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
new file mode 100644
index 0000000..5c87d2b
--- /dev/null
+++ b/toolchain/helpers.mk
@@ -0,0 +1,244 @@
+# This Makefile fragment declares helper functions, usefull to handle
+# non- buildroot-built toolchains, eg. purely external toolchains or
+# toolchains (internally) built using crosstool-NG.
+
+#
+# Copy a toolchain library and its symbolic links from the sysroot
+# directory to the target directory. Also optionaly strips the
+# library.
+#
+# Most toolchains have their libraries either in /lib or /usr/lib
+# relative to their ARCH_SYSROOT_DIR. Buildroot toolchains, however,
+# have basic libraries in /lib, and libstdc++/libgcc_s in
+# /usr/<target-name>/lib(64).
+#
+# $1: arch specific sysroot directory
+# $2: library name
+# $3: destination directory of the libary, relative to $(TARGET_DIR)
+# $4: strip (y|n), default is to strip
+#
+copy_toolchain_lib_root = \
+ ARCH_SYSROOT_DIR="$(strip $1)"; \
+ LIB="$(strip $2)"; \
+ DESTDIR="$(strip $3)" ; \
+ STRIP="$(strip $4)"; \
+ \
+ LIBS=`(cd $${ARCH_SYSROOT_DIR}; \
+ find -L . -path "./lib/$${LIB}.*" -o \
+ -path "./usr/lib/$${LIB}.*" -o \
+ -path "./usr/$(TOOLCHAIN_EXTERNAL_PREFIX)/lib*/$${LIB}.*" \
+ )` ; \
+ for FILE in $${LIBS} ; do \
+ LIB=`basename $${FILE}`; \
+ LIBDIR=`dirname $${FILE}` ; \
+ while test \! -z "$${LIB}"; do \
+ FULLPATH="$${ARCH_SYSROOT_DIR}/$${LIBDIR}/$${LIB}" ; \
+ rm -fr $(TARGET_DIR)/$${DESTDIR}/$${LIB}; \
+ mkdir -p $(TARGET_DIR)/$${DESTDIR}; \
+ if test -h $${FULLPATH} ; then \
+ cp -d $${FULLPATH} $(TARGET_DIR)/$${DESTDIR}/; \
+ elif test -f $${FULLPATH}; then \
+ $(INSTALL) -D -m0755 $${FULLPATH} $(TARGET_DIR)/$${DESTDIR}/$${LIB}; \
+ case "$${STRIP}" in \
+ (0 | n | no) \
+;; \
+ (*) \
+ $(TARGET_CROSS)strip "$(TARGET_DIR)/$${DESTDIR}/$${LIB}"; \
+;; \
+ esac; \
+ else \
+ exit -1; \
+ fi; \
+ LIB="`readlink $${FULLPATH}`"; \
+ done; \
+ done; \
+ \
+ echo -n
+
+#
+# Copy the full external toolchain sysroot directory to the staging
+# dir. The operation of this function is rendered a little bit
+# complicated by the support for multilib toolchains.
+#
+# We start by copying etc, lib, sbin and usr from the sysroot of the
+# selected architecture variant (as pointed by ARCH_SYSROOT_DIR). This
+# allows to import into the staging directory the C library and
+# companion libraries for the correct architecture variant. We
+# explictly only copy etc, lib, sbin and usr since other directories
+# might exist for other architecture variants (on Codesourcery
+# toolchain, the sysroot for the default architecture variant contains
+# the armv4t and thumb2 subdirectories, which are the sysroot for the
+# corresponding architecture variants), and we don't want to import
+# them.
+#
+# Then, if the selected architecture variant is not the default one
+# (i.e, if SYSROOT_DIR != ARCH_SYSROOT_DIR), then we :
+#
+# * Import the header files from the default architecture
+# variant. Header files are typically shared between the sysroots
+# for the different architecture variants. If we use the
+# non-default one, header files were not copied by the previous
+# step, so we copy them here from the sysroot of the default
+# architecture variant.
+#
+# * Create a symbolic link that matches the name of the subdirectory
+# for the architecture variant in the original sysroot. This is
+# required as the compiler will by default look in
+# sysroot_dir/arch_variant/ for libraries and headers, when the
+# non-default architecture variant is used. Without this, the
+# compiler fails to find libraries and headers.
+#
+# $1: main sysroot directory of the toolchain
+# $2: arch specific sysroot directory of the toolchain
+# $3: arch specific subdirectory in the sysroot
+#
+copy_toolchain_sysroot = \
+ SYSROOT_DIR="$(strip $1)"; \
+ ARCH_SYSROOT_DIR="$(strip $2)"; \
+ ARCH_SUBDIR="$(strip $3)"; \
+ for i in etc lib sbin usr ; do \
+ if [ -d $${ARCH_SYSROOT_DIR}/$$i ] ; then \
+ cp -a $${ARCH_SYSROOT_DIR}/$$i $(STAGING_DIR)/ ; \
+ fi ; \
+ done ; \
+ if [ `readlink -f $${SYSROOT_DIR}` != `readlink -f $${ARCH_SYSROOT_DIR}` ] ; then \
+ if [ ! -d $${ARCH_SYSROOT_DIR}/usr/include ] ; then \
+ cp -a $${SYSROOT_DIR}/usr/include $(STAGING_DIR)/usr ; \
+ fi ; \
+ ln -s . $(STAGING_DIR)/$(ARCH_SUBDIR) ; \
+ fi ; \
+ find $(STAGING_DIR) -type d | xargs chmod 755
+
+#
+# Create lib64 -> lib and usr/lib64 -> usr/lib symbolic links in the
+# target and staging directories. This is needed for some 64 bits
+# toolchains such as the Crosstool-NG toolchains, for which the path
+# to the dynamic loader and other libraries is /lib64, but the
+# libraries are stored in /lib.
+#
+create_lib64_symlinks = \
+ (cd $(TARGET_DIR) ; ln -s lib lib64) ; \
+ (cd $(TARGET_DIR)/usr ; ln -s lib lib64) ; \
+ (cd $(STAGING_DIR) ; ln -s lib lib64) ; \
+ (cd $(STAGING_DIR)/usr ; ln -s lib lib64)
+
+#
+# Check the availability of a particular glibc feature. We assume that
+# all Buildroot toolchain options are supported by glibc, so we just
+# check that they are enabled.
+#
+# $1: Buildroot option name
+# $2: feature description
+#
+check_glibc_feature = \
+ if [ x$($(1)) != x"y" ] ; then \
+ echo "$(2) available in C library, please enable $(1)" ; \
+ exit 1 ; \
+ fi
+
+#
+# Check the correctness of a glibc external toolchain configuration.
+# 1. Check that the C library selected in Buildroot matches the one
+# of the external toolchain
+# 2. Check that all the C library-related features are enabled in the
+# config, since glibc always supports all of them
+#
+# $1: sysroot directory
+#
+check_glibc = \
+ SYSROOT_DIR="$(strip $1)"; \
+ if ! test -f $${SYSROOT_DIR}/lib/ld-linux*.so.* -o -f $${SYSROOT_DIR}/lib/ld.so.* ; then \
+ echo "Incorrect selection of the C library"; \
+ exit -1; \
+ fi; \
+ $(call check_glibc_feature,BR2_LARGEFILE,Large file support) ;\
+ $(call check_glibc_feature,BR2_INET_IPV6,IPv6 support) ;\
+ $(call check_glibc_feature,BR2_INET_RPC,RPC support) ;\
+ $(call check_glibc_feature,BR2_ENABLE_LOCALE,Locale support) ;\
+ $(call check_glibc_feature,BR2_USE_WCHAR,Wide char support) ;\
+ $(call check_glibc_feature,BR2_PROGRAM_INVOCATION,Program invocation support)
+
+#
+# Check the conformity of Buildroot configuration with regard to the
+# uClibc configuration of the external toolchain, for a particular
+# feature.
+#
+# $1: uClibc macro name
+# $2: Buildroot option name
+# $3: uClibc config file
+# $4: feature description
+#
+check_uclibc_feature = \
+ IS_IN_LIBC=`grep -q "\#define $(1) 1" $(3) && echo y` ; \
+ if [ x$($(2)) != x"y" -a x$${IS_IN_LIBC} == x"y" ] ; then \
+ echo "$(4) available in C library, please enable $(2)" ; \
+ exit 1 ; \
+ fi ; \
+ if [ x$($(2)) == x"y" -a x$${IS_IN_LIBC} != x"y" ] ; then \
+ echo "$(4) not available in C library, please disable $(2)" ; \
+ exit 1 ; \
+ fi
+
+#
+# Check the correctness of a uclibc external toolchain configuration
+# 1. Check that the C library selected in Buildroot matches the one
+# of the external toolchain
+# 2. Check that the features enabled in the Buildroot configuration
+# match the features available in the uClibc of the external
+# toolchain
+#
+# $1: sysroot directory
+#
+check_uclibc = \
+ SYSROOT_DIR="$(strip $1)"; \
+ if ! test -f $${SYSROOT_DIR}/lib/ld*-uClibc.so.* ; then \
+ echo "Incorrect selection of the C library"; \
+ exit -1; \
+ fi; \
+ UCLIBC_CONFIG_FILE=$${SYSROOT_DIR}/usr/include/bits/uClibc_config.h ; \
+ $(call check_uclibc_feature,__UCLIBC_HAS_LFS__,BR2_LARGEFILE,$${UCLIBC_CONFIG_FILE},Large file support) ;\
+ $(call check_uclibc_feature,__UCLIBC_HAS_IPV6__,BR2_INET_IPV6,$${UCLIBC_CONFIG_FILE},IPv6 support) ;\
+ $(call check_uclibc_feature,__UCLIBC_HAS_RPC__,BR2_INET_RPC,$${UCLIBC_CONFIG_FILE},RPC support) ;\
+ $(call check_uclibc_feature,__UCLIBC_HAS_LOCALE__,BR2_ENABLE_LOCALE,$${UCLIBC_CONFIG_FILE},Locale support) ;\
+ $(call check_uclibc_feature,__UCLIBC_HAS_WCHAR__,BR2_USE_WCHAR,$${UCLIBC_CONFIG_FILE},Wide char support) ;\
+ $(call check_uclibc_feature,__UCLIBC_HAS_PROGRAM_INVOCATION_NAME__,BR2_PROGRAM_INVOCATION,$${UCLIBC_CONFIG_FILE},Program invocation support) ;\
+
+#
+# Check that the Buildroot configuration of the ABI matches the
+# configuration of the external toolchain.
+#
+check_arm_abi = \
+ EXT_TOOLCHAIN_TARGET=$(shell LANG=C $(TARGET_CC) -v 2>&1 | grep ^Target | cut -f2 -d ' ') ; \
+ if echo $${EXT_TOOLCHAIN_TARGET} | grep -q 'eabi$$' ; then \
+ EXT_TOOLCHAIN_ABI="eabi" ; \
+ else \
+ EXT_TOOLCHAIN_ABI="oabi" ; \
+ fi ; \
+ if [ x$(BR2_ARM_OABI) == x"y" -a $${EXT_TOOLCHAIN_ABI} == "eabi" ] ; then \
+ echo "Incorrect ABI setting" ; \
+ exit 1 ; \
+ fi ; \
+ if [ x$(BR2_ARM_EABI) == x"y" -a $${EXT_TOOLCHAIN_ABI} == "oabi" ] ; then \
+ echo "Incorrect ABI setting" ; \
+ exit 1 ; \
+ fi ; \
+
+#
+# Check that the external toolchain supports C++
+#
+check_cplusplus = \
+ $(TARGET_CXX) -v > /dev/null 2>&1 ; \
+ if test $$? -ne 0 ; then \
+ echo "BR2_INSTALL_LIBSTDCPP is selected but C++ support not available in external toolchain" ; \
+ exit 1 ; \
+ fi ; \
+
+#
+# Check that the cross-compiler given in the configuration exists
+#
+check_cross_compiler_exists = \
+ $(TARGET_CC) -v > /dev/null 2>&1 ; \
+ if test $$? -ne 0 ; then \
+ echo "Cannot execute cross-compiler '$(TARGET_CC)'" ; \
+ exit 1 ; \
+ fi ; \
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 2/4] toolchain: rename external toolchain dir
2010-07-27 22:08 [Buildroot] [PATCH 0/4] Preparatory work on toolchains - v4 Yann E. MORIN
2010-07-27 22:08 ` [Buildroot] [PATCH 1/4] toolchain: move helper functions from external toolchain Yann E. MORIN
@ 2010-07-27 22:08 ` Yann E. MORIN
2010-07-27 22:08 ` [Buildroot] [PATCH 3/4] toolchain: move makefile includes Yann E. MORIN
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2010-07-27 22:08 UTC (permalink / raw)
To: buildroot
Rename the external toolchain directory.
When new backends are here, it will be easier to sort them out
if they are all prefixed the same way.
Signed-off-by: Yann E. MORIN <yann.morin.1998@anciens.enib.fr>
---
toolchain/Config.in | 4 ++--
.../Config.in | 0
.../Config.in.2 | 0
.../ext-tool.mk | 0
4 files changed, 2 insertions(+), 2 deletions(-)
rename toolchain/{external-toolchain => toolchain-external}/Config.in (100%)
rename toolchain/{external-toolchain => toolchain-external}/Config.in.2 (100%)
rename toolchain/{external-toolchain => toolchain-external}/ext-tool.mk (100%)
diff --git a/toolchain/Config.in b/toolchain/Config.in
index ee94143..52b9d8b 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -17,7 +17,7 @@ config BR2_TOOLCHAIN_EXTERNAL
endchoice
source "toolchain/Config.in.1"
-source "toolchain/external-toolchain/Config.in"
+source "toolchain/toolchain-external/Config.in"
# we want gdb config in the middle of both source and external
# toolchains, but mconf won't let us source the same file twice,
@@ -26,6 +26,6 @@ source "toolchain/gdb/Config.in"
comment "Common Toolchain Options"
source "toolchain/Config.in.2"
-source "toolchain/external-toolchain/Config.in.2"
+source "toolchain/toolchain-external/Config.in.2"
endmenu
diff --git a/toolchain/external-toolchain/Config.in b/toolchain/toolchain-external/Config.in
similarity index 100%
rename from toolchain/external-toolchain/Config.in
rename to toolchain/toolchain-external/Config.in
diff --git a/toolchain/external-toolchain/Config.in.2 b/toolchain/toolchain-external/Config.in.2
similarity index 100%
rename from toolchain/external-toolchain/Config.in.2
rename to toolchain/toolchain-external/Config.in.2
diff --git a/toolchain/external-toolchain/ext-tool.mk b/toolchain/toolchain-external/ext-tool.mk
similarity index 100%
rename from toolchain/external-toolchain/ext-tool.mk
rename to toolchain/toolchain-external/ext-tool.mk
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 3/4] toolchain: move makefile includes
2010-07-27 22:08 [Buildroot] [PATCH 0/4] Preparatory work on toolchains - v4 Yann E. MORIN
2010-07-27 22:08 ` [Buildroot] [PATCH 1/4] toolchain: move helper functions from external toolchain Yann E. MORIN
2010-07-27 22:08 ` [Buildroot] [PATCH 2/4] toolchain: rename external toolchain dir Yann E. MORIN
@ 2010-07-27 22:08 ` Yann E. MORIN
2010-07-27 22:08 ` [Buildroot] [PATCH 4/4] toolchain: move buildroot config files Yann E. MORIN
2010-07-28 15:20 ` [Buildroot] [PATCH 0/4] Preparatory work on toolchains - v4 Peter Korsgaard
4 siblings, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2010-07-27 22:08 UTC (permalink / raw)
To: buildroot
Including a bunch of Makefiles with wildcard makes it impossible to add
new toolchain backends. Avoid that by namely including needed files.
The external toolchain still needs to include all the toolchain/*/*.mk
sub-makefiles, as they are needed to build a toolchain that runs on the
target. It is to be noted that the cross-toolchain is not built in this
case, as the make-targets to build the cross-toolchain are not present
in the $(BASE_TARGETS) variable, which is later used to create the
dependency rules.
Also, the comment 'Explicit ordering' has been removed, as it is mis-
leading. It is make's responsibility to create the proper ordering based
on the dependency rules it finds in the Makefiles
Signed-off-by: Yann E. MORIN <yann.morin.1998@anciens.enib.fr>
---
Makefile | 16 ++--------------
toolchain/toolchain-buildroot.mk | 12 ++++++++++++
toolchain/toolchain-external.mk | 14 ++++++++++++++
3 files changed, 28 insertions(+), 14 deletions(-)
create mode 100644 toolchain/toolchain-buildroot.mk
create mode 100644 toolchain/toolchain-external.mk
diff --git a/Makefile b/Makefile
index b1d5079..619d8ea 100644
--- a/Makefile
+++ b/Makefile
@@ -294,21 +294,9 @@ all: world
# each selected package to TARGETS if that package was selected
# in the .config file.
ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
-# avoid pulling in external toolchain which is broken for toplvl parallel builds
-# Explicit ordering:
-include toolchain/dependencies/dependencies.mk
-include toolchain/binutils/binutils.mk
-include toolchain/ccache/ccache.mk
-include toolchain/elf2flt/elf2flt.mk
-include toolchain/gcc/gcc-uclibc-4.x.mk
-include toolchain/gdb/gdb.mk
-include toolchain/kernel-headers/kernel-headers.mk
-include toolchain/mklibs/mklibs.mk
-include toolchain/sstrip/sstrip.mk
-include toolchain/uClibc/uclibc.mk
+include toolchain/toolchain-buildroot.mk
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
-include toolchain/helpers.mk
-include toolchain/*/*.mk
+include toolchain/toolchain-external.mk
endif
include package/*/*.mk
diff --git a/toolchain/toolchain-buildroot.mk b/toolchain/toolchain-buildroot.mk
new file mode 100644
index 0000000..d879697
--- /dev/null
+++ b/toolchain/toolchain-buildroot.mk
@@ -0,0 +1,12 @@
+# Include files required for the internal toolchain backend
+
+include toolchain/dependencies/dependencies.mk
+include toolchain/binutils/binutils.mk
+include toolchain/ccache/ccache.mk
+include toolchain/elf2flt/elf2flt.mk
+include toolchain/gcc/gcc-uclibc-4.x.mk
+include toolchain/gdb/gdb.mk
+include toolchain/kernel-headers/kernel-headers.mk
+include toolchain/mklibs/mklibs.mk
+include toolchain/sstrip/sstrip.mk
+include toolchain/uClibc/uclibc.mk
diff --git a/toolchain/toolchain-external.mk b/toolchain/toolchain-external.mk
new file mode 100644
index 0000000..6f1f641
--- /dev/null
+++ b/toolchain/toolchain-external.mk
@@ -0,0 +1,14 @@
+# Required includes for the external toolchain backend
+
+include toolchain/helpers.mk
+include toolchain/binutils/binutils.mk
+include toolchain/ccache/ccache.mk
+include toolchain/dependencies/dependencies.mk
+include toolchain/elf2flt/elf2flt.mk
+include toolchain/gcc/gcc-uclibc-4.x.mk
+include toolchain/gdb/gdb.mk
+include toolchain/kernel-headers/kernel-headers.mk
+include toolchain/mklibs/mklibs.mk
+include toolchain/sstrip/sstrip.mk
+include toolchain/toolchain-external/ext-tool.mk
+include toolchain/uClibc/uclibc.mk
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 4/4] toolchain: move buildroot config files
2010-07-27 22:08 [Buildroot] [PATCH 0/4] Preparatory work on toolchains - v4 Yann E. MORIN
` (2 preceding siblings ...)
2010-07-27 22:08 ` [Buildroot] [PATCH 3/4] toolchain: move makefile includes Yann E. MORIN
@ 2010-07-27 22:08 ` Yann E. MORIN
2010-07-28 15:20 ` [Buildroot] [PATCH 0/4] Preparatory work on toolchains - v4 Peter Korsgaard
4 siblings, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2010-07-27 22:08 UTC (permalink / raw)
To: buildroot
Handle the internal toolchain backend mechanism the
same way we handle other backends.
Signed-off-by: Yann E. MORIN <yann.morin.1998@anciens.enib.fr>
---
toolchain/Config.in | 12 +----
.../{Config.in.1 => toolchain-buildroot/Config.in} | 2 +-
toolchain/toolchain-buildroot/Config.in.2 | 37 ++++++++++++++++
toolchain/{Config.in.2 => toolchain-common.in} | 46 ++++----------------
4 files changed, 50 insertions(+), 47 deletions(-)
rename toolchain/{Config.in.1 => toolchain-buildroot/Config.in} (82%)
create mode 100644 toolchain/toolchain-buildroot/Config.in.2
rename toolchain/{Config.in.2 => toolchain-common.in} (84%)
diff --git a/toolchain/Config.in b/toolchain/Config.in
index 52b9d8b..fc9a048 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -16,16 +16,10 @@ config BR2_TOOLCHAIN_EXTERNAL
endchoice
-source "toolchain/Config.in.1"
+source "toolchain/toolchain-buildroot/Config.in"
source "toolchain/toolchain-external/Config.in"
-
-# we want gdb config in the middle of both source and external
-# toolchains, but mconf won't let us source the same file twice,
-# so put it here instead
-source "toolchain/gdb/Config.in"
-comment "Common Toolchain Options"
-
-source "toolchain/Config.in.2"
+source "toolchain/toolchain-common.in"
+source "toolchain/toolchain-buildroot/Config.in.2"
source "toolchain/toolchain-external/Config.in.2"
endmenu
diff --git a/toolchain/Config.in.1 b/toolchain/toolchain-buildroot/Config.in
similarity index 82%
rename from toolchain/Config.in.1
rename to toolchain/toolchain-buildroot/Config.in
index 5c26858..a9dd192 100644
--- a/toolchain/Config.in.1
+++ b/toolchain/toolchain-buildroot/Config.in
@@ -1,4 +1,4 @@
-#
+# Config entries for internal toolchain backend
if BR2_TOOLCHAIN_BUILDROOT
source "toolchain/kernel-headers/Config.in"
diff --git a/toolchain/toolchain-buildroot/Config.in.2 b/toolchain/toolchain-buildroot/Config.in.2
new file mode 100644
index 0000000..512a608
--- /dev/null
+++ b/toolchain/toolchain-buildroot/Config.in.2
@@ -0,0 +1,37 @@
+# Buildroot backend specific options
+
+if BR2_TOOLCHAIN_BUILDROOT
+source "toolchain/elf2flt/Config.in"
+source "toolchain/mklibs/Config.in"
+source "toolchain/sstrip/Config.in"
+
+config BR2_ENABLE_MULTILIB
+ bool "Enable multilib support?"
+ help
+ Build libraries to support different ABIs.
+
+config BR2_VFP_FLOAT
+ bool "Use ARM Vector Floating Point unit"
+ depends on !BR2_SOFT_FLOAT
+ depends on BR2_arm || BR2_armeb
+ help
+ Setting this option will enable the "-mfpu=vfp" option.
+ If your ARM CPU has a Vector Floating Point Unit (VFP)
+ and the toolchain supports the option, then the
+ code can be optimized.
+
+ Most people will answer N.
+
+config BR2_CROSS_TOOLCHAIN_TARGET_UTILS
+ bool "Include target utils in cross toolchain"
+ default y
+ help
+ When using buildroot to build a deployable cross toolchain,
+ it is handy to include certain target apps with that toolchain
+ as a convenience.
+ Examples include ldd, gdbserver, and strace.
+
+ Answer Y if you want these apps (if built) copied into the
+ cross toolchain dir under <arch>-linux-uclibc/target_utils/.
+
+endif
diff --git a/toolchain/Config.in.2 b/toolchain/toolchain-common.in
similarity index 84%
rename from toolchain/Config.in.2
rename to toolchain/toolchain-common.in
index 35263ce..bea0c7c 100644
--- a/toolchain/Config.in.2
+++ b/toolchain/toolchain-common.in
@@ -1,4 +1,12 @@
-#
+# Generic toolchain options
+
+# we want gdb config in the middle of both source and external
+# toolchains, but mconf won't let us source the same file twice,
+# so put it here instead
+source "toolchain/gdb/Config.in"
+
+comment "Common Toolchain Options"
+
config BR2_LARGEFILE
bool "Enable large file (files > 2 GB) support?"
depends on !BR2_cris
@@ -162,39 +170,3 @@ config BR2_TARGET_OPTIMIZATION
help
Optimizations to use when building for the target host.
NOTE: gcc optimization level is defined in build options.
-
-if BR2_TOOLCHAIN_BUILDROOT
-source "toolchain/elf2flt/Config.in"
-source "toolchain/mklibs/Config.in"
-source "toolchain/sstrip/Config.in"
-
-config BR2_ENABLE_MULTILIB
- bool "Enable multilib support?"
- help
- Build libraries to support different ABIs.
-
-config BR2_VFP_FLOAT
- bool "Use ARM Vector Floating Point unit"
- depends on !BR2_SOFT_FLOAT
- depends on BR2_arm || BR2_armeb
- help
- Setting this option will enable the "-mfpu=vfp" option.
- If your ARM CPU has a Vector Floating Point Unit (VFP)
- and the toolchain supports the option, then the
- code can be optimized.
-
- Most people will answer N.
-
-config BR2_CROSS_TOOLCHAIN_TARGET_UTILS
- bool "Include target utils in cross toolchain"
- default y
- help
- When using buildroot to build a deployable cross toolchain,
- it is handy to include certain target apps with that toolchain
- as a convenience.
- Examples include ldd, gdbserver, and strace.
-
- Answer Y if you want these apps (if built) copied into the
- cross toolchain dir under <arch>-linux-uclibc/target_utils/.
-
-endif
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 0/4] Preparatory work on toolchains - v4
2010-07-27 22:08 [Buildroot] [PATCH 0/4] Preparatory work on toolchains - v4 Yann E. MORIN
` (3 preceding siblings ...)
2010-07-27 22:08 ` [Buildroot] [PATCH 4/4] toolchain: move buildroot config files Yann E. MORIN
@ 2010-07-28 15:20 ` Peter Korsgaard
4 siblings, 0 replies; 6+ messages in thread
From: Peter Korsgaard @ 2010-07-28 15:20 UTC (permalink / raw)
To: buildroot
>>>>> "Yann" == Yann E MORIN <yann.morin.1998@anciens.enib.fr> writes:
Yann> Hello All!
Yann> These are preparatory work on toolchain, laying ground to later add
Yann> crosstool-NG as a backend.
Committed, thanks!
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-07-28 15:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-27 22:08 [Buildroot] [PATCH 0/4] Preparatory work on toolchains - v4 Yann E. MORIN
2010-07-27 22:08 ` [Buildroot] [PATCH 1/4] toolchain: move helper functions from external toolchain Yann E. MORIN
2010-07-27 22:08 ` [Buildroot] [PATCH 2/4] toolchain: rename external toolchain dir Yann E. MORIN
2010-07-27 22:08 ` [Buildroot] [PATCH 3/4] toolchain: move makefile includes Yann E. MORIN
2010-07-27 22:08 ` [Buildroot] [PATCH 4/4] toolchain: move buildroot config files Yann E. MORIN
2010-07-28 15:20 ` [Buildroot] [PATCH 0/4] Preparatory work on toolchains - v4 Peter Korsgaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox