From 45693d54aa6b7a37b91ecec43740345636bca504 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Wed, 17 Apr 2024 14:05:08 +0200 Subject: [PATCH] contrib: add macros to get the (major.minor) version of a system tool --- contrib/src/main.mak | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/contrib/src/main.mak b/contrib/src/main.mak index 68e94b9346..36d837e662 100644 --- a/contrib/src/main.mak +++ b/contrib/src/main.mak @@ -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