Makefile 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. URL:=https://git.c3pb.de/freifunk-pb/ffho-packages
  15. endef
  16. define Package/ffho-site-generate/description
  17. endef
  18. define Build/Prepare
  19. mkdir -p $(PKG_BUILD_DIR)/site-select
  20. endef
  21. define Build/Configure
  22. endef
  23. define Build/Compile
  24. 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
  25. 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
  26. 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
  27. $(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/)
  28. endef
  29. define Package/ffho-site-generate/install
  30. $(CP) ./files/* $(1)/
  31. $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/
  32. $(INSTALL_DIR) $(1)/lib/gluon/site-select
  33. $(INSTALL_DATA) $(PKG_BUILD_DIR)/site-select/* $(1)/lib/gluon/site-select/
  34. endef
  35. $(eval $(call BuildPackage,ffho-site-generate))