From e0650da41e17d9e9006b29e726a2b2e8b7410f66 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Fri, 9 Sep 2022 23:35:30 +0200 Subject: luci.mk: add basic support for ucode sources Add special handling for ucode/ package subdirs, analogeous to luasrc/. Signed-off-by: Jo-Philipp Wich --- luci.mk | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/luci.mk b/luci.mk index 9bb51698d9..fc920f8d3a 100644 --- a/luci.mk +++ b/luci.mk @@ -72,6 +72,7 @@ LUCI_LC_ALIAS.zh_Hant=zh-tw HTDOCS = /www LUA_LIBRARYDIR = /usr/lib/lua LUCI_LIBRARYDIR = $(LUA_LIBRARYDIR)/luci +UCODE_LIBRARYDIR = /usr/share/ucode/luci # 1: everything expect po subdir or only po subdir @@ -160,7 +161,7 @@ ifneq ($(LUCI_DESCRIPTION),) endif define Build/Prepare - for d in luasrc htdocs root src; do \ + for d in luasrc ucode htdocs root src; do \ if [ -d ./$$$$d ]; then \ mkdir -p $(PKG_BUILD_DIR)/$$$$d; \ $(CP) ./$$$$d/* $(PKG_BUILD_DIR)/$$$$d/; \ @@ -193,6 +194,11 @@ define Package/$(PKG_NAME)/install $(if $(CONFIG_LUCI_SRCDIET),$(call SrcDiet,$(1)$(LUCI_LIBRARYDIR)/),true) $(call SubstituteVersion,$(1)$(LUCI_LIBRARYDIR)/) endif + ifneq ($(wildcard ${CURDIR}/ucode),) + $(INSTALL_DIR) $(1)$(UCODE_LIBRARYDIR) + cp -pR $(PKG_BUILD_DIR)/ucode/* $(1)$(UCODE_LIBRARYDIR)/ + $(call SubstituteVersion,$(1)$(UCODE_LIBRARYDIR)/) + endif ifneq ($(wildcard ${CURDIR}/htdocs),) $(INSTALL_DIR) $(1)$(HTDOCS) cp -pR $(PKG_BUILD_DIR)/htdocs/* $(1)$(HTDOCS)/ @@ -265,6 +271,11 @@ define SubstituteVersion $(SED) 's/<%# *\([^ ]*\)PKG_VERSION *%>/\1$(if $(PKG_VERSION),$(PKG_VERSION),$(PKG_SRC_VERSION))/g' \ -e 's/"\(<%= *\(media\|resource\) *%>[^"]*\.\(js\|css\)\)"/"\1?v=$(if $(PKG_VERSION),$(PKG_VERSION),$(PKG_SRC_VERSION))"/g' \ "$$$$src"; \ + done; \ + $(FIND) $(1) -type f -name '*.ut' | while read src; do \ + $(SED) 's/{# *\([^ ]*\)PKG_VERSION *#}/\1$(if $(PKG_VERSION),$(PKG_VERSION),$(PKG_SRC_VERSION))/g' \ + -e 's/"\({{ *\(media\|resource\) *}}[^"]*\.\(js\|css\)\)"/"\1?v=$(if $(PKG_VERSION),$(PKG_VERSION),$(PKG_SRC_VERSION))"/g' \ + "$$$$src"; \ done endef -- cgit v1.2.3