Makefile 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. include $(TOPDIR)/rules.mk
  2. PKG_NAME:=ffho-site-generate
  3. PKG_VERSION:=2
  4. PFG_BUILD_DEPENDS := lua-cjson/host
  5. PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
  6. include $(TOPDIR)/../package/gluon.mk
  7. define Package/ffho-site-generate
  8. SECTION:=ffho
  9. CATEGORY:=Site-select
  10. TITLE:=Scripts for generating a new site.json
  11. DEPENDS:=+gluon-core
  12. MAINTAINER:=Freifunk Hochstift <kontakt@hochstift.freifunk.net>
  13. endef
  14. define Package/ffho-site-generate/description
  15. endef
  16. define Build/Prepare
  17. mkdir -p $(PKG_BUILD_DIR)/site-select
  18. endef
  19. define Build/Configure
  20. endef
  21. define Build/Compile
  22. 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
  23. 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
  24. 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
  25. $(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/)
  26. endef
  27. define Package/ffho-site-generate/install
  28. $(CP) ./files/* $(1)/
  29. $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/
  30. $(INSTALL_DIR) $(1)/lib/gluon/site-select
  31. $(INSTALL_DATA) $(PKG_BUILD_DIR)/site-select/* $(1)/lib/gluon/site-select/
  32. endef
  33. $(eval $(call BuildPackage,ffho-site-generate))