Skip to contentSkip to conversation

Add TOOLCHAIN_EXTERNAL_STRIP_COMPONENTS

PATCH New Vicente Olivert Riera 2 participants 3 messages Jul 23, 2015 – Jul 24, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 Add TOOLCHAIN_EXTERNAL_STRIP_COMPONENTS

...for toolchains with non-standard tarballs.

Following the same logic as <PKG>_STRIP_COMPONENTS (commit 73b9a5e), we also allow the posibility to specify a --strip-components level for external toolchains by setting the TOOLCHAIN_EXTERNAL_STRIP_COMPONENTS variable.

---
 toolchain/toolchain-external/toolchain-external.mk | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
toolchain/toolchain-external/toolchain-external.mk +5 -1
index 5ce4d33..2254248 100644
@@ -408,6 +408,10 @@ TOOLCHAIN_EXTERNAL_ADD_TOOLCHAIN_DEPENDENCY = NO
 
 TOOLCHAIN_EXTERNAL_INSTALL_STAGING = YES
 
+ifeq ($(TOOLCHAIN_EXTERNAL_STRIP_COMPONENTS),)
+TOOLCHAIN_EXTERNAL_STRIP_COMPONENTS = 1
+endif
+
 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2012R2)$(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2013R1)$(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2014R1),y)
 # Special handling for Blackfin toolchain, because of the split in two
 # tarballs, and the organization of tarball contents. The tarballs
@@ -426,7 +430,7 @@ else ifneq ($(TOOLCHAIN_EXTERNAL_SOURCE),)
 define TOOLCHAIN_EXTERNAL_EXTRACT_CMDS
 	mkdir -p $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)
 	$(call suitable-extractor,$(TOOLCHAIN_EXTERNAL_SOURCE)) $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE) | \
-		$(TAR) --strip-components=1 --exclude='usr/lib/locale/*' -C $(TOOLCHAIN_EXTERNAL_INSTALL_DIR) $(TAR_OPTIONS) -
+		$(TAR) --strip-components=$(TOOLCHAIN_EXTERNAL_STRIP_COMPONENTS) --exclude='usr/lib/locale/*' -C $(TOOLCHAIN_EXTERNAL_INSTALL_DIR) $(TAR_OPTIONS) -
 	$(TOOLCHAIN_EXTERNAL_FIXUP_CMDS)
 endef
 endif
Signature · 1 line
2.3.6
#1 lore raw

PATCH v3 2/2 Add support for MIPS Codescape MTI GNU Linux toolchain

- Add support for MIPS Codescape MTI GNU Linux toolchain
- Add a hash value
- Add logic to 'toolchain/helpers.mk' to allow the SYSROOT_DIR and ARCH_SYSROOT_DIR sit side by side instead of nested.
- Add logic for creating the side-by-side symlink as a post install hook.

---
 toolchain/helpers.mk                               | 12 ++++-
 toolchain/toolchain-external/Config.in             | 51 ++++++++++++++++++++++
 .../toolchain-external/toolchain-external.hash     |  6 +++
 toolchain/toolchain-external/toolchain-external.mk | 17 ++++++++
 4 files changed, 85 insertions(+), 1 deletion(-)
toolchain/helpers.mk +11 -1
index 895f3f1..71d2ec9 100644
@@ -116,6 +116,13 @@ copy_toolchain_lib_root = \
 #    non-default architecture variant is used. Without this, the
 #    compiler fails to find libraries and headers.
 #
+#  * Note: this guesses that the ARCH_SYSROOT_DIR is nested into
+#    the SYSROOT_DIR, but that's not true for all toolchains (i.e.
+#    Codescape toolchains), so a post-install-staging hook will be
+#    needed to create the symlink when the sysroot dirs are not nested
+#    because there is not enough information here to determine whether
+#    the sysroot layout is nested or side-by-side.
+#
 # Some toolchains (i.e Linaro binary toolchains) store support
 # libraries (libstdc++, libgcc_s) outside of the sysroot, so we simply
 # copy all the libraries from the "support lib directory" into our
@@ -144,7 +151,10 @@ copy_toolchain_sysroot = \
 				$${ARCH_SYSROOT_DIR}/$$i/ $(STAGING_DIR)/$$i/ ; \
 		fi ; \
 	done ; \
