LUCI_PKGARCH?=$(if $(realpath src/Makefile),,all)
LUCI_SECTION?=luci
LUCI_CATEGORY?=LuCI
+LUCI_URL?=https://github.com/openwrt/luci
+LUCI_MAINTAINER?=OpenWrt LuCI community
+LUCI_MINIFY_LUA?=1
+LUCI_MINIFY_CSS?=1
+LUCI_MINIFY_JS?=1
# Language code titles
LUCI_LANG.ar=العربية (Arabic)
LUCI_LANG.bn_BD=বাংলা (Bengali)
LUCI_LANG.ca=Català (Catalan)
LUCI_LANG.cs=Čeština (Czech)
+LUCI_LANG.da=Dansk (Danish)
LUCI_LANG.de=Deutsch (German)
LUCI_LANG.el=Ελληνικά (Greek)
LUCI_LANG.en=English
include $(INCLUDE_DIR)/package.mk
+# LUCI_SUBMENU: the submenu-item below the LuCI top-level menu inside OpoenWrt menuconfig
+# usually one of the LUCI_MENU.* definitions
+# LUCI_SUBMENU_DEFAULT: the regular SUBMENU defined by LUCI_TYPE or derrived from the packagename
+# LUCI_SUBMENU_FORCED: manually forced value SUBMENU to set to by explicit definiton
+# can be any string, "none" disables the creation of a submenu
+# most usefull in combination with LUCI_CATEGORY, to make the package appear
+# anywhere in the menu structure
+LUCI_SUBMENU_DEFAULT=$(if $(LUCI_MENU.$(LUCI_TYPE)),$(LUCI_MENU.$(LUCI_TYPE)),$(LUCI_MENU.app))
+LUCI_SUBMENU=$(if $(LUCI_SUBMENU_FORCED),$(LUCI_SUBMENU_FORCED),$(LUCI_SUBMENU_DEFAULT))
+
define Package/$(PKG_NAME)
SECTION:=$(LUCI_SECTION)
CATEGORY:=$(LUCI_CATEGORY)
- SUBMENU:=$(if $(LUCI_MENU.$(LUCI_TYPE)),$(LUCI_MENU.$(LUCI_TYPE)),$(LUCI_MENU.app))
+ifneq ($(LUCI_SUBMENU),none)
+ SUBMENU:=$(LUCI_SUBMENU)
+endif
TITLE:=$(if $(LUCI_TITLE),$(LUCI_TITLE),LuCI $(LUCI_NAME) $(LUCI_TYPE))
DEPENDS:=$(LUCI_DEPENDS)
VERSION:=$(if $(PKG_VERSION),$(PKG_VERSION),$(PKG_SRC_VERSION))
$(if $(LUCI_EXTRA_DEPENDS),EXTRA_DEPENDS:=$(LUCI_EXTRA_DEPENDS))
$(if $(LUCI_PKGARCH),PKGARCH:=$(LUCI_PKGARCH))
+ $(if $(PKG_PROVIDES),PROVIDES:=$(PKG_PROVIDES))
+ URL:=$(LUCI_URL)
+ MAINTAINER:=$(LUCI_MAINTAINER)
endef
ifneq ($(LUCI_DESCRIPTION),)
ifndef Package/$(PKG_NAME)/postinst
define Package/$(PKG_NAME)/postinst
-[ -n "$${IPKG_INSTROOT}" ] || {$(foreach script,$(LUCI_DEFAULTS),
- (. /etc/uci-defaults/$(script)) && rm -f /etc/uci-defaults/$(script))
+[ -n "$${IPKG_INSTROOT}" ] || { \
rm -f /tmp/luci-indexcache
rm -rf /tmp/luci-modulecache/
killall -HUP rpcd 2>/dev/null
endif
# some generic macros that can be used by all packages
-define SrcDiet
+ifeq ($(LUCI_MINIFY_JS),1)
+ define SrcDiet
$(FIND) $(1) -type f -name '*.lua' | while read src; do \
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
+ endef
+else
+ define SrcDiet
+ $$(call MESSAGE,$$(LUCI_NAME) does not support Lua source minification)
+ endef
+endif
-define JsMin
+ifeq ($(LUCI_MINIFY_JS),1)
+ 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
+ endef
+else
+ define JsMin
+ $$(call MESSAGE,$$(LUCI_NAME) does not support JavaScript source minification)
+ endef
+endif
-define CssTidy
+ifeq ($(LUCI_MINIFY_CSS),1)
+ 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
+ endef
+else
+ define CssTidy
+ $$(call MESSAGE,$$(LUCI_NAME) does not support CSS source minification)
+ endef
+endif
define SubstituteVersion
$(FIND) $(1) -type f -name '*.htm' | while read src; do \