Skip to content

Commit

Permalink
backport yara patch for macOS
Browse files Browse the repository at this point in the history
This PR is simple backports VirusTotal/yara#1540
to existed way apply patches to yara which is fixed #990
  • Loading branch information
catap committed Aug 15, 2021
1 parent 18b434f commit 2539bf0
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions deps/yara/patch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")

0 comments on commit 2539bf0

Please sign in to comment.