toolchain.mk 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. ################################################################################
  2. #
  3. # toolchain-related customisation of the content of the target/ directory
  4. #
  5. ################################################################################
  6. # Those customisations are added to the TARGET_FINALIZE_HOOKS, to be applied
  7. # just after all packages have been built.
  8. # Install the gconv modules
  9. ifeq ($(BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_COPY),y)
  10. TOOLCHAIN_GLIBC_GCONV_LIBS = $(call qstrip,$(BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_LIST))
  11. define TOOLCHAIN_GLIBC_COPY_GCONV_LIBS
  12. $(Q)found_gconv=no; \
  13. for d in $(TOOLCHAIN_EXTERNAL_PREFIX) ''; do \
  14. [ -d "$(STAGING_DIR)/usr/lib/$${d}/gconv" ] || continue; \
  15. found_gconv=yes; \
  16. break; \
  17. done; \
  18. if [ "$${found_gconv}" = "no" ]; then \
  19. printf "Unable to find gconv modules\n" >&2; \
  20. exit 1; \
  21. fi; \
  22. if [ -z "$(TOOLCHAIN_GLIBC_GCONV_LIBS)" ]; then \
  23. $(INSTALL) -m 0644 -D $(STAGING_DIR)/usr/lib/$${d}/gconv/gconv-modules \
  24. $(TARGET_DIR)/usr/lib/gconv/gconv-modules && \
  25. $(INSTALL) -m 0644 $(STAGING_DIR)/usr/lib/$${d}/gconv/*.so \
  26. $(TARGET_DIR)/usr/lib/gconv \
  27. || exit 1; \
  28. if [ -d $(STAGING_DIR)/usr/lib/$${d}/gconv/gconv-modules.d ]; then \
  29. cp -a $(STAGING_DIR)/usr/lib/$${d}/gconv/gconv-modules.d \
  30. $(TARGET_DIR)/usr/lib/gconv/ || exit 1; \
  31. fi; \
  32. else \
  33. for l in $(TOOLCHAIN_GLIBC_GCONV_LIBS); do \
  34. $(INSTALL) -m 0644 -D $(STAGING_DIR)/usr/lib/$${d}/gconv/$${l}.so \
  35. $(TARGET_DIR)/usr/lib/gconv/$${l}.so \
  36. || exit 1; \
  37. $(TARGET_READELF) -d $(STAGING_DIR)/usr/lib/$${d}/gconv/$${l}.so |\
  38. sort -u |\
  39. sed -e '/.*(NEEDED).*\[\(.*\.so\)\]$$/!d; s//\1/;' |\
  40. while read lib; do \
  41. $(INSTALL) -m 0644 -D $(STAGING_DIR)/usr/lib/$${d}/gconv/$${lib} \
  42. $(TARGET_DIR)/usr/lib/gconv/$${lib} \
  43. || exit 1; \
  44. done; \
  45. done; \
  46. ./support/scripts/expunge-gconv-modules \
  47. $(STAGING_DIR)/usr/lib/$${d}/gconv \
  48. "$(TOOLCHAIN_GLIBC_GCONV_LIBS)" \
  49. >$(TARGET_DIR)/usr/lib/gconv/gconv-modules; \
  50. fi
  51. endef
  52. TOOLCHAIN_TARGET_FINALIZE_HOOKS += TOOLCHAIN_GLIBC_COPY_GCONV_LIBS
  53. endif