contrib: add macros to get the (major.minor) version of a system tool

This commit is contained in:
Steve Lhomme 2024-04-17 14:05:08 +02:00
parent fe47c2f2d6
commit 45693d54aa
1 changed files with 5 additions and 0 deletions

View File

@ -262,6 +262,11 @@ PKG_CONFIG ?= pkg-config
PKG_CONFIG_PATH := $(PREFIX)/lib/pkgconfig:$(PREFIX)/share/pkgconfig:$(PKG_CONFIG_PATH)
export PKG_CONFIG_PATH
# Get the version of a system tool $1 and pass it through the $2 command(s)
system_tool_version = $(shell PATH="${SYSTEM_PATH}" $(1) 2>/dev/null | head -1 | sed -ne 's/[^0-9]*\([0-9]\([0-9a-zA-Z\.\-]*\)\)\(.*\)/\1/p' | $(2))
# Get the major.minor version of a system tool
system_tool_majmin = $(call system_tool_version, $(1), cut -d '.' -f -2)
ifndef GIT
ifeq ($(shell git --version >/dev/null 2>&1 || echo FAIL),)
GIT = git