From d9aff0c9842ea3a6b673ed4ff8204fe3bb60024a Mon Sep 17 00:00:00 2001 From: Luigi Leonardi Date: Fri, 29 May 2026 14:36:14 +0200 Subject: [PATCH] igvm_c: fix macOS compatibility for Makefile and post_process.sh grep -oP uses Perl regex which is not supported by BSD grep on macOS. Replace it with sed for version parsing. sed -i without a suffix argument is GNU-specific and incompatible with BSD. use sed -i.bak which works on both GNU and BSD sed, and remove the backup files afterwards. Signed-off-by: Luigi Leonardi --- igvm_c/Makefile | 2 +- igvm_c/scripts/post_process.sh | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/igvm_c/Makefile b/igvm_c/Makefile index daea749..73598bc 100644 --- a/igvm_c/Makefile +++ b/igvm_c/Makefile @@ -30,7 +30,7 @@ IGVM_LIBS = $(shell pkg-config --libs --static $(UNINSTALLED_PC)) IGVM_LIBS_STATIC = $(subst $(IGVM_LIBS), -ligvm, $(LIBIGVM)) # Determine igvm crate version from Cargo.toml -VERSION = $(shell grep -oP "(?<=version = \").+(?=\")" $(IGVM_DIR)/igvm/Cargo.toml) +VERSION = $(shell sed -n 's/^version = "\(.*\)"/\1/p' $(IGVM_DIR)/igvm/Cargo.toml) .PHONY: all build test clean install diff --git a/igvm_c/scripts/post_process.sh b/igvm_c/scripts/post_process.sh index 22cc057..73a5112 100755 --- a/igvm_c/scripts/post_process.sh +++ b/igvm_c/scripts/post_process.sh @@ -10,11 +10,13 @@ # cbindgen configuration files and annotations. set -e -sed -i -e 's/INVALID = 0/IGVM_INVALID = 0/g' \ - -e 's/RESERVED_DO_NOT_USE = /IGVM_RESERVED_DO_NOT_USE = /g' \ - -e 's/RequiredMemoryFlags/IgvmRequiredMemoryFlags/g' \ - -e 's/MemoryMapEntryFlags/IgvmMemoryMapEntryFlags/g' \ - $1/igvm_defs.h +sed -i.bak -e 's/INVALID = 0/IGVM_INVALID = 0/g' \ + -e 's/RESERVED_DO_NOT_USE = /IGVM_RESERVED_DO_NOT_USE = /g' \ + -e 's/RequiredMemoryFlags/IgvmRequiredMemoryFlags/g' \ + -e 's/MemoryMapEntryFlags/IgvmMemoryMapEntryFlags/g' \ + "$1/igvm_defs.h" +rm -f "$1/igvm_defs.h.bak" -sed -i -e 's/ HEADER_SECTION_/ IGVM_HEADER_SECTION_/g' \ - $1/igvm.h +sed -i.bak -e 's/ HEADER_SECTION_/ IGVM_HEADER_SECTION_/g' \ + "$1/igvm.h" +rm -f "$1/igvm.h.bak"