toolchain: copy_toolchain_lib_root: copy symlinks instead of recreating them
copy_toolchain_lib_root handles symlinks by recreating them, disregarding the original destination and assuming the destination is in the same directory as the link itself. When a library link points to the real library file in another directory, for example: usr/lib/octeon2/libcrypt.so -> ../../../lib32/octeon2/libcrypt.so.1 then the link created by copy_toolchain_lib_root is broken. It is more robust to copy the symlink to keep the destination intact. The destination path should be present, possibly through other symbolic links. Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
This commit is contained in:
parent
9e4fb2019b
commit
38b51739da
@ -19,8 +19,7 @@ copy_toolchain_lib_root = \
|
|||||||
LIBNAME=`basename $${LIBPATH}`; \
|
LIBNAME=`basename $${LIBPATH}`; \
|
||||||
rm -fr $(TARGET_DIR)/$${DESTDIR}/$${LIBNAME}; \
|
rm -fr $(TARGET_DIR)/$${DESTDIR}/$${LIBNAME}; \
|
||||||
if test -h $${LIBPATH} ; then \
|
if test -h $${LIBPATH} ; then \
|
||||||
LINKTARGET=`readlink $${LIBPATH}` ; \
|
cp -d $${LIBPATH} $(TARGET_DIR)/$${DESTDIR}/$${LIBNAME}; \
|
||||||
ln -sf `basename $${LINKTARGET}` $(TARGET_DIR)/$${DESTDIR}/$${LIBNAME} ; \
|
|
||||||
LIBPATH="`readlink -f $${LIBPATH}`"; \
|
LIBPATH="`readlink -f $${LIBPATH}`"; \
|
||||||
elif test -f $${LIBPATH}; then \
|
elif test -f $${LIBPATH}; then \
|
||||||
$(INSTALL) -D -m0755 $${LIBPATH} $(TARGET_DIR)/$${DESTDIR}/$${LIBNAME}; \
|
$(INSTALL) -D -m0755 $${LIBPATH} $(TARGET_DIR)/$${DESTDIR}/$${LIBNAME}; \
|
||||||
|
Loading…
Reference in New Issue
Block a user