build: pass GLUON_VERSION and GLUON_SITE_VERSION to build

A helper script is introduced to get the version from `git describe`.
This commit is contained in:
Matthias Schiffer 2021-09-21 17:55:44 +02:00
parent a6187cce70
commit b5db6435e5
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C
3 changed files with 18 additions and 0 deletions

View File

@ -52,6 +52,9 @@ $(eval $(call mkabspath,GLUON_PACKAGEDIR))
$(eval $(call mkabspath,GLUON_TARGETSDIR))
$(eval $(call mkabspath,GLUON_PATCHESDIR))
GLUON_VERSION := $(shell scripts/getversion.sh '.')
GLUON_SITE_VERSION := $(shell scripts/getversion.sh '$(GLUON_SITEDIR)')
GLUON_MULTIDOMAIN ?= 0
GLUON_AUTOREMOVE ?= 0
GLUON_DEBUG ?= 0
@ -64,6 +67,7 @@ src-link gluon_base ../../package
endef
GLUON_VARS = \
GLUON_VERSION GLUON_SITE_VERSION \
GLUON_RELEASE GLUON_REGION GLUON_MULTIDOMAIN GLUON_AUTOREMOVE GLUON_DEBUG GLUON_MINIFY GLUON_DEPRECATED \
GLUON_DEVICES GLUON_TARGETSDIR GLUON_PATCHESDIR GLUON_TMPDIR GLUON_IMAGEDIR GLUON_PACKAGEDIR GLUON_DEBUGDIR \
GLUON_SITEDIR GLUON_RELEASE GLUON_AUTOUPDATER_BRANCH GLUON_AUTOUPDATER_ENABLED GLUON_LANGS GLUON_BASE_FEEDS \

12
scripts/getversion.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
if [ $# -ne 1 ]; then
echo >&2 "Usage: getversion.sh <directory>"
exit 1
fi
cd "$1" || exit 1
git --git-dir=.git describe --always --abbrev=7 --dirty=+ 2>/dev/null && exit 0
echo unknown

View File

@ -2,6 +2,8 @@ assert(env.GLUON_LANGS)
config('GLUON_SITEDIR', env.GLUON_SITEDIR)
config('GLUON_VERSION', env.GLUON_VERSION)
config('GLUON_SITE_VERSION', env.GLUON_SITE_VERSION)
config('GLUON_RELEASE', env.GLUON_RELEASE)
try_config('GLUON_AUTOUPDATER_BRANCH', env.GLUON_AUTOUPDATER_BRANCH)