Message ID | 1453302547-24314-4-git-send-email-patrickdepinguin@gmail.com |
---|---|
State | Superseded |
Headers | show |
Dear Thomas De Schampheleire, On Wed, 20 Jan 2016 16:09:07 +0100, Thomas De Schampheleire wrote: > + ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \ > + if [ "$${ARCH_LIB_DIR}" != "lib" -a "$${ARCH_LIB_DIR}" != "$(SKELETON_LIB_SYMLINK)" ]; then \ Where is SKELETON_LIB_SYMLINK defined? Shouldn't this be TOOLCHAIN_LIB_SYMLINK ? Or better, can we indeed name the variable SKELETON_LIB_SYMLINK, have it under skeleton.mk, and replace this test by something that simply tests if ARCH_LIB_DIR exists or not. If it exists (i.e it's the lib/ directory, or one of the lib32/ or lib64/ symlinks), there is nothing to do, otherwise you need to create the symlinks. Best regards, Thomas
On Wed, Jan 20, 2016 at 4:24 PM, Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote: > Dear Thomas De Schampheleire, > > On Wed, 20 Jan 2016 16:09:07 +0100, Thomas De Schampheleire wrote: > >> + ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \ >> + if [ "$${ARCH_LIB_DIR}" != "lib" -a "$${ARCH_LIB_DIR}" != "$(SKELETON_LIB_SYMLINK)" ]; then \ > > Where is SKELETON_LIB_SYMLINK defined? Shouldn't this be > TOOLCHAIN_LIB_SYMLINK ? This is indeed an error. > > Or better, can we indeed name the variable SKELETON_LIB_SYMLINK, have > it under skeleton.mk, and replace this test by something that simply > tests if ARCH_LIB_DIR exists or not. If it exists (i.e it's the lib/ > directory, or one of the lib32/ or lib64/ symlinks), there is nothing > to do, otherwise you need to create the symlinks. Yes, that can be done, I will resubmit. Thanks for your feedback, Thomas
diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk index ddefd01..10f1edc 100644 --- a/toolchain/toolchain-external/toolchain-external.mk +++ b/toolchain/toolchain-external/toolchain-external.mk @@ -517,6 +517,27 @@ endef TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_MUSL_LD_LINK endif +# Create a symlink from (usr/)$(ARCH_LIB_DIR) to lib. +# Note: the skeleton package additionally creates lib32->lib or lib64->lib +# (as appropriate) +# +# $1: destination directory (TARGET_DIR / STAGING_DIR) +create_lib_symlinks = \ + $(Q)DESTDIR="$(strip $1)" ; \ + ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \ + if [ "$${ARCH_LIB_DIR}" != "lib" -a "$${ARCH_LIB_DIR}" != "$(SKELETON_LIB_SYMLINK)" ]; then \ + ln -snf lib "$${DESTDIR}/$${ARCH_LIB_DIR}" ; \ + ln -snf lib "$${DESTDIR}/usr/$${ARCH_LIB_DIR}" ; \ + fi + +define TOOLCHAIN_EXTERNAL_CREATE_STAGING_LIB_SYMLINK + $(call create_lib_symlinks,$(STAGING_DIR)) +endef + +define TOOLCHAIN_EXTERNAL_CREATE_TARGET_LIB_SYMLINK + $(call create_lib_symlinks,$(TARGET_DIR)) +endef + # Integration of the toolchain into Buildroot: find the main sysroot # and the variant-specific sysroot, then copy the needed libraries to # the $(TARGET_DIR) and copy the whole sysroot (libraries and headers) @@ -732,6 +753,7 @@ endef TOOLCHAIN_EXTERNAL_BUILD_CMDS = $(TOOLCHAIN_BUILD_WRAPPER) define TOOLCHAIN_EXTERNAL_INSTALL_STAGING_CMDS + $(TOOLCHAIN_EXTERNAL_CREATE_STAGING_LIB_SYMLINK) $(TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS) $(TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER) $(TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT) @@ -741,6 +763,7 @@ endef # and the target directory, we do everything within the # install-staging step, arbitrarily. define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_CMDS + $(TOOLCHAIN_EXTERNAL_CREATE_TARGET_LIB_SYMLINK) $(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS) $(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FDPIC) $(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FLAT)