X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=luci.mk;h=5a6e5fdd2c0857142fd7fe79329b972d919a05e6;hb=19dedbae609d4f8ac41808d8d9da42aab51d6d17;hp=6ece81c3d60b1f06d847e1219b6c63fe92584ab3;hpb=2e2dab3e56f89fc15e1b7604e4ae83fa6c6ab544;p=oweals%2Fluci.git diff --git a/luci.mk b/luci.mk index 6ece81c3d..5a6e5fdd2 100644 --- a/luci.mk +++ b/luci.mk @@ -12,6 +12,7 @@ LUCI_DEFAULTS:=$(notdir $(wildcard ${CURDIR}/root/etc/uci-defaults/*)) LUCI_PKGARCH?=$(if $(realpath src/Makefile),,all) # Language code titles +LUCI_LANG.bg=български (Bulgarian) LUCI_LANG.ca=Català (Catalan) LUCI_LANG.cs=Čeština (Czech) LUCI_LANG.de=Deutsch (German) @@ -20,10 +21,12 @@ LUCI_LANG.en=English LUCI_LANG.es=Español (Spanish) LUCI_LANG.fr=Français (French) LUCI_LANG.he=עִבְרִית (Hebrew) +LUCI_LANG.hi=हिंदी (Hindi) LUCI_LANG.hu=Magyar (Hungarian) LUCI_LANG.it=Italiano (Italian) LUCI_LANG.ja=日本語 (Japanese) LUCI_LANG.ko=한국어 (Korean) +LUCI_LANG.mr=Marāṭhī (Marathi) LUCI_LANG.ms=Bahasa Melayu (Malay) LUCI_LANG.no=Norsk (Norwegian) LUCI_LANG.pl=Polski (Polish) @@ -83,8 +86,8 @@ PKG_GITBRANCH?=$(if $(DUMP),x,$(strip $(shell \ PKG_RELEASE?=1 PKG_INSTALL:=$(if $(realpath src/Makefile),1) -PKG_BUILD_DEPENDS += lua/host luci-base/host $(LUCI_BUILD_DEPENDS) -PKG_CONFIG_DEPENDS += CONFIG_LUCI_SRCDIET +PKG_BUILD_DEPENDS += lua/host luci-base/host LUCI_CSSTIDY:csstidy/host LUCI_SRCDIET:luasrcdiet/host $(LUCI_BUILD_DEPENDS) +PKG_CONFIG_DEPENDS += CONFIG_LUCI_SRCDIET CONFIG_LUCI_JSMIN CONFIG_LUCI_CSSTIDY PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) @@ -113,6 +116,14 @@ ifeq ($(PKG_NAME),luci-base) bool "Minify Lua sources" default n + config LUCI_JSMIN + bool "Minify JavaScript sources" + default y + + config LUCI_CSSTIDY + bool "Minify CSS files" + default y + menu "Translations"$(foreach lang,$(LUCI_LANGUAGES), config LUCI_LANG_$(lang) @@ -153,7 +164,21 @@ LUCI_LIBRARYDIR = $(LUA_LIBRARYDIR)/luci define SrcDiet $(FIND) $(1) -type f -name '*.lua' | while read src; do \ - if luasrcdiet --noopt-binequiv -o "$$$$src.o" "$$$$src"; \ + if LUA_PATH="$(STAGING_DIR_HOSTPKG)/lib/lua/5.1/?.lua" luasrcdiet --noopt-binequiv -o "$$$$src.o" "$$$$src"; \ + then mv "$$$$src.o" "$$$$src"; fi; \ + done +endef + +define JsMin + $(FIND) $(1) -type f -name '*.js' | while read src; do \ + if jsmin < "$$$$src" > "$$$$src.o"; \ + then mv "$$$$src.o" "$$$$src"; fi; \ + done +endef + +define CssTidy + $(FIND) $(1) -type f -name '*.css' | while read src; do \ + if csstidy "$$$$src" --template=highest --remove_last_semicolon=true "$$$$src.o"; \ then mv "$$$$src.o" "$$$$src"; fi; \ done endef @@ -177,6 +202,8 @@ define Package/$(PKG_NAME)/install if [ -d $(PKG_BUILD_DIR)/htdocs ]; then \ $(INSTALL_DIR) $(1)$(HTDOCS); \ cp -pR $(PKG_BUILD_DIR)/htdocs/* $(1)$(HTDOCS)/; \ + $(if $(CONFIG_LUCI_JSMIN),$(call JsMin,$(1)$(HTDOCS)/),true); \ + $(if $(CONFIG_LUCI_CSSTIDY),$(call CssTidy,$(1)$(HTDOCS)/),true); \ else true; fi if [ -d $(PKG_BUILD_DIR)/root ]; then \ $(INSTALL_DIR) $(1)/; \ @@ -192,6 +219,7 @@ ifneq ($(LUCI_DEFAULTS),) define Package/$(PKG_NAME)/postinst [ -n "$${IPKG_INSTROOT}" ] || {$(foreach script,$(LUCI_DEFAULTS), (. /etc/uci-defaults/$(script)) && rm -f /etc/uci-defaults/$(script)) + rm -f /tmp/luci-indexcache exit 0 } endef