Commit 118d782b authored by Guillaume Roguez's avatar Guillaume Roguez

build: fix buildinfo data computation

This patch fixes buildinfo data computation
in case of git failures.

Issue: #79930
Change-Id: Iccce40bb724ebfef73c068b96bfd59b7effbf777
parent 79ded032
......@@ -18,8 +18,8 @@ if BUILD_GSM
GSMCODEC=-DHAVE_GSM_CODEC
endif
RING_DIRTY_REPO ?= $(shell git diff-index --quiet HEAD || echo dirty)
RING_REVISION ?= $(shell git log -1 --format="%h" --abbrev=10)
RING_DIRTY_REPO:=$(shell git diff-index --quiet HEAD 2>/dev/null || echo dirty)
RING_REVISION:=$(shell git log -1 --format="%h" --abbrev=10 2>/dev/null)
# Preprocessor flags
AM_CPPFLAGS = \
......@@ -32,8 +32,8 @@ AM_CPPFLAGS = \
-DPREFIX=\"$(prefix)\" \
-DPROGSHAREDIR=\"${datadir}/ring\" \
-DENABLE_TRACE \
-DRING_REVISION=\"${RING_REVISION}\" \
-DRING_DIRTY_REPO=\"${RING_DIRTY_REPO}\" \
-DRING_REVISION=\"$(RING_REVISION)\" \
-DRING_DIRTY_REPO=\"$(RING_DIRTY_REPO)\" \
$(SPEEXCODEC) \
$(GSMCODEC) \
$(OPUSCODEC)
......
......@@ -40,7 +40,9 @@ namespace DRing {
const char*
version() noexcept
{
return RING_DIRTY_REPO[0] ? PACKAGE_VERSION "-" RING_REVISION "-" RING_DIRTY_REPO : PACKAGE_VERSION "-" RING_REVISION;
return RING_REVISION[0] and RING_DIRTY_REPO[0] ?
PACKAGE_VERSION "-" RING_REVISION "-" RING_DIRTY_REPO :
(RING_REVISION[0] ? PACKAGE_VERSION "-" RING_REVISION : PACKAGE_VERSION);
}
} // namespace DRing
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment