diff --git a/patches/packages/luci/0203-PR2637.patch b/patches/packages/luci/0203-PR2637.patch new file mode 100644 index 0000000000..88fe7f2f3d --- /dev/null +++ b/patches/packages/luci/0203-PR2637.patch @@ -0,0 +1,650 @@ +From 43c3db8b04a7fff5818c09cb97a4831622040cd1 Mon Sep 17 00:00:00 2001 +From: Sven Roederer +Date: Thu, 21 Mar 2019 22:17:58 +0100 +Subject: [PATCH 1/3] luci.mk: reorder to have common-things in a block + +Signed-off-by: Sven Roederer +--- + luci.mk | 130 +++++++++++++++++++++++++++++--------------------------- + 1 file changed, 68 insertions(+), 62 deletions(-) + +diff --git a/luci.mk b/luci.mk +index d8fa02951..429422d8f 100644 +--- a/luci.mk ++++ b/luci.mk +@@ -11,6 +11,12 @@ LUCI_LANGUAGES:=$(sort $(filter-out templates,$(notdir $(wildcard ${CURDIR}/po/* + LUCI_DEFAULTS:=$(notdir $(wildcard ${CURDIR}/root/etc/uci-defaults/*)) + LUCI_PKGARCH?=$(if $(realpath src/Makefile),,all) + ++ ++PKG_NAME?=$(LUCI_NAME) ++ ++PKG_BUILD_DEPENDS += $(LUCI_BUILD_DEPENDS) ++ ++#-------------- common parts ---------------- + # Language code titles + LUCI_LANG.bg=български (Bulgarian) + LUCI_LANG.ca=Català (Catalan) +@@ -49,9 +55,6 @@ LUCI_MENU.theme=4. Themes + LUCI_MENU.proto=5. Protocols + LUCI_MENU.lib=6. Libraries + +- +-PKG_NAME?=$(LUCI_NAME) +- + PKG_VERSION?=$(if $(DUMP),x,$(strip $(shell \ + if svn info >/dev/null 2>/dev/null; then \ + revision="svn-r$$(LC_ALL=C svn info | sed -ne 's/^Revision: //p')"; \ +@@ -85,52 +88,16 @@ 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_CSSTIDY:csstidy/host $(LUCI_BUILD_DEPENDS) ++PKG_BUILD_DEPENDS += lua/host luci-base/host LUCI_CSSTIDY:csstidy/host + PKG_CONFIG_DEPENDS += CONFIG_LUCI_SRCDIET CONFIG_LUCI_JSMIN CONFIG_LUCI_CSSTIDY + + PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) + + include $(INCLUDE_DIR)/package.mk + +-define Package/$(PKG_NAME) +- SECTION:=luci +- CATEGORY:=LuCI +- SUBMENU:=$(if $(LUCI_MENU.$(LUCI_TYPE)),$(LUCI_MENU.$(LUCI_TYPE)),$(LUCI_MENU.app)) +- TITLE:=$(if $(LUCI_TITLE),$(LUCI_TITLE),LuCI $(LUCI_NAME) $(LUCI_TYPE)) +- DEPENDS:=$(LUCI_DEPENDS) +- $(if $(LUCI_EXTRA_DEPENDS),EXTRA_DEPENDS:=$(LUCI_EXTRA_DEPENDS)) +- $(if $(LUCI_PKGARCH),PKGARCH:=$(LUCI_PKGARCH)) +-endef +- +-ifneq ($(LUCI_DESCRIPTION),) +- define Package/$(PKG_NAME)/description +- $(strip $(LUCI_DESCRIPTION)) +- endef +-endif +- +-# Language selection for luci-base +-ifeq ($(PKG_NAME),luci-base) +- define Package/luci-base/config +- config LUCI_SRCDIET +- 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) +- tristate "$(shell echo '$(LUCI_LANG.$(lang))' | sed -e 's/^.* (\(.*\))$$/\1/') ($(lang))") +- +- endmenu +- endef +-endif ++HTDOCS = /www ++LUA_LIBRARYDIR = /usr/lib/lua ++LUCI_LIBRARYDIR = $(LUA_LIBRARYDIR)/luci + + define Build/Prepare + for d in luasrc htdocs root src; do \ +@@ -142,25 +109,6 @@ define Build/Prepare + $(call Build/Prepare/Default) + endef + +-define Build/Configure +-endef +- +-ifneq ($(wildcard ${CURDIR}/src/Makefile),) +- MAKE_PATH := src/ +- MAKE_VARS += FPIC="$(FPIC)" LUCI_VERSION="$(PKG_VERSION)" LUCI_GITBRANCH="$(PKG_GITBRANCH)" +- +- define Build/Compile +- $(call Build/Compile/Default,clean compile) +- endef +-else +- define Build/Compile +- endef +-endif +- +-HTDOCS = /www +-LUA_LIBRARYDIR = /usr/lib/lua +-LUCI_LIBRARYDIR = $(LUA_LIBRARYDIR)/luci +- + 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"; \ +@@ -214,6 +162,64 @@ define Package/$(PKG_NAME)/install + else true; fi + endef + ++# End --- common parts ++ ++ ++define Package/$(PKG_NAME) ++ SECTION:=luci ++ CATEGORY:=LuCI ++ SUBMENU:=$(if $(LUCI_MENU.$(LUCI_TYPE)),$(LUCI_MENU.$(LUCI_TYPE)),$(LUCI_MENU.app)) ++ TITLE:=$(if $(LUCI_TITLE),$(LUCI_TITLE),LuCI $(LUCI_NAME) $(LUCI_TYPE)) ++ DEPENDS:=$(LUCI_DEPENDS) ++ $(if $(LUCI_EXTRA_DEPENDS),EXTRA_DEPENDS:=$(LUCI_EXTRA_DEPENDS)) ++ $(if $(LUCI_PKGARCH),PKGARCH:=$(LUCI_PKGARCH)) ++endef ++ ++ifneq ($(LUCI_DESCRIPTION),) ++ define Package/$(PKG_NAME)/description ++ $(strip $(LUCI_DESCRIPTION)) ++ endef ++endif ++ ++# Language selection for luci-base ++ifeq ($(PKG_NAME),luci-base) ++ define Package/luci-base/config ++ config LUCI_SRCDIET ++ 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) ++ tristate "$(shell echo '$(LUCI_LANG.$(lang))' | sed -e 's/^.* (\(.*\))$$/\1/') ($(lang))") ++ ++ endmenu ++ endef ++endif ++ ++define Build/Configure ++endef ++ ++ifneq ($(wildcard ${CURDIR}/src/Makefile),) ++ MAKE_PATH := src/ ++ MAKE_VARS += FPIC="$(FPIC)" LUCI_VERSION="$(PKG_VERSION)" LUCI_GITBRANCH="$(PKG_GITBRANCH)" ++ ++ define Build/Compile ++ $(call Build/Compile/Default,clean compile) ++ endef ++else ++ define Build/Compile ++ endef ++endif ++ + ifneq ($(LUCI_DEFAULTS),) + define Package/$(PKG_NAME)/postinst + [ -n "$${IPKG_INSTROOT}" ] || {$(foreach script,$(LUCI_DEFAULTS), +-- +2.20.1 + + +From d0e2a044c58cfc22335b267954d10cbc00c5e4a4 Mon Sep 17 00:00:00 2001 +From: Sven Roederer +Date: Sat, 23 Mar 2019 09:48:00 +0100 +Subject: [PATCH 2/3] luci.mk: split into luci-common.mk and luci.mk + +This splits common things which might relevant for other feeds out to +luci-common.mk. Any feed can include this new file and reuse our +definitions. + +Signed-off-by: Sven Roederer +--- + luci-common.mk | 150 +++++++++++++++++++++++++++++++++++++++++++++ + luci.mk | 163 +------------------------------------------------ + 2 files changed, 153 insertions(+), 160 deletions(-) + create mode 100644 luci-common.mk + +diff --git a/luci-common.mk b/luci-common.mk +new file mode 100644 +index 000000000..23e23cc6f +--- /dev/null ++++ b/luci-common.mk +@@ -0,0 +1,150 @@ ++# ++# Copyright (C) 2008-2015 The LuCI Team ++# ++# This is free software, licensed under the Apache License, Version 2.0 . ++# ++ ++# Language code titles ++LUCI_LANG.bg=български (Bulgarian) ++LUCI_LANG.ca=Català (Catalan) ++LUCI_LANG.cs=Čeština (Czech) ++LUCI_LANG.de=Deutsch (German) ++LUCI_LANG.el=Ελληνικά (Greek) ++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.ms=Bahasa Melayu (Malay) ++LUCI_LANG.no=Norsk (Norwegian) ++LUCI_LANG.pl=Polski (Polish) ++LUCI_LANG.pt-br=Português do Brasil (Brazialian Portuguese) ++LUCI_LANG.pt=Português (Portuguese) ++LUCI_LANG.ro=Română (Romanian) ++LUCI_LANG.ru=Русский (Russian) ++LUCI_LANG.sk=Slovenčina (Slovak) ++LUCI_LANG.sv=Svenska (Swedish) ++LUCI_LANG.tr=Türkçe (Turkish) ++LUCI_LANG.uk=Українська (Ukrainian) ++LUCI_LANG.vi=Tiếng Việt (Vietnamese) ++LUCI_LANG.zh-cn=中文 (Chinese) ++LUCI_LANG.zh-tw=臺灣華語 (Taiwanese) ++ ++# Submenu titles ++LUCI_MENU.col=1. Collections ++LUCI_MENU.mod=2. Modules ++LUCI_MENU.app=3. Applications ++LUCI_MENU.theme=4. Themes ++LUCI_MENU.proto=5. Protocols ++LUCI_MENU.lib=6. Libraries ++ ++PKG_VERSION?=$(if $(DUMP),x,$(strip $(shell \ ++ if svn info >/dev/null 2>/dev/null; then \ ++ revision="svn-r$$(LC_ALL=C svn info | sed -ne 's/^Revision: //p')"; \ ++ elif git log -1 >/dev/null 2>/dev/null; then \ ++ revision="svn-r$$(LC_ALL=C git log -1 | sed -ne 's/.*git-svn-id: .*@\([0-9]\+\) .*/\1/p')"; \ ++ if [ "$$revision" = "svn-r" ]; then \ ++ set -- $$(git log -1 --format="%ct %h" --abbrev=7); \ ++ secs="$$(($$1 % 86400))"; \ ++ yday="$$(date --utc --date="@$$1" "+%y.%j")"; \ ++ revision="$$(printf 'git-%s.%05d-%s' "$$yday" "$$secs" "$$2")"; \ ++ fi; \ ++ else \ ++ revision="unknown"; \ ++ fi; \ ++ echo "$$revision" \ ++))) ++ ++PKG_GITBRANCH?=$(if $(DUMP),x,$(strip $(shell \ ++ variant="LuCI"; \ ++ if git log -1 >/dev/null 2>/dev/null; then \ ++ branch="$$(git branch --remote --verbose --no-abbrev --contains 2>/dev/null | \ ++ sed -rne 's|^[^/]+/([^ ]+) [a-f0-9]{40} .+$$|\1|p' | head -n1)"; \ ++ if [ "$$branch" != "master" ]; then \ ++ variant="LuCI $$branch branch"; \ ++ else \ ++ variant="LuCI Master"; \ ++ fi; \ ++ fi; \ ++ echo "$$variant" \ ++))) ++ ++PKG_RELEASE?=1 ++PKG_INSTALL:=$(if $(realpath src/Makefile),1) ++PKG_BUILD_DEPENDS += lua/host luci-base/host LUCI_CSSTIDY:csstidy/host ++PKG_CONFIG_DEPENDS += CONFIG_LUCI_SRCDIET CONFIG_LUCI_JSMIN CONFIG_LUCI_CSSTIDY ++ ++PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) ++ ++include $(INCLUDE_DIR)/package.mk ++ ++HTDOCS = /www ++LUA_LIBRARYDIR = /usr/lib/lua ++LUCI_LIBRARYDIR = $(LUA_LIBRARYDIR)/luci ++ ++define Build/Prepare ++ for d in luasrc htdocs root src; do \ ++ if [ -d ./$$$$d ]; then \ ++ mkdir -p $(PKG_BUILD_DIR)/$$$$d; \ ++ $(CP) ./$$$$d/* $(PKG_BUILD_DIR)/$$$$d/; \ ++ fi; \ ++ done ++ $(call Build/Prepare/Default) ++endef ++ ++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 ++ ++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 ++ ++define SubstituteVersion ++ $(FIND) $(1) -type f -name '*.htm' | while read src; do \ ++ $(SED) 's/<%# *\([^ ]*\)PKG_VERSION *%>/\1$(PKG_VERSION)/g' \ ++ -e 's/"\(<%= *\(media\|resource\) *%>[^"]*\.\(js\|css\)\)"/"\1?v=$(PKG_VERSION)"/g' \ ++ "$$$$src"; \ ++ done ++endef ++ ++define Package/$(PKG_NAME)/install ++ if [ -d $(PKG_BUILD_DIR)/luasrc ]; then \ ++ $(INSTALL_DIR) $(1)$(LUCI_LIBRARYDIR); \ ++ cp -pR $(PKG_BUILD_DIR)/luasrc/* $(1)$(LUCI_LIBRARYDIR)/; \ ++ $(FIND) $(1)$(LUCI_LIBRARYDIR)/ -type f -name '*.luadoc' | $(XARGS) rm; \ ++ $(if $(CONFIG_LUCI_SRCDIET),$(call SrcDiet,$(1)$(LUCI_LIBRARYDIR)/),true); \ ++ $(call SubstituteVersion,$(1)$(LUCI_LIBRARYDIR)/); \ ++ else true; fi ++ 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)/; \ ++ cp -pR $(PKG_BUILD_DIR)/root/* $(1)/; \ ++ else true; fi ++ if [ -d $(PKG_BUILD_DIR)/src ]; then \ ++ $(call Build/Install/Default) \ ++ $(CP) $(PKG_INSTALL_DIR)/* $(1)/; \ ++ else true; fi ++endef +diff --git a/luci.mk b/luci.mk +index 429422d8f..e1016b3fe 100644 +--- a/luci.mk ++++ b/luci.mk +@@ -4,166 +4,9 @@ + # This is free software, licensed under the Apache License, Version 2.0 . + # + +-LUCI_NAME?=$(notdir ${CURDIR}) +-LUCI_TYPE?=$(word 2,$(subst -, ,$(LUCI_NAME))) +-LUCI_BASENAME?=$(patsubst luci-$(LUCI_TYPE)-%,%,$(LUCI_NAME)) +-LUCI_LANGUAGES:=$(sort $(filter-out templates,$(notdir $(wildcard ${CURDIR}/po/*)))) +-LUCI_DEFAULTS:=$(notdir $(wildcard ${CURDIR}/root/etc/uci-defaults/*)) +-LUCI_PKGARCH?=$(if $(realpath src/Makefile),,all) +- +- +-PKG_NAME?=$(LUCI_NAME) +- +-PKG_BUILD_DEPENDS += $(LUCI_BUILD_DEPENDS) +- +-#-------------- common parts ---------------- +-# Language code titles +-LUCI_LANG.bg=български (Bulgarian) +-LUCI_LANG.ca=Català (Catalan) +-LUCI_LANG.cs=Čeština (Czech) +-LUCI_LANG.de=Deutsch (German) +-LUCI_LANG.el=Ελληνικά (Greek) +-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.ms=Bahasa Melayu (Malay) +-LUCI_LANG.no=Norsk (Norwegian) +-LUCI_LANG.pl=Polski (Polish) +-LUCI_LANG.pt-br=Português do Brasil (Brazialian Portuguese) +-LUCI_LANG.pt=Português (Portuguese) +-LUCI_LANG.ro=Română (Romanian) +-LUCI_LANG.ru=Русский (Russian) +-LUCI_LANG.sk=Slovenčina (Slovak) +-LUCI_LANG.sv=Svenska (Swedish) +-LUCI_LANG.tr=Türkçe (Turkish) +-LUCI_LANG.uk=Українська (Ukrainian) +-LUCI_LANG.vi=Tiếng Việt (Vietnamese) +-LUCI_LANG.zh-cn=中文 (Chinese) +-LUCI_LANG.zh-tw=臺灣華語 (Taiwanese) +- +-# Submenu titles +-LUCI_MENU.col=1. Collections +-LUCI_MENU.mod=2. Modules +-LUCI_MENU.app=3. Applications +-LUCI_MENU.theme=4. Themes +-LUCI_MENU.proto=5. Protocols +-LUCI_MENU.lib=6. Libraries +- +-PKG_VERSION?=$(if $(DUMP),x,$(strip $(shell \ +- if svn info >/dev/null 2>/dev/null; then \ +- revision="svn-r$$(LC_ALL=C svn info | sed -ne 's/^Revision: //p')"; \ +- elif git log -1 >/dev/null 2>/dev/null; then \ +- revision="svn-r$$(LC_ALL=C git log -1 | sed -ne 's/.*git-svn-id: .*@\([0-9]\+\) .*/\1/p')"; \ +- if [ "$$revision" = "svn-r" ]; then \ +- set -- $$(git log -1 --format="%ct %h" --abbrev=7); \ +- secs="$$(($$1 % 86400))"; \ +- yday="$$(date --utc --date="@$$1" "+%y.%j")"; \ +- revision="$$(printf 'git-%s.%05d-%s' "$$yday" "$$secs" "$$2")"; \ +- fi; \ +- else \ +- revision="unknown"; \ +- fi; \ +- echo "$$revision" \ +-))) +- +-PKG_GITBRANCH?=$(if $(DUMP),x,$(strip $(shell \ +- variant="LuCI"; \ +- if git log -1 >/dev/null 2>/dev/null; then \ +- branch="$$(git branch --remote --verbose --no-abbrev --contains 2>/dev/null | \ +- sed -rne 's|^[^/]+/([^ ]+) [a-f0-9]{40} .+$$|\1|p' | head -n1)"; \ +- if [ "$$branch" != "master" ]; then \ +- variant="LuCI $$branch branch"; \ +- else \ +- variant="LuCI Master"; \ +- fi; \ +- fi; \ +- echo "$$variant" \ +-))) +- +-PKG_RELEASE?=1 +-PKG_INSTALL:=$(if $(realpath src/Makefile),1) +-PKG_BUILD_DEPENDS += lua/host luci-base/host LUCI_CSSTIDY:csstidy/host +-PKG_CONFIG_DEPENDS += CONFIG_LUCI_SRCDIET CONFIG_LUCI_JSMIN CONFIG_LUCI_CSSTIDY +- +-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) +- +-include $(INCLUDE_DIR)/package.mk +- +-HTDOCS = /www +-LUA_LIBRARYDIR = /usr/lib/lua +-LUCI_LIBRARYDIR = $(LUA_LIBRARYDIR)/luci +- +-define Build/Prepare +- for d in luasrc htdocs root src; do \ +- if [ -d ./$$$$d ]; then \ +- mkdir -p $(PKG_BUILD_DIR)/$$$$d; \ +- $(CP) ./$$$$d/* $(PKG_BUILD_DIR)/$$$$d/; \ +- fi; \ +- done +- $(call Build/Prepare/Default) +-endef +- +-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 +- +-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 +- +-define SubstituteVersion +- $(FIND) $(1) -type f -name '*.htm' | while read src; do \ +- $(SED) 's/<%# *\([^ ]*\)PKG_VERSION *%>/\1$(PKG_VERSION)/g' \ +- -e 's/"\(<%= *\(media\|resource\) *%>[^"]*\.\(js\|css\)\)"/"\1?v=$(PKG_VERSION)"/g' \ +- "$$$$src"; \ +- done +-endef +- +-define Package/$(PKG_NAME)/install +- if [ -d $(PKG_BUILD_DIR)/luasrc ]; then \ +- $(INSTALL_DIR) $(1)$(LUCI_LIBRARYDIR); \ +- cp -pR $(PKG_BUILD_DIR)/luasrc/* $(1)$(LUCI_LIBRARYDIR)/; \ +- $(FIND) $(1)$(LUCI_LIBRARYDIR)/ -type f -name '*.luadoc' | $(XARGS) rm; \ +- $(if $(CONFIG_LUCI_SRCDIET),$(call SrcDiet,$(1)$(LUCI_LIBRARYDIR)/),true); \ +- $(call SubstituteVersion,$(1)$(LUCI_LIBRARYDIR)/); \ +- else true; fi +- 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)/; \ +- cp -pR $(PKG_BUILD_DIR)/root/* $(1)/; \ +- else true; fi +- if [ -d $(PKG_BUILD_DIR)/src ]; then \ +- $(call Build/Install/Default) \ +- $(CP) $(PKG_INSTALL_DIR)/* $(1)/; \ +- else true; fi +-endef +- +-# End --- common parts +- ++# get the path of ourself, to find luci.mk in the same directory ++THIS_DIR=$(dir $(abspath $(lastword $(MAKEFILE_LIST)))) ++include $(THIS_DIR)/luci-common.mk + + define Package/$(PKG_NAME) + SECTION:=luci +-- +2.20.1 + + +From f9c11819baabf2b4f8dd88a0a9b22b75b5d36a31 Mon Sep 17 00:00:00 2001 +From: Sven Roederer +Date: Sat, 23 Mar 2019 10:29:30 +0100 +Subject: [PATCH 3/3] luci-common.mk: reorder some sections + +Have constant definitions at top, then helper-code and OpenWrt package related +sutff at the end. + +Signed-off-by: Sven Roederer +--- + luci-common.mk | 46 +++++++++++++++++++++++----------------------- + luci.mk | 12 ++++++++++++ + 2 files changed, 35 insertions(+), 23 deletions(-) + +diff --git a/luci-common.mk b/luci-common.mk +index 23e23cc6f..b11b81524 100644 +--- a/luci-common.mk ++++ b/luci-common.mk +@@ -42,6 +42,10 @@ LUCI_MENU.theme=4. Themes + LUCI_MENU.proto=5. Protocols + LUCI_MENU.lib=6. Libraries + ++HTDOCS = /www ++LUA_LIBRARYDIR = /usr/lib/lua ++LUCI_LIBRARYDIR = $(LUA_LIBRARYDIR)/luci ++ + PKG_VERSION?=$(if $(DUMP),x,$(strip $(shell \ + if svn info >/dev/null 2>/dev/null; then \ + revision="svn-r$$(LC_ALL=C svn info | sed -ne 's/^Revision: //p')"; \ +@@ -73,29 +77,6 @@ PKG_GITBRANCH?=$(if $(DUMP),x,$(strip $(shell \ + echo "$$variant" \ + ))) + +-PKG_RELEASE?=1 +-PKG_INSTALL:=$(if $(realpath src/Makefile),1) +-PKG_BUILD_DEPENDS += lua/host luci-base/host LUCI_CSSTIDY:csstidy/host +-PKG_CONFIG_DEPENDS += CONFIG_LUCI_SRCDIET CONFIG_LUCI_JSMIN CONFIG_LUCI_CSSTIDY +- +-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) +- +-include $(INCLUDE_DIR)/package.mk +- +-HTDOCS = /www +-LUA_LIBRARYDIR = /usr/lib/lua +-LUCI_LIBRARYDIR = $(LUA_LIBRARYDIR)/luci +- +-define Build/Prepare +- for d in luasrc htdocs root src; do \ +- if [ -d ./$$$$d ]; then \ +- mkdir -p $(PKG_BUILD_DIR)/$$$$d; \ +- $(CP) ./$$$$d/* $(PKG_BUILD_DIR)/$$$$d/; \ +- fi; \ +- done +- $(call Build/Prepare/Default) +-endef +- + 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"; \ +@@ -125,6 +106,25 @@ define SubstituteVersion + done + endef + ++PKG_RELEASE?=1 ++PKG_INSTALL:=$(if $(realpath src/Makefile),1) ++PKG_BUILD_DEPENDS += lua/host luci-base/host LUCI_CSSTIDY:csstidy/host ++PKG_CONFIG_DEPENDS += CONFIG_LUCI_SRCDIET CONFIG_LUCI_JSMIN CONFIG_LUCI_CSSTIDY ++ ++PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) ++ ++include $(INCLUDE_DIR)/package.mk ++ ++define Build/Prepare ++ for d in luasrc htdocs root src; do \ ++ if [ -d ./$$$$d ]; then \ ++ mkdir -p $(PKG_BUILD_DIR)/$$$$d; \ ++ $(CP) ./$$$$d/* $(PKG_BUILD_DIR)/$$$$d/; \ ++ fi; \ ++ done ++ $(call Build/Prepare/Default) ++endef ++ + define Package/$(PKG_NAME)/install + if [ -d $(PKG_BUILD_DIR)/luasrc ]; then \ + $(INSTALL_DIR) $(1)$(LUCI_LIBRARYDIR); \ +diff --git a/luci.mk b/luci.mk +index e1016b3fe..fa5bedd56 100644 +--- a/luci.mk ++++ b/luci.mk +@@ -4,6 +4,18 @@ + # This is free software, licensed under the Apache License, Version 2.0 . + # + ++LUCI_NAME?=$(notdir ${CURDIR}) ++LUCI_TYPE?=$(word 2,$(subst -, ,$(LUCI_NAME))) ++LUCI_BASENAME?=$(patsubst luci-$(LUCI_TYPE)-%,%,$(LUCI_NAME)) ++LUCI_LANGUAGES:=$(sort $(filter-out templates,$(notdir $(wildcard ${CURDIR}/po/*)))) ++LUCI_DEFAULTS:=$(notdir $(wildcard ${CURDIR}/root/etc/uci-defaults/*)) ++LUCI_PKGARCH?=$(if $(realpath src/Makefile),,all) ++ ++ ++PKG_NAME?=$(LUCI_NAME) ++ ++PKG_BUILD_DEPENDS += $(LUCI_BUILD_DEPENDS) ++ + # get the path of ourself, to find luci.mk in the same directory + THIS_DIR=$(dir $(abspath $(lastword $(MAKEFILE_LIST)))) + include $(THIS_DIR)/luci-common.mk +-- +2.20.1 +