Makefile 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. include $(TOPDIR)/rules.mk
  2. PKG_NAME:=gluon-site
  3. GLUON_SITEDIR = $(call qstrip,$(CONFIG_GLUON_SITEDIR))
  4. GLUON_SITE_VERSION = $(shell ( cd '$(GLUON_SITEDIR)' && git --git-dir=.git describe --always --dirty=+ ) 2>/dev/null || echo unknown)
  5. PKG_VERSION:=$(if $(DUMP),x,$(GLUON_SITE_VERSION))
  6. PKG_CONFIG_DEPENDS := CONFIG_GLUON_RELEASE CONFIG_GLUON_SITEDIR
  7. PKG_FILE_DEPENDS := $(GLUON_SITEDIR)/site.conf $(GLUON_SITEDIR)/domains/ $(GLUON_SITEDIR)/i18n/
  8. PKG_BUILD_DEPENDS := lua-cjson/host
  9. PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
  10. include ../gluon.mk
  11. PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG)
  12. define Package/gluon-site
  13. SECTION:=gluon
  14. CATEGORY:=Gluon
  15. TITLE:=Site-specific files of Gluon
  16. endef
  17. define Package/gluon-site/config
  18. config GLUON_RELEASE
  19. string "Gluon release number"
  20. depends on PACKAGE_gluon-site
  21. default ""
  22. config GLUON_SITEDIR
  23. string "Gluon site configuration directory"
  24. depends on PACKAGE_gluon-site
  25. default ""
  26. endef
  27. define Build/Prepare
  28. mkdir -p $(PKG_BUILD_DIR)/domains
  29. endef
  30. define Build/Compile
  31. $(foreach conf,site $(patsubst $(GLUON_SITEDIR)/%.conf,%,$(wildcard $(GLUON_SITEDIR)/domains/*.conf)),
  32. GLUON_SITEDIR='$(GLUON_SITEDIR)' GLUON_SITE_CONFIG='$(conf).conf' lua -e 'print(require("cjson").encode(assert(dofile("../../scripts/site_config.lua"))))' > '$(PKG_BUILD_DIR)/$(conf).json'
  33. )
  34. $(call GluonBuildI18N,gluon-site,$(GLUON_SITEDIR)/i18n)
  35. endef
  36. define Package/gluon-site/install
  37. $(INSTALL_DIR) $(1)/lib/gluon
  38. $(INSTALL_DATA) $(PKG_BUILD_DIR)/site.json $(1)/lib/gluon/
  39. $(CP) $(PKG_BUILD_DIR)/domains $(1)/lib/gluon/
  40. echo '$(GLUON_SITE_VERSION)' > $(1)/lib/gluon/site-version
  41. echo '$(call qstrip,$(CONFIG_GLUON_RELEASE))' > $(1)/lib/gluon/release
  42. $(call GluonInstallI18N,gluon-site,$(1))
  43. endef
  44. $(eval $(call BuildPackage,gluon-site))