From acdd4c91b198f536f347848ebdb9b4b9039244f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Sat, 7 Feb 2026 13:24:23 +0100 Subject: [PATCH] build: replace grep -oP with sed -E for macOS compatibility The -P flag (Perl regex) is not available on macOS by default. Replaced with sed -E which is POSIX-compliant and universally available on both Linux and macOS. - Makefile: CURVER extraction and validation now use sed -nE and grep -cE - openssl_flags.mk: Removed Darwin-specific branching, using unified sed -E + awk approach for all platforms --- Makefile | 4 ++-- common_mk/openssl_flags.mk | 8 -------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 0ffe73378..61baa3820 100644 --- a/Makefile +++ b/Makefile @@ -25,10 +25,10 @@ endif export GIT_VERSION # Extract CURVER from GIT_VERSION (first 3 numbers, e.g., 3.0.6 from 3.0.6-388-ga94b7d6) -CURVER := $(shell echo "$(GIT_VERSION)" | grep -oP '^\d+\.\d+\.\d+' | head -1) +CURVER := $(shell echo "$(GIT_VERSION)" | sed -nE 's/^([0-9]+\.[0-9]+\.[0-9]+).*/\1/p' | head -1) # Validate CURVER has 3 numbers separated by dots -CURVER_CHECK := $(shell echo "$(CURVER)" | grep -cP '^\d+\.\d+\.\d+$$') +CURVER_CHECK := $(shell echo "$(CURVER)" | grep -cE '^[0-9]+\.[0-9]+\.[0-9]+$$') ifeq ($(CURVER_CHECK),0) $(error CURVER "$(CURVER)" derived from GIT_VERSION "$(GIT_VERSION)" does not have 3 numbers separated by dots (expected format: X.Y.Z) diff --git a/common_mk/openssl_flags.mk b/common_mk/openssl_flags.mk index c6c8b2dc7..461728f3b 100644 --- a/common_mk/openssl_flags.mk +++ b/common_mk/openssl_flags.mk @@ -20,20 +20,12 @@ endif ifeq ($(CUSTOM_OPENSSL_PATH),) ifeq ($(OPENSSL_PACKAGE),openssl3) -ifeq ($(UNAME_S),Darwin) SSL_IDIR := $(shell pkg-config --cflags $(OPENSSL_PACKAGE) | sed -E 's/-I/ /g' | awk '{for(i=1;i<=NF;i++) if($$i ~ /^\//) print $$i}' | head -n 1) -else - SSL_IDIR := $(shell pkg-config --cflags $(OPENSSL_PACKAGE) | grep -oP "(?<=-I)[^ ]+") -endif SSL_LDIR := $(shell pkg-config --variable=libdir $(OPENSSL_PACKAGE)) LIB_SSL_PATH := $(shell find $(SSL_LDIR) -name "libssl.so.3" 2>/dev/null | head -n 1) LIB_CRYPTO_PATH := $(shell find $(SSL_LDIR) -name "libcrypto.so.3" 2>/dev/null | head -n 1) else -ifeq ($(UNAME_S),Darwin) SSL_IDIR := $(shell export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1; export PKG_CONFIG_ALLOW_SYSTEM_LIBS=1; pkg-config --cflags $(OPENSSL_PACKAGE) | sed -E 's/-I/ /g' | awk '{for(i=1;i<=NF;i++) if($$i ~ /^\//) print $$i}' | head -n 1) -else - SSL_IDIR := $(shell export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1; export PKG_CONFIG_ALLOW_SYSTEM_LIBS=1; pkg-config --cflags $(OPENSSL_PACKAGE) | grep -oP "(?<=-I)[^ ]+") -endif SSL_LDIR := $(shell pkg-config --variable=libdir $(OPENSSL_PACKAGE)) ifeq ($(UNAME_S),Darwin) LIB_SSL_PATH := $(shell find $(SSL_LDIR) -name "libssl.dylib" 2>/dev/null | head -n 1)