package.mk 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  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_I18N_PACKAGES := $(foreach lang,$(GLUON_SUPPORTED_LANGS),+LUCI_LANG_$(lang):luci-i18n-base-$(lang))
  11. GLUON_I18N_CONFIG := $(foreach lang,$(GLUON_SUPPORTED_LANGS),CONFIG_LUCI_LANG_$(lang))
  12. GLUON_ENABLED_LANGS := $(foreach lang,$(GLUON_SUPPORTED_LANGS),$(if $(CONFIG_LUCI_LANG_$(lang)),$(lang)))
  13. define GluonBuildI18N
  14. mkdir -p $$(PKG_BUILD_DIR)/i18n
  15. for lang in $$(GLUON_ENABLED_LANGS); do \
  16. if [ -e $(2)/$$$$lang.po ]; then \
  17. rm -f $$(PKG_BUILD_DIR)/i18n/$(1).$$$$lang.lmo; \
  18. po2lmo $(2)/$$$$lang.po $$(PKG_BUILD_DIR)/i18n/$(1).$$$$lang.lmo; \
  19. fi; \
  20. done
  21. endef
  22. define GluonInstallI18N
  23. $$(INSTALL_DIR) $(2)/usr/lib/lua/luci/i18n
  24. for lang in $$(GLUON_ENABLED_LANGS); do \
  25. if [ -e $$(PKG_BUILD_DIR)/i18n/$(1).$$$$lang.lmo ]; then \
  26. $$(INSTALL_DATA) $$(PKG_BUILD_DIR)/i18n/$(1).$$$$lang.lmo $(2)/usr/lib/lua/luci/i18n/$(1).$$$$lang.lmo; \
  27. fi; \
  28. done
  29. endef