gluon/package/gluon-core/Makefile
lemoer 7347adb875 gluon-core: allow overriding gluon-version by .scmversion
Usually gluon calls "git describe" inside the gluon directory to determine
the gluon-version. While this is sufficient in most cases, it becomes
insufficient if you have a meta build system, which patches gluon before
building gluon.

It is actually insufficient, because if you patch gluon before building
it, the the output of "git describe" would then describe the patched
revision and not the base revision (before patching gluon).

After this commit, you can use .scmversion to avoid this problem. By
writing to .scmversion inside the gluon directory before calling make,
gluon will now use the contents of .scmversion instead of "git describe"
to define the gluon-version. So you can write to .scmversion to define
gluon-version before patching gluon in your meta build system.

To do this, you can do something like this in your meta build system:

    cd gluon
    make show-describe > .scmversion
    # apply your own patches to gluon
    git am < ...
    # make gluon
    make GLUON_TARGET=...

Instead of using the output of "make show-describe" as .scmversion, you
can also use any other useful version description. E.g. you may append
the number of additional patches on top of the base commit of gluon (or
so).

As a side note, inside gluon, you can obtain the version (as before) via:

    root@platzhalter-525400123457:/# cat /lib/gluon/gluon-version
    v2021.1-150-gb39ea759+

    root@platzhalter-525400123457:/# gluon-neighbour-info -r nodeinfo
    {
      ...
      "software": {
        "firmware": {
          "base": "gluon-v2021.1-150-gb39ea759+",
          ...
        }
      }
    }

    root@platzhalter-525400123457:/# opkg info gluon-core | grep ^Version:
    Version: v2021.1-150-gb39ea759+
2021-09-20 23:01:29 +02:00

43 lines
1.0 KiB
Makefile

include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-core
GLUON_VERSION = $(shell cat $(TOPDIR)/../.scmversion 2>/dev/null || git describe --always --dirty=+ 2>/dev/null || echo unknown)
PKG_VERSION:=$(if $(DUMP),x,$(GLUON_VERSION))
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include ../gluon.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/gluon-core
TITLE:=Base files of Gluon
DEPENDS:= \
+gluon-site +libgluonutil +libiwinfo-lua +lua-platform-info +lua-simple-uci +lua-hash +lua-jsonc \
+luabitop +luaposix +vxlan +odhcp6c +firewall +pretty-hostname
endef
define Package/gluon-core/description
Gluon community wifi mesh firmware framework: core
endef
define Package/gluon-core/config
config GLUON_MINIFY
bool "Minify Gluon scripts"
default y
endef
define Package/gluon-core/conffiles
/etc/config/gluon
/etc/config/gluon-core
endef
define Package/gluon-core/install
$(Gluon/Build/Install)
$(INSTALL_DIR) $(1)/lib/gluon
echo '$(GLUON_VERSION)' > $(1)/lib/gluon/gluon-version
endef
$(eval $(call BuildPackageGluon,gluon-core))