Skip to content

Commit

Permalink
[polyhook2] Update to 2020-05-25 (#11561)
Browse files Browse the repository at this point in the history
* [polyhook2] Update to 2020-05-25

- Update to latest PolyHook_2 revision.

- Add support for zydis and inlinentd as features (enabled by default, as per upstream default).

- Support for capstone, exception, detours, and pe is now configurable via features (all enabled by default, as per upstream default).

- Remove cmake build patch. Relevant parts have been upstreamed.

- For now, remove tool feature for building tests, as upstream does not support building tests along with building the library.

- Add support for cmake config so library can be used simply with "find_package(PolyHook_2 CONFIG REQUIRE)".

* [polyhook2] package does not support arm, uwp, linux, and osx

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>
  • Loading branch information
mcmtroffaes and NancyLi1013 authored Jun 2, 2020
1 parent 60e3690 commit e7041e1
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 153 deletions.
28 changes: 25 additions & 3 deletions ports/polyhook2/CONTROL
Original file line number Diff line number Diff line change
@@ -1,8 +1,30 @@
Source: polyhook2
Version: 2020-02-17
Version: 2020-05-25
Homepage: https://github.com/stevemk14ebr/PolyHook_2_0
Description: C++17, x86/x64 Hooking Libary v2.0
Supports: !(arm|uwp|linux|osx)
Default-Features: capstone,zydis,exception,detours,inlinentd,pe,virtuals

Feature: capstone
Build-Depends: capstone[x86]
Description: Capstone disassembler integration.

Feature: zydis
Build-Depends: zydis
Description: Zydis disassembler integration.

Feature: exception
Description: Implement all exception hooking functionality

Feature: detours
Description: Implement detour functionality

Feature: inlinentd
Build-Depends: asmjit
Description: Support inline hooks without specifying typedefs by generating callback stubs at runtime with AsmJit

Feature: pe
Description: Implement all win pe hooking functionality

Feature: tool
Description: Build tests
Feature: virtuals
Description: Implement all virtual table hooking functionality
135 changes: 0 additions & 135 deletions ports/polyhook2/fix-build-error.patch

This file was deleted.

39 changes: 24 additions & 15 deletions ports/polyhook2/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,50 @@ vcpkg_fail_port_install(ON_ARCH "arm" "arm64" ON_TARGET "Linux" "OSX" "UWP")
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO stevemk14ebr/PolyHook_2_0
REF 157112f7991768eef51f262486d59c02f18413dc
SHA512 3e8919e5a5a66db29848737b2b90bef57e97b55f516b78518abeb004fbdd2c7a3c99c26753024a8f0be5accc830ded8065f473f1d67f7e033ee419626f4212fe
REF 0f47489c8c27d5be67aa608cfd7304c674ac4ef1
SHA512 9e1945638479e942dba3d524b64a3ad7d8bff156d2be1fa55a1715f962da54d46995876b1c60c189918c232d70a031d382b3d8cda36e5f9c7951f31bcdc9cd19
HEAD_REF master
PATCHES
fix-build-error.patch
)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
tool BUILD_TOOLS
capstone POLYHOOK_DISASM_CAPSTONE
zydis POLYHOOK_DISASM_ZYDIS
exception POLYHOOK_FEATURE_EXCEPTION
detours POLYHOOK_FEATURE_DETOURS
inlinentd POLYHOOK_FEATURE_INLINENTD
pe POLYHOOK_FEATURE_PE
virtuals POLYHOOK_FEATURE_VIRTUALS
)

if (VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(BUILD_STATIC ON)
set(BUILD_SHARED_LIB OFF)
else()
set(BUILD_STATIC OFF)
set(BUILD_SHARED_LIB ON)
endif()

if (VCPKG_CRT_LINKAGE STREQUAL "static")
set(BUILD_STATIC_RUNTIME ON)
else()
set(BUILD_STATIC_RUNTIME OFF)
endif()

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS ${FEATURE_OPTIONS}
-DFEATURE_INLINENTD=OFF
-DBUILD_DLL=ON
-DBUILD_STATIC=${BUILD_STATIC}
-DPOLYHOOK_BUILD_SHARED_LIB=${BUILD_SHARED_LIB}
-DPOLYHOOK_BUILD_STATIC_RUNTIME=${BUILD_STATIC_RUNTIME}
-DPOLYHOOK_USE_EXTERNAL_ASMJIT=ON
-DPOLYHOOK_USE_EXTERNAL_CAPSTONE=ON
-DPOLYHOOK_USE_EXTERNAL_ZYDIS=ON
)

vcpkg_install_cmake()

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)

vcpkg_copy_pdbs()

if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
endif()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/PolyHook_2 TARGET_PATH share/PolyHook_2)

# Handle copyright
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)

0 comments on commit e7041e1

Please sign in to comment.