toolchain-external: Commonize /lib/<tuple> symlinks
PATCH v2 1/1 toolchain-external: Commonize /lib/<tuple> symlinks
From: Matthew Fornero <[email protected]>
Commonize the creation of symlinks from {/usr}/lib to {/usr}/lib/<tuple>.
These were originally defined on a per-toolchain basis for the Linaro toolchains, but there is currently no support for creating symlinks for custom toolchains that may have been based on Linaro (or older versions of the Linaro toolchain).
Add common code for all supported Linaro toolchains and add a new config option, BR2_TOOLCHAIN_EXTERNAL_PREFIX_SYMLINK to enable custom toolchains to enable the symbolic link creation.
---
v2: Cleanup as suggested by Arnout Vandecappelle
--- toolchain/toolchain-external/Config.in | 14 +++++++++++ toolchain/toolchain-external/toolchain-external.mk | 26 ++++++-------------- 2 files changed, 22 insertions(+), 18 deletions(-)
toolchain/toolchain-external/Config.in +14 -0
@@ -745,6 +745,13 @@ config BR2_TOOLCHAIN_EXTERNAL_PREFIX default BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX \ if BR2_TOOLCHAIN_EXTERNAL_CUSTOM +config BR2_TOOLCHAIN_EXTERNAL_NEEDS_PREFIX_SYMLINK + bool + default y if BR2_TOOLCHAIN_EXTERNAL_LINARO_ARM + default y if BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64 + default y if BR2_TOOLCHAIN_EXTERNAL_LINARO_ARMEB + default y if BR2_TOOLCHAIN_EXTERNAL_PREFIX_SYMLINK + config BR2_TOOLCHAIN_EXTERNAL_GLIBC bool select BR2_TOOLCHAIN_USES_GLIBC
@@ -1055,6 +1062,13 @@ config BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS here, separated by spaces. They will be copied to the target's /lib directory. +config BR2_TOOLCHAIN_EXTERNAL_PREFIX_SYMLINK + bool "Symlink /lib/<tuple>" + help + Select this option if your external toolchain needs a symlink + from the /lib directory to the /lib/<tuple> directory. This is + may be required if your toolchain is based on one from Linaro. + endif # BR2_TOOLCHAIN_EXTERNAL_CUSTOM config BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY
toolchain/toolchain-external/toolchain-external.mk +8 -18
@@ -244,23 +244,16 @@ ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y) TOOLCHAIN_EXTERNAL_DEPENDENCIES += netbsd-queue endif -# The Linaro ARMhf toolchain expects the libraries in -# {/usr,}/lib/arm-linux-gnueabihf, but Buildroot copies them to +# Some toolchains, such as Linaro, expect the libraries in +# {/usr,}/lib/<tuple>, but Buildroot copies them to # {/usr,}/lib, so we need to create a symbolic link. -define TOOLCHAIN_EXTERNAL_LINARO_ARMHF_SYMLINK - ln -snf . $(TARGET_DIR)/lib/arm-linux-gnueabihf - ln -snf . $(TARGET_DIR)/usr/lib/arm-linux-gnueabihf -endef - -define TOOLCHAIN_EXTERNAL_LINARO_ARMEBHF_SYMLINK - ln -snf . $(TARGET_DIR)/lib/armeb-linux-gnueabihf - ln -snf . $(TARGET_DIR)/usr/lib/armeb-linux-gnueabihf -endef - -define TOOLCHAIN_EXTERNAL_LINARO_AARCH64_SYMLINK - ln -snf . $(TARGET_DIR)/lib/aarch64-linux-gnu - ln -snf . $(TARGET_DIR)/usr/lib/aarch64-linux-gnu +ifeq ($(BR2_TOOLCHAIN_EXTERNAL_NEEDS_PREFIX_SYMLINK),y) +define TOOLCHAIN_EXTERNAL_PREFIX_SYMLINK + ln -snf . $(TARGET_DIR)/lib/$(TOOLCHAIN_EXTERNAL_PREFIX) + ln -snf . $(TARGET_DIR)/usr/lib/$(TOOLCHAIN_EXTERNAL_PREFIX) endef +TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_PREFIX_SYMLINK +endif # Special handling for Blackfin toolchain, because of the split in two # tarballs, and the organization of tarball contents. The tarballs
@@ -298,7 +291,6 @@ ifeq ($(HOSTARCH),x86) TOOLCHAIN_EXTERNAL_SITE = https://releases.linaro.org/14.09/components/toolchain/binaries TOOLCHAIN_EXTERNAL_SOURCE = gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux.tar.xz TOOLCHAIN_EXTERNAL_ACTUAL_SOURCE_TARBALL = gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_src.tar.bz2 -TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_LINARO_ARMHF_SYMLINK else TOOLCHAIN_EXTERNAL_SITE = https://releases.linaro.org/components/toolchain/binaries/5.2-2015.11-2/arm-linux-gnueabihf TOOLCHAIN_EXTERNAL_SOURCE = gcc-linaro-5.2-2015.11-2-x86_64_arm-linux-gnueabihf.tar.xz
@@ -308,7 +300,6 @@ ifeq ($(HOSTARCH),x86) TOOLCHAIN_EXTERNAL_SITE = https://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_ACTUAL_SOURCE_TARBALL = gcc-linaro-armeb-linux-gnueabihf-4.9-2014.09_src.tar.bz2 -TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_LINARO_ARMEBHF_SYMLINK else TOOLCHAIN_EXTERNAL_SITE = https://releases.linaro.org/components/toolchain/binaries/5.2-2015.11-2/armeb-linux-gnueabihf TOOLCHAIN_EXTERNAL_SOURCE = gcc-linaro-5.2-2015.11-2-x86_64_armeb-linux-gnueabihf.tar.xz
@@ -353,7 +344,6 @@ ifeq ($(HOSTARCH),x86) TOOLCHAIN_EXTERNAL_SITE = https://releases.linaro.org/14.09/components/toolchain/binaries TOOLCHAIN_EXTERNAL_SOURCE = gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux.tar.xz TOOLCHAIN_EXTERNAL_ACTUAL_SOURCE_TARBALL = gcc-linaro-aarch64-linux-gnu-4.9-2014.09_src.tar.bz2 -TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_LINARO_AARCH64_SYMLINK else TOOLCHAIN_EXTERNAL_SITE = https://releases.linaro.org/components/toolchain/binaries/5.2-2015.11-2/aarch64-linux-gnu TOOLCHAIN_EXTERNAL_SOURCE = gcc-linaro-5.2-2015.11-2-x86_64_aarch64-linux-gnu.tar.xz
Signature · 1 line
1.7.10.4
PATCH v2 1/1 toolchain-external: Commonize /lib/<tuple> symlinks
Hi Matthew,
toolchain/toolchain-external/Config.in config BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS · line 1070
Quoted 6 lines · Matthew Fornero
toolchain/toolchain-external/Config.in +6
-0+config BR2_TOOLCHAIN_EXTERNAL_PREFIX_SYMLINK + bool "Symlink /lib/<tuple>" + help + Select this option if your external toolchain needs a symlink + from the /lib directory to the /lib/<tuple> directory. This is + may be required if your toolchain is based on one from Linaro.
Redundant 'is'.
baruch
Signature · 3 lines
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -PATCH v2 1/1 toolchain-external: Commonize /lib/<tuple> symlinks
Quoted 1 line
From: Baruch Siach [mailto:baruch at tkos.co.il]
...
Quoted 11 lines · Matthew Fornero
toolchain/toolchain-external/Config.in config BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS · line 1070
Quoted 6 lines
toolchain/toolchain-external/Config.in +6
-0+config BR2_TOOLCHAIN_EXTERNAL_PREFIX_SYMLINK + bool "Symlink /lib/<tuple>" + help + Select this option if your external toolchain needs a symlink + from the /lib directory to the /lib/<tuple> directory. This is + may be required if your toolchain is based on one from Linaro.Redundant 'is'.
Thanks Baruch-- will fix in v3 and send tomorrow in case of additional comments
-Matt
PATCH v2 1/1 toolchain-external: Commonize /lib/<tuple> symlinks
In reply to Matthew ForneroHi Matthew,
It's a bit nitpicking, but I have one more change to request...
Quoted 27 lines · Matthew Fornero
From: Matthew Fornero <[email protected]>
Commonize the creation of symlinks from {/usr}/lib to {/usr}/lib/<tuple>.
These were originally defined on a per-toolchain basis for the Linaro toolchains, but there is currently no support for creating symlinks for custom toolchains that may have been based on Linaro (or older versions of the Linaro toolchain).
Add common code for all supported Linaro toolchains and add a new config option,
BR2_TOOLCHAIN_EXTERNAL_PREFIX_SYMLINKto enable custom toolchains to enable the symbolic link creation.Signed-off-by Matthew Fornero <[email protected]>---
v2: Cleanup as suggested by Arnout Vandecappelle--- toolchain/toolchain-external/Config.in | 14 +++++++++++ toolchain/toolchain-external/toolchain-external.mk | 26 ++++++-------------- 2 files changed, 22 insertions(+), 18 deletions(-)toolchain/toolchain-external/Config.in +0
-0
toolchain/toolchain-external/Config.in config BR2_TOOLCHAIN_EXTERNAL_PREFIX · line 753
Quoted 9 lines
toolchain/toolchain-external/Config.in +6
-0@@ -745,6 +745,13 @@ config BR2_TOOLCHAIN_EXTERNAL_PREFIX default BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX \ if BR2_TOOLCHAIN_EXTERNAL_CUSTOM +config BR2_TOOLCHAIN_EXTERNAL_NEEDS_PREFIX_SYMLINK + bool + default y if BR2_TOOLCHAIN_EXTERNAL_LINARO_ARM + default y if BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64 + default y if BR2_TOOLCHAIN_EXTERNAL_LINARO_ARMEB + default y if BR2_TOOLCHAIN_EXTERNAL_PREFIX_SYMLINK
The logic should be reverted here: it's the individual toolchains that "know"
that they need a symlink, it shouldn't be the NEEDS_PREFIX_SYMLINK that "knows" which toolchains need it. IOW, remove all the 'default y' here, and add "select BR2_TOOLCHAIN_EXTERNAL_NEEDS_PREFIX_SYMLINK" to each of the toolchains.
toolchain/toolchain-external/Config.in config BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS · line 1066
Quoted 10 lines
toolchain/toolchain-external/Config.in +3
-0+ config BR2_TOOLCHAIN_EXTERNAL_GLIBC bool select BR2_TOOLCHAIN_USES_GLIBC@@ -1055,6 +1062,13 @@ config BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS here, separated by spaces. They will be copied to the target's /lib directory. +config BR2_TOOLCHAIN_EXTERNAL_PREFIX_SYMLINK + bool "Symlink /lib/<tuple>"
So
select BR2_TOOLCHAIN_EXTERNAL_NEEDS_PREFIX_SYMLINK
here.
Regards,
Arnout
Quoted 69 lines
toolchain/toolchain-external/Config.in +5
-0+ help + Select this option if your external toolchain needs a symlink + from the /lib directory to the /lib/<tuple> directory. This is + may be required if your toolchain is based on one from Linaro. + endif # BR2_TOOLCHAIN_EXTERNAL_CUSTOM config BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPYtoolchain/toolchain-external/toolchain-external.mk +8
-18@@ -244,23 +244,16 @@ ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y) TOOLCHAIN_EXTERNAL_DEPENDENCIES += netbsd-queue endif -# The Linaro ARMhf toolchain expects the libraries in -# {/usr,}/lib/arm-linux-gnueabihf, but Buildroot copies them to +# Some toolchains, such as Linaro, expect the libraries in +# {/usr,}/lib/<tuple>, but Buildroot copies them to # {/usr,}/lib, so we need to create a symbolic link. -define TOOLCHAIN_EXTERNAL_LINARO_ARMHF_SYMLINK - ln -snf . $(TARGET_DIR)/lib/arm-linux-gnueabihf - ln -snf . $(TARGET_DIR)/usr/lib/arm-linux-gnueabihf -endef - -define TOOLCHAIN_EXTERNAL_LINARO_ARMEBHF_SYMLINK - ln -snf . $(TARGET_DIR)/lib/armeb-linux-gnueabihf - ln -snf . $(TARGET_DIR)/usr/lib/armeb-linux-gnueabihf -endef - -define TOOLCHAIN_EXTERNAL_LINARO_AARCH64_SYMLINK - ln -snf . $(TARGET_DIR)/lib/aarch64-linux-gnu - ln -snf . $(TARGET_DIR)/usr/lib/aarch64-linux-gnu +ifeq ($(BR2_TOOLCHAIN_EXTERNAL_NEEDS_PREFIX_SYMLINK),y) +define TOOLCHAIN_EXTERNAL_PREFIX_SYMLINK + ln -snf . $(TARGET_DIR)/lib/$(TOOLCHAIN_EXTERNAL_PREFIX) + ln -snf . $(TARGET_DIR)/usr/lib/$(TOOLCHAIN_EXTERNAL_PREFIX) endef +TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_PREFIX_SYMLINK +endif # Special handling for Blackfin toolchain, because of the split in two # tarballs, and the organization of tarball contents. The tarballs@@ -298,7 +291,6 @@ ifeq ($(HOSTARCH),x86) TOOLCHAIN_EXTERNAL_SITE = https://releases.linaro.org/14.09/components/toolchain/binaries TOOLCHAIN_EXTERNAL_SOURCE = gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux.tar.xz TOOLCHAIN_EXTERNAL_ACTUAL_SOURCE_TARBALL = gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_src.tar.bz2 -TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_LINARO_ARMHF_SYMLINK else TOOLCHAIN_EXTERNAL_SITE = https://releases.linaro.org/components/toolchain/binaries/5.2-2015.11-2/arm-linux-gnueabihf TOOLCHAIN_EXTERNAL_SOURCE = gcc-linaro-5.2-2015.11-2-x86_64_arm-linux-gnueabihf.tar.xz@@ -308,7 +300,6 @@ ifeq ($(HOSTARCH),x86) TOOLCHAIN_EXTERNAL_SITE = https://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_ACTUAL_SOURCE_TARBALL = gcc-linaro-armeb-linux-gnueabihf-4.9-2014.09_src.tar.bz2 -TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_LINARO_ARMEBHF_SYMLINK else TOOLCHAIN_EXTERNAL_SITE = https://releases.linaro.org/components/toolchain/binaries/5.2-2015.11-2/armeb-linux-gnueabihf TOOLCHAIN_EXTERNAL_SOURCE = gcc-linaro-5.2-2015.11-2-x86_64_armeb-linux-gnueabihf.tar.xz@@ -353,7 +344,6 @@ ifeq ($(HOSTARCH),x86) TOOLCHAIN_EXTERNAL_SITE = https://releases.linaro.org/14.09/components/toolchain/binaries TOOLCHAIN_EXTERNAL_SOURCE = gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux.tar.xz TOOLCHAIN_EXTERNAL_ACTUAL_SOURCE_TARBALL = gcc-linaro-aarch64-linux-gnu-4.9-2014.09_src.tar.bz2 -TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_LINARO_AARCH64_SYMLINK else TOOLCHAIN_EXTERNAL_SITE = https://releases.linaro.org/components/toolchain/binaries/5.2-2015.11-2/aarch64-linux-gnu TOOLCHAIN_EXTERNAL_SOURCE = gcc-linaro-5.2-2015.11-2-x86_64_aarch64-linux-gnu.tar.xz
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH v2 1/1 toolchain-external: Commonize /lib/<tuple> symlinks
Quoted 8 lines
From: Arnout Vandecappelle [mailto:arnout at mind.be]
Sent: Wednesday, March 30, 2016 1:39 PMHi Matthew,
It's a bit nitpicking, but I have one more change to request...
Quoted 1 line
Quoted 14 lines
toolchain/toolchain-external/Config.in config BR2_TOOLCHAIN_EXTERNAL_PREFIX · line 753
Quoted 6 lines
toolchain/toolchain-external/Config.in +6
-0+config BR2_TOOLCHAIN_EXTERNAL_NEEDS_PREFIX_SYMLINK + bool + default y if BR2_TOOLCHAIN_EXTERNAL_LINARO_ARM + default y if BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64 + default y if BR2_TOOLCHAIN_EXTERNAL_LINARO_ARMEB + default y if BR2_TOOLCHAIN_EXTERNAL_PREFIX_SYMLINKThe logic should be reverted here: it's the individual toolchains that
"know"
that they need a symlink, it shouldn't be theNEEDS_PREFIX_SYMLINKthat "knows"
which toolchains need it. IOW, remove all the 'default y' here, and add "selectBR2_TOOLCHAIN_EXTERNAL_NEEDS_PREFIX_SYMLINK" to each of the toolchains.
So update the Linaro toolchains to select this option-- makes sense. I think I did it this way originally to make merge conflicts with upstream less likely, but that no longer matters if this patch gets commited.
Quoted 10 lines
toolchain/toolchain-external/Config.in config
Quoted 6 lines
toolchain/toolchain-external/Config.in +1
-0+ config BR2_TOOLCHAIN_EXTERNAL_GLIBC bool select BR2_TOOLCHAIN_USES_GLIBC@@ -1055,6 +1062,13 @@ config
BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBSQuoted 3 lines
toolchain/toolchain-external/Config.in +0
-0here, separated by spaces. They will be copied to the target's /lib directory.
Quoted 7 lines
toolchain/toolchain-external/Config.in config BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS · line 1066
Quoted 2 lines
toolchain/toolchain-external/Config.in +2
-0+config BR2_TOOLCHAIN_EXTERNAL_PREFIX_SYMLINK + bool "Symlink /lib/<tuple>"So
selectBR2_TOOLCHAIN_EXTERNAL_NEEDS_PREFIX_SYMLINK
here.
Sounds good, I'll submit v3 later today.
-Matt