2016-07-07 09:47:56 +00:00
|
|
|
# Dependencies for LuaSrcDiet
|
2017-01-19 16:30:26 +00:00
|
|
|
PKG_BUILD_DEPENDS += luci-base/host
|
2016-07-07 09:47:56 +00:00
|
|
|
|
2014-07-05 00:48:09 +00:00
|
|
|
include $(INCLUDE_DIR)/package.mk
|
|
|
|
|
2018-01-19 00:38:56 +00:00
|
|
|
|
2014-07-05 00:48:09 +00:00
|
|
|
# Annoyingly, make's shell function replaces all newlines with spaces, so we have to do some escaping work. Yuck.
|
2018-01-19 00:38:56 +00:00
|
|
|
shell-escape = $(shell $(1) | sed -ne '1h; 1!H; $$ {g; s/@/@1/g; s/\n/@2/g; p}')
|
|
|
|
shell-unescape = $(subst @1,@,$(subst @2,$(newline),$(1)))
|
|
|
|
shell-verbatim = $(call shell-unescape,$(call shell-escape,$(1)))
|
|
|
|
|
|
|
|
|
2014-07-05 00:48:09 +00:00
|
|
|
define GluonCheckSite
|
2018-01-19 11:32:32 +00:00
|
|
|
[ -z "$$IPKG_INSTROOT" ] || "${TOPDIR}/staging_dir/hostpkg/bin/lua" "${TOPDIR}/../scripts/check_site.lua" <<'END__GLUON__CHECK__SITE'
|
|
|
|
$(call shell-verbatim,cat '$(1)')
|
2014-07-05 00:48:09 +00:00
|
|
|
END__GLUON__CHECK__SITE
|
|
|
|
endef
|
2015-03-18 17:14:21 +00:00
|
|
|
|
2017-02-08 21:19:24 +00:00
|
|
|
GLUON_SUPPORTED_LANGS := de fr
|
2017-02-08 21:14:30 +00:00
|
|
|
GLUON_LANG_de := German
|
|
|
|
GLUON_LANG_fr := French
|
2015-03-18 17:14:21 +00:00
|
|
|
|
2017-02-08 21:19:24 +00:00
|
|
|
GLUON_I18N_CONFIG := $(foreach lang,$(GLUON_SUPPORTED_LANGS),CONFIG_GLUON_WEB_LANG_$(lang))
|
|
|
|
GLUON_ENABLED_LANGS := en $(foreach lang,$(GLUON_SUPPORTED_LANGS),$(if $(CONFIG_GLUON_WEB_LANG_$(lang)),$(lang)))
|
2015-03-18 17:14:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
define GluonBuildI18N
|
|
|
|
mkdir -p $$(PKG_BUILD_DIR)/i18n
|
|
|
|
for lang in $$(GLUON_ENABLED_LANGS); do \
|
2015-03-19 18:07:27 +00:00
|
|
|
if [ -e $(2)/$$$$lang.po ]; then \
|
2015-03-18 17:14:21 +00:00
|
|
|
rm -f $$(PKG_BUILD_DIR)/i18n/$(1).$$$$lang.lmo; \
|
2015-05-21 23:09:19 +00:00
|
|
|
po2lmo $(2)/$$$$lang.po $$(PKG_BUILD_DIR)/i18n/$(1).$$$$lang.lmo; \
|
2015-03-18 17:14:21 +00:00
|
|
|
fi; \
|
|
|
|
done
|
|
|
|
endef
|
|
|
|
|
|
|
|
define GluonInstallI18N
|
2017-02-08 21:19:24 +00:00
|
|
|
$$(INSTALL_DIR) $(2)/lib/gluon/web/i18n
|
2015-03-18 17:14:21 +00:00
|
|
|
for lang in $$(GLUON_ENABLED_LANGS); do \
|
|
|
|
if [ -e $$(PKG_BUILD_DIR)/i18n/$(1).$$$$lang.lmo ]; then \
|
2017-02-08 21:19:24 +00:00
|
|
|
$$(INSTALL_DATA) $$(PKG_BUILD_DIR)/i18n/$(1).$$$$lang.lmo $(2)/lib/gluon/web/i18n/$(1).$$$$lang.lmo; \
|
2015-03-18 17:14:21 +00:00
|
|
|
fi; \
|
|
|
|
done
|
|
|
|
endef
|
2016-07-07 09:47:56 +00:00
|
|
|
|
|
|
|
define GluonSrcDiet
|
|
|
|
rm -rf $(2)
|
|
|
|
$(CP) $(1) $(2)
|
|
|
|
$(FIND) $(2) -type f | while read src; do \
|
2017-01-18 16:21:43 +00:00
|
|
|
if LuaSrcDiet --noopt-binequiv -o "$$$$src.o" "$$$$src"; then \
|
|
|
|
chmod $$$$(stat -c%a "$$$$src") "$$$$src.o"; \
|
|
|
|
mv "$$$$src.o" "$$$$src"; \
|
|
|
|
fi; \
|
2016-07-07 09:47:56 +00:00
|
|
|
done
|
|
|
|
endef
|