2014-05-13 18:09:28 +00:00
|
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
|
2015-03-19 19:14:40 +00:00
|
|
|
PKG_NAME:=gluon-site
|
2015-03-19 02:54:12 +00:00
|
|
|
|
2018-01-19 03:57:48 +00:00
|
|
|
GLUON_SITEDIR = $(call qstrip,$(CONFIG_GLUON_SITEDIR))
|
|
|
|
GLUON_SITE_VERSION = $(shell ( cd '$(GLUON_SITEDIR)' && git --git-dir=.git describe --always --dirty=+ ) 2>/dev/null || echo unknown)
|
2017-01-18 16:21:43 +00:00
|
|
|
PKG_VERSION:=$(if $(DUMP),x,$(GLUON_SITE_VERSION))
|
|
|
|
|
2018-01-25 23:13:37 +00:00
|
|
|
PKG_CONFIG_DEPENDS := CONFIG_GLUON_RELEASE CONFIG_GLUON_SITEDIR CONFIG_GLUON_MULTIDOMAIN
|
2018-01-19 03:57:48 +00:00
|
|
|
PKG_FILE_DEPENDS := $(GLUON_SITEDIR)/site.conf $(GLUON_SITEDIR)/domains/ $(GLUON_SITEDIR)/i18n/
|
2019-12-23 11:00:28 +00:00
|
|
|
PKG_BUILD_DEPENDS := lua-cjson/host gluon-web/host
|
2014-05-13 18:09:28 +00:00
|
|
|
|
|
|
|
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
|
|
|
|
2016-10-08 22:18:45 +00:00
|
|
|
include ../gluon.mk
|
2015-03-19 20:31:44 +00:00
|
|
|
|
|
|
|
PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG)
|
|
|
|
|
2015-03-19 19:14:40 +00:00
|
|
|
define Package/gluon-site
|
2015-03-19 20:31:44 +00:00
|
|
|
TITLE:=Site-specific files of Gluon
|
2014-05-13 18:09:28 +00:00
|
|
|
endef
|
|
|
|
|
2017-01-18 16:21:43 +00:00
|
|
|
define Package/gluon-site/config
|
|
|
|
config GLUON_RELEASE
|
|
|
|
string "Gluon release number"
|
|
|
|
depends on PACKAGE_gluon-site
|
|
|
|
default ""
|
|
|
|
|
|
|
|
config GLUON_SITEDIR
|
|
|
|
string "Gluon site configuration directory"
|
|
|
|
depends on PACKAGE_gluon-site
|
|
|
|
default ""
|
2018-01-25 23:13:37 +00:00
|
|
|
|
|
|
|
config GLUON_MULTIDOMAIN
|
2018-01-28 10:22:33 +00:00
|
|
|
bool "Gluon multi-domain support"
|
2018-01-25 23:13:37 +00:00
|
|
|
|
2017-01-18 16:21:43 +00:00
|
|
|
endef
|
|
|
|
|
2018-01-25 23:13:37 +00:00
|
|
|
define GenerateJSON
|
2019-06-14 17:20:15 +00:00
|
|
|
GLUON_SITEDIR='$$(GLUON_SITEDIR)' GLUON_SITE_CONFIG='$(1).conf' \
|
|
|
|
lua -e 'print(require("cjson").encode(assert(dofile("../../scripts/site_config.lua")(os.getenv("GLUON_SITE_CONFIG")))))' \
|
|
|
|
> '$$(PKG_BUILD_DIR)/$(1).json'
|
2014-05-13 18:09:28 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/Compile
|
2018-01-25 23:13:37 +00:00
|
|
|
$(call GenerateJSON,site)
|
|
|
|
|
|
|
|
ifdef CONFIG_GLUON_MULTIDOMAIN
|
2018-01-20 05:22:26 +00:00
|
|
|
rm -rf $(PKG_BUILD_DIR)/domains
|
2018-01-25 23:13:37 +00:00
|
|
|
mkdir -p $(PKG_BUILD_DIR)/domains
|
|
|
|
$(foreach domain,$(patsubst $(GLUON_SITEDIR)/domains/%.conf,%,$(wildcard $(GLUON_SITEDIR)/domains/*.conf)),
|
2018-01-20 05:22:26 +00:00
|
|
|
[ ! -e '$(PKG_BUILD_DIR)/domains/$(domain).json' ]
|
2018-01-25 23:13:37 +00:00
|
|
|
$(call GenerateJSON,domains/$(domain))
|
2019-03-22 19:15:25 +00:00
|
|
|
@lua ../../scripts/domain_aliases.lua '$(PKG_BUILD_DIR)/domains/$(domain).json' | while read alias; do \
|
2018-01-20 05:22:26 +00:00
|
|
|
[ "$$$${alias}" != '$(domain)' ] || continue; \
|
2019-03-22 19:15:25 +00:00
|
|
|
link="$(PKG_BUILD_DIR)/domains/$$$${alias}.json"; \
|
|
|
|
if ! ln -s '$(domain).json' "$$$$link"; then \
|
|
|
|
other="$$$$(basename $$$$(readlink -f "$$$$link") .json)"; \
|
|
|
|
if [ "$$$$other" ]; then \
|
|
|
|
echo >&2 "Failed to alias domain '"'$(domain)'"' as '$$$$alias', name already taken by domain '$$$$other'."; \
|
|
|
|
fi; \
|
|
|
|
exit 1; \
|
|
|
|
fi; \
|
2018-01-20 05:22:26 +00:00
|
|
|
done
|
2018-01-19 03:57:48 +00:00
|
|
|
)
|
2018-01-25 23:13:37 +00:00
|
|
|
endif
|
2018-01-19 03:57:48 +00:00
|
|
|
|
2018-03-08 18:49:41 +00:00
|
|
|
$(call GluonBuildI18N,$(GLUON_SITEDIR)/i18n)
|
2014-05-13 18:09:28 +00:00
|
|
|
endef
|
|
|
|
|
2015-03-19 19:14:40 +00:00
|
|
|
define Package/gluon-site/install
|
2014-05-13 18:09:28 +00:00
|
|
|
$(INSTALL_DIR) $(1)/lib/gluon
|
2018-01-25 23:13:37 +00:00
|
|
|
|
2016-09-24 00:05:01 +00:00
|
|
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/site.json $(1)/lib/gluon/
|
2018-01-25 23:13:37 +00:00
|
|
|
ifdef CONFIG_GLUON_MULTIDOMAIN
|
2018-01-19 03:57:48 +00:00
|
|
|
$(CP) $(PKG_BUILD_DIR)/domains $(1)/lib/gluon/
|
2018-01-25 23:13:37 +00:00
|
|
|
endif
|
|
|
|
|
2017-01-18 16:21:43 +00:00
|
|
|
echo '$(GLUON_SITE_VERSION)' > $(1)/lib/gluon/site-version
|
|
|
|
echo '$(call qstrip,$(CONFIG_GLUON_RELEASE))' > $(1)/lib/gluon/release
|
2015-03-19 20:31:44 +00:00
|
|
|
|
2018-03-08 18:49:41 +00:00
|
|
|
$(GluonInstallI18N)
|
2014-05-13 18:09:28 +00:00
|
|
|
endef
|
|
|
|
|
2018-04-13 22:01:04 +00:00
|
|
|
$(eval $(call BuildPackageGluon,gluon-site))
|