toolchain.mk 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. else \
  29. for l in $(TOOLCHAIN_GLIBC_GCONV_LIBS); do \
  30. $(INSTALL) -m 0644 -D $(STAGING_DIR)/usr/lib/$${d}/gconv/$${l}.so \
  31. $(TARGET_DIR)/usr/lib/gconv/$${l}.so \
  32. || exit 1; \
  33. $(TARGET_READELF) -d $(STAGING_DIR)/usr/lib/$${d}/gconv/$${l}.so |\
  34. sort -u |\
  35. sed -e '/.*(NEEDED).*\[\(.*\.so\)\]$$/!d; s//\1/;' |\
  36. while read lib; do \
  37. $(INSTALL) -m 0644 -D $(STAGING_DIR)/usr/lib/$${d}/gconv/$${lib} \
  38. $(TARGET_DIR)/usr/lib/gconv/$${lib} \
  39. || exit 1; \
  40. done; \
  41. done; \
  42. ./support/scripts/expunge-gconv-modules "$(TOOLCHAIN_GLIBC_GCONV_LIBS)" \
  43. <$(STAGING_DIR)/usr/lib/$${d}/gconv/gconv-modules \
  44. >$(TARGET_DIR)/usr/lib/gconv/gconv-modules; \
  45. fi
  46. endef
  47. TOOLCHAIN_TARGET_FINALIZE_HOOKS += TOOLCHAIN_GLIBC_COPY_GCONV_LIBS
  48. endif