build/scver.mk: Support externally setting version IDs

This is convenient for Linux distributions, like Debian, which do not build the
package in an environment where the VCS metadata is available.
This commit is contained in:
Nicolas Braud-Santoni 2018-05-07 02:56:19 +02:00
parent 2c006934b5
commit 43f68612e3
1 changed files with 5 additions and 1 deletions

View File

@ -98,8 +98,12 @@ endif
GITPRESENT := $(wildcard $(FDBDIR)/.git)
HGPRESENT := $(wildcard $(FDBDIR)/.hg)
# Do not override version IDs if already set
ifneq ($(VERSION_ID),)
# Noop
# Use Git, if not missing
ifneq ($(GITPRESENT),)
else ifneq ($(GITPRESENT),)
SCVER := $(shell cd "$(FDBDIR)" && git --version 2>/dev/null)
ifneq ($(SCVER),)
VERSION_ID := $(shell cd "$(FDBDIR)" && git rev-parse --verify HEAD)