]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: makefile: do not rely on shell substitutions to determine git version
authorWilly Tarreau <w@1wt.eu>
Sat, 22 Jun 2019 06:24:16 +0000 (08:24 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 22 Jun 2019 06:28:32 +0000 (08:28 +0200)
Solaris's default shell doesn't support substitutions at the beginning or
end of variables, which are still used to determine the version based on
git. Since we added --abbrev=0 we don't need the last one. And using cut
it's trivial to replace the first one, actually simplifying the whole
expression.

This may be backported to all stable branches.

Makefile

index 3d67fd27f11a596c75995a5f3bbf217b1a8fa669..54d345f08a581c1e41c283ad90ad5f368f280927 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -396,7 +396,7 @@ $(set_target_defaults)
 # holding the same names in the current directory.
 
 ifeq ($(IGNOREGIT),)
-VERSION := $(shell [ -d .git/. ] && ref=`(git describe --tags --match 'v*' --abbrev=0) 2>/dev/null` && ref=$${ref%-g*} && echo "$${ref\#v}")
+VERSION := $(shell [ -d .git/. ] && (git describe --tags --match 'v*' --abbrev=0 | cut -c 2-) 2>/dev/null)
 ifneq ($(VERSION),)
 # OK git is there and works.
 SUBVERS := $(shell comms=`git log --format=oneline --no-merges v$(VERSION).. 2>/dev/null | wc -l | tr -d '[:space:]'`; commit=`(git log -1 --pretty=%h --abbrev=6) 2>/dev/null`; [ $$comms -gt 0 ] && echo "-$$commit-$$comms")