toolchain.mk 2.0 KB

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