-	if [ `readlink -f $${SYSROOT_DIR}` != `readlink -f $${ARCH_SYSROOT_DIR}` ] ; then \
+	SYSROOT_DIR_CANON=`readlink -f $${SYSROOT_DIR}` ; \
+	ARCH_SYSROOT_DIR_CANON=`readlink -f $${ARCH_SYSROOT_DIR}` ; \
+	if [ $${SYSROOT_DIR_CANON} != $${ARCH_SYSROOT_DIR_CANON} \
+		-a $${ARCH_SYSROOT_DIR_CANON:0:$${\#SYSROOT_DIR_CANON}} == $${SYSROOT_DIR_CANON} ] ; then \
 		if [ ! -d $${ARCH_SYSROOT_DIR}/usr/include ] ; then \
 			cp -a $${SYSROOT_DIR}/usr/include $(STAGING_DIR)/usr ; \
 		fi ; \
toolchain/toolchain-external/Config.in +51 -0

63 lines not on this page · raw message

toolchain/toolchain-external/toolchain-external.hash +6 -0
index 3980c62..2361f0e 100644
@@ -55,6 +55,12 @@ sha256 0cffac0caea0eb3c8bdddfa14be011ce366680f40aeddbefc7cf23cb6d4f1891  gcc-lin
 sha256 4bc9d86390f8fa67a693ba4768ba5b12faaf7dd37c706c05ccd9321e765226e4  gcc-linaro-armeb-linux-gnueabihf-4.9-2014.09_linux.tar.xz
 sha256 3954f496ab01de67241109e82abfaa9b7625fdab4f05e79e7902e9814a07b832  gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux.tar.xz
 
+# Codescape toolchains from Imagination Technologies
+# From: http://codescape-mips-sdk.imgtec.com/components/toolchain/2015.06-03/
+md5 80e98c7425e4c9f7df255f5098bf7a10  Codescape.GNU.Tools.Package.2015.06-03.for.MIPS.MTI.Linux.CentOS-5.x86.tar.gz
+# Locally calculated
+sha256 c44857522fa80b99e6918cfe8ffa70100b78a124e97b0749e86c2b71a101e2fd  Codescape.GNU.Tools.Package.2015.06-03.for.MIPS.MTI.Linux.CentOS-5.x86.tar.gz
+
 # Synopsys DesignWare ARC toolchains
 sha256 1fa4ea2c8616623205f1c7beca02ea31b019099528a7433e5b020b0876b93bf3  arc_gnu_2014.12_prebuilt_uclibc_le_arc700_linux_install.tar.gz
 sha256 1080f07fcae2bfc176a3ea8d30b9ed8eaecab70fb786639d6ec70cae8322df10  arc_gnu_2014.12_prebuilt_uclibc_be_arc700_linux_install.tar.gz
toolchain/toolchain-external/toolchain-external.mk +17 -0
index 2254248..f2c1bc0 100644
@@ -253,6 +253,18 @@ define TOOLCHAIN_EXTERNAL_LINARO_AARCH64_SYMLINK
 	ln -snf . $(TARGET_DIR)/usr/lib/aarch64-linux-gnu
 endef
 
+# The Codescape toolchain uses a sysroot layout that places them
+# side-by-side instead of nested like multilibs. A symlink is needed
+# much like for the nested sysroots which are handled in
+# copy_toolchain_sysroot but there is not enough information in there
+# to determine whether the sysroot layout was nested or side-by-side.
+# Add the symlink here for now.
+define TOOLCHAIN_EXTERNAL_CODESCAPE_MIPS_SYMLINK
+	$(Q)ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))"; \
+	ARCH_SUBDIR=`basename $${ARCH_SYSROOT_DIR}`; \
+	ln -snf . $(STAGING_DIR)/$${ARCH_SUBDIR}
+endef
+
 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM201305),y)
 TOOLCHAIN_EXTERNAL_SITE = http://sourcery.mentor.com/public/gnu_toolchain/arm-none-linux-gnueabi
 TOOLCHAIN_EXTERNAL_SOURCE = arm-2013.05-24-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
@@ -284,6 +296,11 @@ else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_LINARO_ARMEB),y)
 TOOLCHAIN_EXTERNAL_SITE = http://releases.linaro.org/14.09/components/toolchain/binaries
 TOOLCHAIN_EXTERNAL_SOURCE = gcc-linaro-armeb-linux-gnueabihf-4.9-2014.09_linux.tar.xz
 TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_LINARO_ARMEBHF_SYMLINK
