Makefile 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. include $(TOPDIR)/rules.mk
  2. PKG_NAME:=ffho-site-generate
  3. PKG_VERSION:=2
  4. PKG_RELEASE:=$(GLUON_VERSION).$(GLUON_SITE_CODE)-$(GLUON_RELEASE).$(GLUON_CONFIG_VERSION)
  5. PFG_BUILD_DEPENDS := lua-cjson/host
  6. PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
  7. include $(TOPDIR)/../package/gluon.mk
  8. define Package/ffho-site-generate
  9. SECTION:=ffho
  10. CATEGORY:=Site-select
  11. TITLE:=Scripts for generating a new site.json
  12. DEPENDS:=+gluon-core +luci-lib-json
  13. MAINTAINER:=Freifunk Hochstift <kontakt@hochstift.freifunk.net>
  14. endef
  15. define Package/ffho-site-generate/description
  16. endef
  17. define Build/Prepare
  18. mkdir -p $(PKG_BUILD_DIR)/site-select
  19. endef
  20. define Build/Configure
  21. endef
  22. define Build/Compile
  23. GLUON_SITEDIR='$(call qstrip,$(CONFIG_GLUON_SITEDIR))' lua -e 'print(require("cjson").encode(assert(dofile("./scripts/sites.lua"))))' > $(PKG_BUILD_DIR)/site-select/sites.json
  24. GLUON_SITEDIR='$(call qstrip,$(CONFIG_GLUON_SITEDIR))' lua -e 'print(require("cjson").encode(assert(dofile("./scripts/template.lua"))))' > $(PKG_BUILD_DIR)/site-select/template.json
  25. if [ -e $(call qstrip,$(CONFIG_GLUON_SITEDIR))/extra/groups.conf ]; then GLUON_SITEDIR='$(call qstrip,$(CONFIG_GLUON_SITEDIR))' lua -e 'print(require("cjson").encode(assert(dofile("./scripts/groups.lua"))))' > $(PKG_BUILD_DIR)/site-select/groups.json; fi
  26. $(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/)
  27. endef
  28. define Package/ffho-site-generate/install
  29. $(CP) ./files/* $(1)/
  30. $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/
  31. $(INSTALL_DIR) $(1)/lib/gluon/site-select
  32. $(INSTALL_DATA) $(PKG_BUILD_DIR)/site-select/* $(1)/lib/gluon/site-select/
  33. endef
  34. $(eval $(call BuildPackage,ffho-site-generate))