luci.mk: add basic support for ucode sources

Add special handling for ucode/ package subdirs, analogeous to luasrc/.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2022-09-09 23:35:30 +02:00
parent 2e93fa669b
commit e0650da41e

13
luci.mk
View File

@ -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