From ab298fab2d7d48f6474941aaa65caf2eb716d369 Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Thu, 7 Mar 2024 04:30:40 +0100 Subject: [PATCH] improv(just): ability to optionally check library version requirement We know that the minimum required version of wayland-client is 1.20 --- justfile | 2 +- scripts/common.just | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/justfile b/justfile index 2feceba..b087429 100644 --- a/justfile +++ b/justfile @@ -50,6 +50,6 @@ fontconfig freetype2 libinput libudev -wayland-client +wayland-client=1.20 xkbcommon " \ No newline at end of file diff --git a/scripts/common.just b/scripts/common.just index 9e05585..8571ad7 100644 --- a/scripts/common.just +++ b/scripts/common.just @@ -31,7 +31,16 @@ dep-cmd cmd: # Errors if a library does not exist [private] dep-lib lib: - @pkg-config --exists {{lib}} || (just print-error 'missing dependency' 'library' {{lib}}; exit 1) + #!/bin/sh + if echo {{lib}} | grep = >/dev/null; then + name=$(echo {{lib}} | cut -d= -f1) + version=$(echo {{lib}} | cut -d= -f2) + pkg-config --exists ${name} --atleast-version ${version} || ( + has=$(pkg-config --modversion ${name}) + just print-error "expected version ${version}, found ${has}" 'library' ${name}; exit 1) + else + pkg-config --exists {{lib}} || (just print-error 'missing dependency' 'library' {{lib}}; exit 1) + fi # Display a formatted error for the user. [private]