From 5121e7149e785fb7d8455b3f380b829349e9e4a6 Mon Sep 17 00:00:00 2001 From: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> Date: Tue, 7 May 2019 22:51:00 -0700 Subject: [PATCH] [minhook] Add new port (#6333) * [minhook] Add new port * Download cmake support as patch * Move architecture check to before work is done * Check in install destination patchl Remove config --- ports/minhook/CONTROL | 3 ++ ports/minhook/install-destination.patch | 22 +++++++++++ ports/minhook/portfile.cmake | 49 +++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 ports/minhook/CONTROL create mode 100644 ports/minhook/install-destination.patch create mode 100644 ports/minhook/portfile.cmake diff --git a/ports/minhook/CONTROL b/ports/minhook/CONTROL new file mode 100644 index 0000000000..95209891ba --- /dev/null +++ b/ports/minhook/CONTROL @@ -0,0 +1,3 @@ +Source: minhook +Version: 1.3.3 +Description: The Minimalistic x86/x64 API Hooking Library for Windows. \ No newline at end of file diff --git a/ports/minhook/install-destination.patch b/ports/minhook/install-destination.patch new file mode 100644 index 0000000000..13f3dc3799 --- /dev/null +++ b/ports/minhook/install-destination.patch @@ -0,0 +1,22 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index df947af..6a894d8 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -113,7 +113,7 @@ install( + "${CMAKE_CURRENT_BINARY_DIR}/minhook-config.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/minhook-config-version.cmake" + DESTINATION +- "lib/minhook" ++ share/minhook + ) + + ################### +@@ -133,7 +133,7 @@ install( + NAMESPACE + minhook:: + DESTINATION +- "lib/minhook" ++ share/minhook + ) + + install( diff --git a/ports/minhook/portfile.cmake b/ports/minhook/portfile.cmake new file mode 100644 index 0000000000..13779a3388 --- /dev/null +++ b/ports/minhook/portfile.cmake @@ -0,0 +1,49 @@ +if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + message(FATAL_ERROR "${PORT} does not currently support UWP") +endif() + +include(vcpkg_common_functions) + +if (VCPKG_TARGET_ARCHITECTURE MATCHES "x86") + set(BUILD_ARCH "Win32") + set(OUTPUT_DIR "Win32") +elseif (VCPKG_TARGET_ARCHITECTURE MATCHES "x64") + set(BUILD_ARCH "x64") + set(OUTPUT_DIR "Win64") +else() + message(FATAL_ERROR "Unsupported architecture: ${VCPKG_TARGET_ARCHITECTURE}") +endif() + +# Download files to enable CMake support for minhook - Adds CMakeLists.txt and minhook-config.cmake.in +vcpkg_download_distfile( + CMAKE_SUPPORT_PATCH + URLS https://github.com/TsudaKageyu/minhook/commit/3f2e34976c1685ee372a09f54c0c8c8f4240ef90.patch + FILENAME minhook-cmake-support.patch + SHA512 5f353b167e2c31e5e06258420c78fbae0095368cf687ff06a350d6b69b30476824785dde5dbcea3e30ff827e7cdb293727a73e6b1e6875f00aa891b2980c3877 +) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO TsudaKageyu/minhook + REF v1.3.3 + SHA512 9f10c92a926a06cde1e4092b664a3aab00477e8b9f20cee54e1d2b3747fad91043d199a2753f7e083497816bbefc5d75d9162d2098dd044420dbca555e80b060 + HEAD_REF master + PATCHES + "${CMAKE_SUPPORT_PATCH}" + install-destination.patch +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS +) + +vcpkg_install_cmake() + +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(COPY ${CURRENT_PACKAGES_DIR}/debug/share/${PORT}/minhook-targets-debug.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) +file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)