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