2018-01-19 12:10:44 +00:00
|
|
|
GLUON_MK := $(abspath $(lastword $(MAKEFILE_LIST)))
|
|
|
|
PKG_FILE_DEPENDS += $(GLUON_MK)
|
|
|
|
|
2019-11-23 14:19:39 +00:00
|
|
|
PKG_BUILD_DEPENDS += luasrcdiet/host
|
2016-07-07 09:47:56 +00:00
|
|
|
|
2020-05-12 22:45:06 +00:00
|
|
|
ifneq ($(wildcard ./luasrc/.),)
|
2021-07-11 20:38:20 +00:00
|
|
|
PKG_CONFIG_DEPENDS += CONFIG_GLUON_MINIFY
|
2020-05-12 22:45:06 +00:00
|
|
|
endif
|
|
|
|
|
2018-03-08 18:49:41 +00:00
|
|
|
ifneq ($(wildcard ./src/respondd.c),)
|
|
|
|
PKG_BUILD_DEPENDS += respondd
|
|
|
|
endif
|
|
|
|
|
2014-07-05 00:48:09 +00:00
|
|
|
include $(INCLUDE_DIR)/package.mk
|
|
|
|
|
2018-01-19 00:38:56 +00:00
|
|
|
|
2014-07-05 00:48:09 +00:00
|
|
|
# Annoyingly, make's shell function replaces all newlines with spaces, so we have to do some escaping work. Yuck.
|
2018-01-19 00:38:56 +00:00
|
|
|
shell-escape = $(shell $(1) | sed -ne '1h; 1!H; $$ {g; s/@/@1/g; s/\n/@2/g; p}')
|
|
|
|
shell-unescape = $(subst @1,@,$(subst @2,$(newline),$(1)))
|
|
|
|
shell-verbatim = $(call shell-unescape,$(call shell-escape,$(1)))
|
|
|
|
|
|
|
|
|
2014-07-05 00:48:09 +00:00
|
|
|
define GluonCheckSite
|
2018-01-19 11:32:32 +00:00
|
|
|
[ -z "$$IPKG_INSTROOT" ] || "${TOPDIR}/staging_dir/hostpkg/bin/lua" "${TOPDIR}/../scripts/check_site.lua" <<'END__GLUON__CHECK__SITE'
|
|
|
|
$(call shell-verbatim,cat '$(1)')
|
2014-07-05 00:48:09 +00:00
|
|
|
END__GLUON__CHECK__SITE
|
|
|
|
endef
|
2015-03-18 17:14:21 +00:00
|
|
|
|
2017-02-08 21:19:24 +00:00
|
|
|
GLUON_SUPPORTED_LANGS := de fr
|
2017-02-08 21:14:30 +00:00
|
|
|
GLUON_LANG_de := German
|
|
|
|
GLUON_LANG_fr := French
|
2015-03-18 17:14:21 +00:00
|
|
|
|
2017-02-08 21:19:24 +00:00
|
|
|
GLUON_I18N_CONFIG := $(foreach lang,$(GLUON_SUPPORTED_LANGS),CONFIG_GLUON_WEB_LANG_$(lang))
|
|
|
|
GLUON_ENABLED_LANGS := en $(foreach lang,$(GLUON_SUPPORTED_LANGS),$(if $(CONFIG_GLUON_WEB_LANG_$(lang)),$(lang)))
|
2015-03-18 17:14:21 +00:00
|
|
|
|
2018-03-08 18:49:41 +00:00
|
|
|
ifneq ($(wildcard ./i18n/.),)
|
2019-11-23 13:35:45 +00:00
|
|
|
PKG_BUILD_DEPENDS += gluon-web/host
|
2018-03-08 18:49:41 +00:00
|
|
|
PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG)
|
|
|
|
endif
|
|
|
|
|
2015-03-18 17:14:21 +00:00
|
|
|
|
|
|
|
define GluonBuildI18N
|
|
|
|
mkdir -p $$(PKG_BUILD_DIR)/i18n
|
|
|
|
for lang in $$(GLUON_ENABLED_LANGS); do \
|
2018-03-08 18:49:41 +00:00
|
|
|
if [ -e $(1)/$$$$lang.po ]; then \
|
|
|
|
rm -f $$(PKG_BUILD_DIR)/i18n/$$$$lang.lmo; \
|
2019-11-23 13:35:45 +00:00
|
|
|
gluon-po2lmo $(1)/$$$$lang.po $$(PKG_BUILD_DIR)/i18n/$$$$lang.lmo; \
|
2015-03-18 17:14:21 +00:00
|
|
|
fi; \
|
|
|
|
done
|
|
|
|
endef
|
|
|
|
|
|
|
|
define GluonInstallI18N
|
2018-03-08 18:49:41 +00:00
|
|
|
$$(INSTALL_DIR) $(1)/lib/gluon/web/i18n
|
2015-03-18 17:14:21 +00:00
|
|
|
for lang in $$(GLUON_ENABLED_LANGS); do \
|
2018-03-08 18:49:41 +00:00
|
|
|
if [ -e $$(PKG_BUILD_DIR)/i18n/$$$$lang.lmo ]; then \
|
|
|
|
$$(INSTALL_DATA) $$(PKG_BUILD_DIR)/i18n/$$$$lang.lmo $(1)/lib/gluon/web/i18n/$(PKG_NAME).$$$$lang.lmo; \
|
2015-03-18 17:14:21 +00:00
|
|
|
fi; \
|
|
|
|
done
|
|
|
|
endef
|
2016-07-07 09:47:56 +00:00
|
|
|
|
|
|
|
define GluonSrcDiet
|
|
|
|
rm -rf $(2)
|
|
|
|
$(CP) $(1) $(2)
|
2020-06-04 20:53:14 +00:00
|
|
|
ifdef CONFIG_GLUON_MINIFY
|
|
|
|
# Use cp + rm instead of mv to preserve destination permissions
|
|
|
|
set -e; $(FIND) $(2) -type f | while read src; do \
|
|
|
|
luasrcdiet --noopt-binequiv -o "$$$$src.tmp" "$$$$src"; \
|
|
|
|
cp "$$$$src.tmp" "$$$$src"; \
|
|
|
|
rm "$$$$src.tmp"; \
|
2016-07-07 09:47:56 +00:00
|
|
|
done
|
2020-06-04 20:53:14 +00:00
|
|
|
endif
|
2016-07-07 09:47:56 +00:00
|
|
|
endef
|
2018-03-08 18:49:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
define Gluon/Build/Compile
|
2018-03-09 09:05:44 +00:00
|
|
|
$(if $(wildcard ./src/Makefile ./src/CMakeLists.txt),
|
2018-03-08 18:49:41 +00:00
|
|
|
$(Build/Compile/Default)
|
|
|
|
)
|
|
|
|
$(if $(wildcard ./luasrc/.),
|
|
|
|
$(call GluonSrcDiet,luasrc,$(PKG_BUILD_DIR)/luadest/)
|
|
|
|
)
|
|
|
|
$(if $(wildcard ./i18n/.),
|
|
|
|
$(call GluonBuildI18N,i18n)
|
|
|
|
)
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Gluon/Build/Install
|
|
|
|
$(if $(findstring $(PKG_INSTALL),1),
|
|
|
|
$(CP) $(PKG_INSTALL_DIR)/. $(1)/
|
|
|
|
)
|
|
|
|
$(if $(wildcard ./files/.),
|
|
|
|
$(CP) ./files/. $(1)/
|
|
|
|
)
|
|
|
|
$(if $(wildcard ./luasrc/.),
|
|
|
|
$(CP) $(PKG_BUILD_DIR)/luadest/. $(1)/
|
|
|
|
)
|
|
|
|
$(if $(wildcard ./src/respondd.c),
|
2018-03-08 20:46:05 +00:00
|
|
|
$(INSTALL_DIR) $(1)/usr/lib/respondd
|
|
|
|
$(CP) $(PKG_BUILD_DIR)/respondd.so $(1)/usr/lib/respondd/$(PKG_NAME).so
|
2018-03-08 18:49:41 +00:00
|
|
|
)
|
|
|
|
$(if $(wildcard ./i18n/.),
|
|
|
|
$(GluonInstallI18N)
|
|
|
|
)
|
|
|
|
endef
|
|
|
|
|
|
|
|
Build/Compile=$(call Gluon/Build/Compile)
|
|
|
|
|
|
|
|
define BuildPackageGluon
|
2018-04-13 22:01:04 +00:00
|
|
|
define Package/$(1) :=
|
|
|
|
SECTION:=gluon
|
|
|
|
CATEGORY:=Gluon
|
|
|
|
$$(Package/$(1))
|
|
|
|
endef
|
|
|
|
|
2018-03-08 18:49:41 +00:00
|
|
|
Package/$(1)/install ?= $$(Gluon/Build/Install)
|
|
|
|
|
|
|
|
ifneq ($(wildcard check_site.lua),)
|
|
|
|
define Package/$(1)/postinst
|
|
|
|
#!/bin/sh
|
|
|
|
$$(call GluonCheckSite,check_site.lua)
|
|
|
|
endef
|
|
|
|
endif
|
|
|
|
|
|
|
|
$$(eval $$(call BuildPackage,$(1)))
|
|
|
|
endef
|