diff options
| author | Charles Milette <me@charlesmilette.net> | 2019-02-12 19:56:35 -0500 |
|---|---|---|
| committer | Victor Romero <romerosanchezv@gmail.com> | 2019-02-12 16:56:35 -0800 |
| commit | 07156ed156ccd88352e7264b28ebe92ac1065d48 (patch) | |
| tree | 18d45493d0fc0116846261a4de5179bf5b6036c3 | |
| parent | 349d82eecac51f8349e0fb82a46fc16ef49fc79e (diff) | |
| download | vcpkg-07156ed156ccd88352e7264b28ebe92ac1065d48.tar.gz vcpkg-07156ed156ccd88352e7264b28ebe92ac1065d48.zip | |
[detours] new port (#5347)
* [detours] new port
* [detours] Use PATCHES parameter instead of vcpkg_apply_patches function
| -rw-r--r-- | ports/detours/CONTROL | 3 | ||||
| -rw-r--r-- | ports/detours/find-jmp-bounds-arm64.patch | 24 | ||||
| -rw-r--r-- | ports/detours/portfile.cmake | 28 |
3 files changed, 55 insertions, 0 deletions
diff --git a/ports/detours/CONTROL b/ports/detours/CONTROL new file mode 100644 index 000000000..4998741bd --- /dev/null +++ b/ports/detours/CONTROL @@ -0,0 +1,3 @@ +Source: detours
+Version: 4.0.1
+Description: Detours is a software package for monitoring and instrumenting API calls on Windows.
\ No newline at end of file diff --git a/ports/detours/find-jmp-bounds-arm64.patch b/ports/detours/find-jmp-bounds-arm64.patch new file mode 100644 index 000000000..21390cec0 --- /dev/null +++ b/ports/detours/find-jmp-bounds-arm64.patch @@ -0,0 +1,24 @@ +diff --git a/src/detours.cpp b/src/detours.cpp +index 8345c4d..3cd0e9d 100644 +--- a/src/detours.cpp ++++ b/src/detours.cpp +@@ -974,6 +974,19 @@ inline PBYTE detour_skip_jmp(PBYTE pbCode, PVOID *ppGlobals) + return pbCode; + } + ++inline void detour_find_jmp_bounds(PBYTE pbCode, ++ PDETOUR_TRAMPOLINE *ppLower, ++ PDETOUR_TRAMPOLINE *ppUpper) ++{ ++ // We have to place trampolines within +/- 2GB of code. ++ ULONG_PTR lo = detour_2gb_below((ULONG_PTR)pbCode); ++ ULONG_PTR hi = detour_2gb_above((ULONG_PTR)pbCode); ++ DETOUR_TRACE(("[%p..%p..%p]\n", lo, pbCode, hi)); ++ ++ *ppLower = (PDETOUR_TRAMPOLINE)lo; ++ *ppUpper = (PDETOUR_TRAMPOLINE)hi; ++} ++ + inline BOOL detour_does_code_end_function(PBYTE pbCode) + { + ULONG Opcode = fetch_opcode(pbCode); diff --git a/ports/detours/portfile.cmake b/ports/detours/portfile.cmake new file mode 100644 index 000000000..038f8637c --- /dev/null +++ b/ports/detours/portfile.cmake @@ -0,0 +1,28 @@ +include(vcpkg_common_functions)
+find_program(NMAKE nmake)
+
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO Microsoft/Detours
+ REF v4.0.1
+ SHA512 0a9c21b8222329add2de190d2e94d99195dfa55de5a914b75d380ffe0fb787b12e016d0723ca821001af0168fd1643ffd2455298bf3de5fdc155b3393a3ccc87
+ HEAD_REF master
+ PATCHES
+ find-jmp-bounds-arm64.patch
+)
+
+set(ENV{DETOURS_TARGET_PROCESSOR} "${VCPKG_TARGET_ARCHITECTURE}")
+
+vcpkg_execute_required_process(
+ COMMAND ${NMAKE}
+ WORKING_DIRECTORY ${SOURCE_PATH}/src
+ LOGNAME build-${TARGET_TRIPLET}
+)
+
+# Detours does not differentiate between Release and Debug builds, use the same binaries for both.
+file(INSTALL ${SOURCE_PATH}/lib.${VCPKG_TARGET_ARCHITECTURE}/ DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
+file(INSTALL ${SOURCE_PATH}/lib.${VCPKG_TARGET_ARCHITECTURE}/ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
+file(INSTALL ${SOURCE_PATH}/include DESTINATION ${CURRENT_PACKAGES_DIR})
+file(INSTALL ${SOURCE_PATH}/LICENSE.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
\ No newline at end of file |
