gluon-core, gluon-site: get version numbers from .config

Calling git describe directly breaks isolation between the build system
and packages. Replace this with proper .config variables, like we
already do for GLUON_RELEASE.

Also replace the PKG_VERSION hack with a static '1', as we do for other
packages - while having those version numbers in opkg was cute, it was
also entirely useless. Having a fixed PKG_VERSION allows us to remove
the PKG_BUILD_DIR override as well.
This commit is contained in:
Matthias Schiffer 2021-09-21 17:38:03 +02:00
parent 531937cf6f
commit a6187cce70
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C
2 changed files with 16 additions and 11 deletions

View File

@ -1,11 +1,9 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-core
PKG_VERSION:=1
GLUON_VERSION = $(shell git describe --always --dirty=+ 2>/dev/null || echo unknown)
PKG_VERSION:=$(if $(DUMP),x,$(GLUON_VERSION))
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
PKG_CONFIG_DEPENDS := CONFIG_GLUON_VERSION
include ../gluon.mk
include $(INCLUDE_DIR)/cmake.mk
@ -22,6 +20,11 @@ define Package/gluon-core/description
endef
define Package/gluon-core/config
config GLUON_VERSION
string "Gluon version number"
depends on PACKAGE_gluon-core
default ""
config GLUON_MINIFY
bool "Minify Gluon scripts"
default y
@ -36,7 +39,7 @@ define Package/gluon-core/install
$(Gluon/Build/Install)
$(INSTALL_DIR) $(1)/lib/gluon
echo '$(GLUON_VERSION)' > $(1)/lib/gluon/gluon-version
echo '$(call qstrip,$(CONFIG_GLUON_VERSION))' > $(1)/lib/gluon/gluon-version
endef
$(eval $(call BuildPackageGluon,gluon-core))

View File

@ -1,17 +1,14 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-site
PKG_VERSION:=1
GLUON_SITEDIR = $(call qstrip,$(CONFIG_GLUON_SITEDIR))
GLUON_SITE_VERSION = $(shell ( cd '$(GLUON_SITEDIR)' && git --git-dir=.git describe --always --dirty=+ ) 2>/dev/null || echo unknown)
PKG_VERSION:=$(if $(DUMP),x,$(GLUON_SITE_VERSION))
PKG_CONFIG_DEPENDS := CONFIG_GLUON_RELEASE CONFIG_GLUON_SITEDIR CONFIG_GLUON_MULTIDOMAIN
PKG_CONFIG_DEPENDS := CONFIG_GLUON_SITE_VERSION CONFIG_GLUON_RELEASE CONFIG_GLUON_SITEDIR CONFIG_GLUON_MULTIDOMAIN
PKG_FILE_DEPENDS := $(GLUON_SITEDIR)/site.conf $(GLUON_SITEDIR)/domains/ $(GLUON_SITEDIR)/i18n/
PKG_BUILD_DEPENDS := lua-jsonc/host gluon-web/host
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include ../gluon.mk
PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG)
@ -21,6 +18,11 @@ define Package/gluon-site
endef
define Package/gluon-site/config
config GLUON_SITE_VERSION
string "Gluon site version number"
depends on PACKAGE_gluon-site
default ""
config GLUON_RELEASE
string "Gluon release number"
depends on PACKAGE_gluon-site
@ -83,7 +85,7 @@ define Package/gluon-site/install
$(CP) $(PKG_BUILD_DIR)/domains $(1)/lib/gluon/
endif
echo '$(GLUON_SITE_VERSION)' > $(1)/lib/gluon/site-version
echo '$(call qstrip,$(CONFIG_GLUON_SITE_VERSION))' > $(1)/lib/gluon/site-version
echo '$(call qstrip,$(CONFIG_GLUON_RELEASE))' > $(1)/lib/gluon/release
$(GluonInstallI18N)