toolchain: handle toolchains with multiple ld*.so.* files
authorJonah Petri <jonah@petri.us>
Thu, 26 Aug 2021 19:34:24 +0000 (15:34 -0400)
committerArnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Sun, 29 Aug 2021 17:20:23 +0000 (19:20 +0200)
Some 3rd party vendor toolchains have multiple files which match
these glob patterns.  In this case, the shell script failed.
Switching to use find and xargs solves the issue.

Signed-off-by: Jonah Petri <jonah@petri.us>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
toolchain/helpers.mk

index dfb2581ed5edda39474a735f3c3ea9ef358ddd47..1dfb52ac38d8be0678a4777ab2dbe0fe70fdd1ab 100644 (file)
@@ -135,10 +135,8 @@ copy_toolchain_sysroot = \
                        $(call simplify_symlink,$$i,$(STAGING_DIR)) ; \
                done ; \
        fi ; \
-       if [ ! -e $(STAGING_DIR)/lib/ld*.so.* ]; then \
-               if [ -e $${ARCH_SYSROOT_DIR}/lib/ld*.so.* ]; then \
-                       cp -a $${ARCH_SYSROOT_DIR}/lib/ld*.so.* $(STAGING_DIR)/lib/ ; \
-               fi ; \
+       if [[ ! $$(find $(STAGING_DIR)/lib -name 'ld*.so.*' -print -quit) ]]; then \
+               find $${ARCH_SYSROOT_DIR}/lib -name 'ld*.so.*' -print0 | xargs -0 -I % cp % $(STAGING_DIR)/lib/; \
        fi ; \
        if [ `readlink -f $${SYSROOT_DIR}` != `readlink -f $${ARCH_SYSROOT_DIR}` ] ; then \
                if [ ! -d $${ARCH_SYSROOT_DIR}/usr/include ] ; then \