From e364c52dd07cf30d3e13820e84f3e11052ae4c03 Mon Sep 17 00:00:00 2001 From: "Kirill A. Korinsky" Date: Sun, 15 Aug 2021 11:06:02 +0200 Subject: [PATCH] backport yara patch for macOS This PR is simple backports https://github.com/VirusTotal/yara/pull/1540 to existed way apply patches to yara which is fixed #990 --- deps/yara/patch.cmake | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/deps/yara/patch.cmake b/deps/yara/patch.cmake index 30257dcee..fec034349 100644 --- a/deps/yara/patch.cmake +++ b/deps/yara/patch.cmake @@ -148,3 +148,31 @@ function(patch_dotnet file) endif() endfunction() patch_dotnet("${yara_path}/libyara/modules/dotnet/dotnet.c") + +# https://github.com/VirusTotal/yara/pull/1540 +function(patch_configure_ac file) + file(READ "${file}" content) + set(new_content "${content}") + + string(REPLACE + "PKG_CHECK_MODULES(PROTOBUF_C, libprotobuf-c >= 1.0.0)" + "PKG_CHECK_MODULES([PROTOBUF_C], [libprotobuf-c >= 1.0.0])" + new_content + "${new_content}" + ) + + string(REPLACE + "AC_CHECK_LIB(protobuf-c, protobuf_c_message_unpack,," + "AC_CHECK_LIB([protobuf-c], protobuf_c_message_unpack,," + new_content + "${new_content}" + ) + + if("${new_content}" STREQUAL "${content}") + message(STATUS "-- Patching: ${file} skipped") + else() + message(STATUS "-- Patching: ${file} patched") + file(WRITE "${file}" "${new_content}") + endif() +endfunction() +patch_configure_ac("${yara_path}/configure.ac")