gen-glibc-locales.mk 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # Generates glibc locale data for target.
  2. inputfile = $(firstword $(subst ., ,$(1)))
  3. charmap = $(or $(word 2,$(subst ., ,$(1))),UTF-8)
  4. # Packages all the generated locale data into the final archive.
  5. #
  6. # We sort the file names to produce consistent output regardless of
  7. # the `find` outputs order.
  8. $(TARGET_DIR)/usr/lib/locale/locale-archive: $(LOCALES)
  9. $(Q)rm -f $(@)
  10. $(Q)find $(TARGET_DIR)/usr/lib/locale/ -maxdepth 1 -mindepth 1 -type d -print0 \
  11. | sort -z \
  12. | xargs -0 \
  13. $(HOST_DIR)/bin/localedef \
  14. --prefix=$(TARGET_DIR) \
  15. --$(ENDIAN)-endian \
  16. --add-to-archive
  17. # Generates locale data for each locale.
  18. #
  19. # The input data comes preferably from the toolchain, or if the toolchain
  20. # does not have them (Linaro toolchains), we use the ones available on the
  21. # host machine.
  22. #
  23. # Uses `localedef`, which is built by the `host-localedef` package.
  24. $(LOCALES): | $(TARGET_DIR)/usr/lib/locale/
  25. $(Q)echo "Generating locale $(@)"
  26. $(Q)I18NPATH=$(STAGING_DIR)/usr/share/i18n:/usr/share/i18n \
  27. $(HOST_DIR)/bin/localedef \
  28. --prefix=$(TARGET_DIR) \
  29. --$(ENDIAN)-endian \
  30. --no-archive \
  31. -i $(call inputfile,$(@)) \
  32. -f $(call charmap,$(@)) \
  33. $(@)
  34. .PHONY: $(LOCALES)
  35. $(TARGET_DIR)/usr/lib/locale/:
  36. $(Q)mkdir -p $(TARGET_DIR)/usr/lib/locale/