+else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS201506),y)
+TOOLCHAIN_EXTERNAL_SITE = http://codescape-mips-sdk.imgtec.com/components/toolchain/2015.06-03
+TOOLCHAIN_EXTERNAL_SOURCE = Codescape.GNU.Tools.Package.2015.06-03.for.MIPS.MTI.Linux.CentOS-5.x86.tar.gz
+TOOLCHAIN_EXTERNAL_STRIP_COMPONENTS = 2
+TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_CODESCAPE_MIPS_SYMLINK
 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201405),y)
 TOOLCHAIN_EXTERNAL_SITE = http://sourcery.mentor.com/public/gnu_toolchain/mips-linux-gnu
 TOOLCHAIN_EXTERNAL_SOURCE = mips-2014.05-27-mips-linux-gnu-i686-pc-linux-gnu.tar.bz2
Signature · 1 line
2.3.6
#2 lore raw

PATCH v3 1/2 Add TOOLCHAIN_EXTERNAL_STRIP_COMPONENTS

In reply to Vicente Olivert Riera

Vicente, All,

On 2015-07-24 01:10 +0200, Vicente Olivert Riera spake thusly:

Quoted 3 lines

...for toolchains with non-standard tarballs.

Following the same logic as <PKG>_STRIP_COMPONENTS (commit 73b9a5e), we

Not only is it the same logic, but toolchain-external are treated like all other packages. The fact that _STRIP_COMPONENT did not work for external toolchains is because the _EXTRACT_CMDS are overriden and we're not using the "generic" one.

If we did not have the extract commands override, it would have already been handled.

Thus, adding TOOLCHAIN_EXTERNAL_STRIP_COMPONENTS is only re-instating the default behaviour.

Quoted 14 lines

also allow the posibility to specify a --strip-components level for external toolchains by setting the TOOLCHAIN_EXTERNAL_STRIP_COMPONENTS variable.

---
 toolchain/toolchain-external/toolchain-external.mk | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
toolchain/toolchain-external/toolchain-external.mk +0 -0
index 5ce4d33..2254248 100644

toolchain/toolchain-external/toolchain-external.mk TOOLCHAIN_EXTERNAL_ADD_TOOLCHAIN_DEPENDENCY = NO · line 413

Quoted 6 lines
toolchain/toolchain-external/toolchain-external.mk +3 -0
@@ -408,6 +408,10 @@ TOOLCHAIN_EXTERNAL_ADD_TOOLCHAIN_DEPENDENCY = NO
 
 TOOLCHAIN_EXTERNAL_INSTALL_STAGING = YES
 
+ifeq ($(TOOLCHAIN_EXTERNAL_STRIP_COMPONENTS),)
+TOOLCHAIN_EXTERNAL_STRIP_COMPONENTS = 1
+endif

This should not be needed, as toolchain-external is itself a standard package. This variable, if not already set, is automatically set to 1 in the generic infra.

toolchain/toolchain-external/toolchain-external.mk else ifneq ($(TOOLCHAIN_EXTERNAL_SOURCE),) · line 433

Quoted 9 lines
toolchain/toolchain-external/toolchain-external.mk +1 -1
 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2012R2)$(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2013R1)$(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2014R1),y)
 # Special handling for Blackfin toolchain, because of the split in two
 # tarballs, and the organization of tarball contents. The tarballs
@@ -426,7 +430,7 @@ else ifneq ($(TOOLCHAIN_EXTERNAL_SOURCE),)
 define TOOLCHAIN_EXTERNAL_EXTRACT_CMDS
 	mkdir -p $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)
 	$(call suitable-extractor,$(TOOLCHAIN_EXTERNAL_SOURCE)) $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE) | \
-		$(TAR) --strip-components=1 --exclude='usr/lib/locale/*' -C $(TOOLCHAIN_EXTERNAL_INSTALL_DIR) $(TAR_OPTIONS) -
+		$(TAR) --strip-components=$(TOOLCHAIN_EXTERNAL_STRIP_COMPONENTS) --exclude='usr/lib/locale/*' -C $(TOOLCHAIN_EXTERNAL_INSTALL_DIR) $(TAR_OPTIONS) -

So, we have our custom extract commands just to exclude the locale stuff? And I even reviewed that! ;-)

So, if we had a way to pass those exclude patterns to the generic infra, we would no longer need to override the extract command. Hmm... But only two packages (toolchain-external and gcc) need to exclude stuff, so maybe it is not worth the effort. Thomas?

Regards,
Yann E. MORIN.

Quoted 6 lines
toolchain/toolchain-external/toolchain-external.mk +0 -0
 	$(TOOLCHAIN_EXTERNAL_FIXUP_CMDS)
 endef
 endif
Signature · 1 line
2.3.6
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'