package.mk 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. include $(INCLUDE_DIR)/package.mk
  2. # Annoyingly, make's shell function replaces all newlines with spaces, so we have to do some escaping work. Yuck.
  3. define GluonCheckSite
  4. [ -z "$$GLUONDIR" ] || sed -e 's/-@/\n/g' -e 's/+@/@/g' <<'END__GLUON__CHECK__SITE' | "$$GLUONDIR"/scripts/check_site.sh
  5. $(shell cat $(1) | sed -ne '1h; 1!H; $$ {g; s/@/+@/g; s/\n/-@/g; p}')
  6. END__GLUON__CHECK__SITE
  7. endef
  8. # Languages supported by LuCi
  9. GLUON_SUPPORTED_LANGS := ca zh_cn en fr de el he hu it ja ms no pl pt_br pt ro ru es sv uk vi
  10. GLUON_LANG_ca := catalan
  11. GLUON_LANG_zh_cn := chinese
  12. GLUON_LANG_en := english
  13. GLUON_LANG_fr := french
  14. GLUON_LANG_de := german
  15. GLUON_LANG_el := greek
  16. GLUON_LANG_he := hebrew
  17. GLUON_LANG_hu := hungarian
  18. GLUON_LANG_it := italian
  19. GLUON_LANG_ja := japanese
  20. GLUON_LANG_ms := malay
  21. GLUON_LANG_no := norwegian
  22. GLUON_LANG_pl := polish
  23. GLUON_LANG_pt_br := portuguese-brazilian
  24. GLUON_LANG_pt := portuguese
  25. GLUON_LANG_ro := romanian
  26. GLUON_LANG_ru := russian
  27. GLUON_LANG_es := spanish
  28. GLUON_LANG_sv := swedish
  29. GLUON_LANG_uk := ukrainian
  30. GLUON_LANG_vi := vietnamese
  31. GLUON_I18N_PACKAGES := $(foreach lang,$(GLUON_SUPPORTED_LANGS),+GLUON_LANG_$(lang):luci-i18n-$(GLUON_LANG_$(lang)))
  32. GLUON_I18N_CONFIG := $(foreach lang,$(GLUON_SUPPORTED_LANGS),CONFIG_GLUON_LANG_$(lang))
  33. GLUON_ENABLED_LANGS := $(foreach lang,$(GLUON_SUPPORTED_LANGS),$(if $(CONFIG_GLUON_LANG_$(lang)),$(lang)))
  34. GLUON_PO2LMO := $(BUILD_DIR)/luci/build/po2lmo
  35. define GluonBuildI18N
  36. mkdir -p $$(PKG_BUILD_DIR)/i18n
  37. for lang in $$(GLUON_ENABLED_LANGS); do \
  38. if [ -e $(2)/$$$$lang.po ]; then \
  39. rm -f $$(PKG_BUILD_DIR)/i18n/$(1).$$$$lang.lmo; \
  40. $(GLUON_PO2LMO) $(2)/$$$$lang.po $$(PKG_BUILD_DIR)/i18n/$(1).$$$$lang.lmo; \
  41. fi; \
  42. done
  43. endef
  44. define GluonInstallI18N
  45. $$(INSTALL_DIR) $(2)/usr/lib/lua/luci/i18n
  46. for lang in $$(GLUON_ENABLED_LANGS); do \
  47. if [ -e $$(PKG_BUILD_DIR)/i18n/$(1).$$$$lang.lmo ]; then \
  48. $$(INSTALL_DATA) $$(PKG_BUILD_DIR)/i18n/$(1).$$$$lang.lmo $(2)/usr/lib/lua/luci/i18n/$(1).$$$$lang.lmo; \
  49. fi; \
  50. done
  51. endef