Merge pull request #2680 from atkawa7/yara

[yara] init
This commit is contained in:
Alexander Karatarakis 2018-01-30 18:13:44 -08:00 committed by GitHub
commit 91774037a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 136 additions and 0 deletions

106
ports/yara/CMakeLists.txt Normal file
View File

@ -0,0 +1,106 @@
cmake_minimum_required(VERSION 3.8)
project(yara C)
if(MSVC)
add_compile_options(/W3 /wd4005 /wd4996 /wd4018 -D_CRT_SECURE_NO_WARNINGS)
endif()
find_package(OpenSSL REQUIRED)
find_path(JANSSON_INCLUDE_DIR NAMES jansson.h)
find_library(JANSSON_LIBRARY NAMES jansson)
include_directories(
.
libyara
libyara/include
)
set(
libyara_sources
libyara/ahocorasick.c
libyara/arena.c
libyara/atoms.c
libyara/compiler.c
libyara/exec.c
libyara/exefiles.c
libyara/filemap.c
libyara/grammar.c
libyara/hash.c
libyara/hex_grammar.c
libyara/hex_lexer.c
libyara/lexer.c
libyara/libyara.c
libyara/mem.c
libyara/modules.c
libyara/modules/cuckoo.c
libyara/modules/dotnet.c
libyara/modules/elf.c
libyara/modules/hash.c
libyara/modules/math.c
libyara/modules/macho.c
libyara/modules/pe.c
libyara/modules/pe_utils.c
libyara/modules/tests.c
libyara/modules/time.c
libyara/object.c
libyara/parser.c
libyara/proc.c
libyara/proc/windows.c
libyara/re.c
libyara/re_grammar.c
libyara/re_lexer.c
libyara/rules.c
libyara/scan.c
libyara/sizedstr.c
libyara/stream.c
libyara/strutils.c
libyara/threading.c
)
set(
yara_sources
args.c
threading.c
yara.c
)
set( yarac_sources
args.c
yarac.c
)
add_library(libyara ${libyara_sources})
target_link_libraries(libyara PRIVATE OpenSSL::SSL OpenSSL::Crypto ${JANSSON_LIBRARY})
target_compile_definitions(
libyara
PRIVATE
-DHAVE_LIBCRYPTO -DUSE_WINDOWS_PROC
-DCUCKOO_MODULE- DHASH_MODULE -DDOTNET_MODULE
)
add_executable(yara ${yara_sources})
add_executable(yarac ${yarac_sources})
target_link_libraries(yarac PRIVATE libyara OpenSSL::SSL OpenSSL::Crypto ${JANSSON_LIBRARY})
target_link_libraries(yara PRIVATE libyara OpenSSL::SSL OpenSSL::Crypto ${JANSSON_LIBRARY})
install(
TARGETS libyara
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
if(NOT DISABLE_INSTALL_TOOLS)
install (
TARGETS yarac yara
RUNTIME DESTINATION tools/yara
)
endif()
if(NOT DISABLE_INSTALL_HEADERS)
install(DIRECTORY libyara/include/ DESTINATION include)
endif()

4
ports/yara/CONTROL Normal file
View File

@ -0,0 +1,4 @@
Source: yara
Version: e3439e4ead4ed5d3b75a0b46eaf15ddda2110bb9
Description: The pattern matching swiss knife
Build-Depends: openssl, jansson

26
ports/yara/portfile.cmake Normal file
View File

@ -0,0 +1,26 @@
include(vcpkg_common_functions)
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
message(WARNING "Building static")
set(VCPKG_LIBRARY_LINKAGE static)
endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO VirusTotal/yara
REF e3439e4ead4ed5d3b75a0b46eaf15ddda2110bb9
SHA512 2cb837c8e2617e66766b45339a99f3f441f842cb14ce7efe38f5ec2141a51696a400279d98514be4471234c8ef7c99419f56f5b7398af13d771294b2923090aa
HEAD_REF dev
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON -DDISABLE_INSTALL_TOOLS=ON
)
vcpkg_install_cmake()
# Handle copyright
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/yara RENAME copyright)