[easyhook]Add new port. (#7487)

* [easyhook]Add new port.

* [easyhook]Replace files with a patch, add Description, use .Net framework 4.0.

* [easyhook]Set ONLY_DYNAMIC_CRT.

* [easyhook]Print error message when building static library.
This commit is contained in:
JackBoosY 2019-08-02 08:50:06 +08:00 committed by Phil Christensen
parent ae6ca87221
commit ed7822f5af
3 changed files with 170 additions and 0 deletions

4
ports/easyhook/CONTROL Normal file
View File

@ -0,0 +1,4 @@
Source: easyhook
Version: 2.7.6789.0
Homepage: https://github.com/EasyHook/EasyHook
Description: This project supports extending (hooking) unmanaged code (APIs) with pure managed ones, from within a fully managed environment on 32- or 64-bit Windows Vista x64, Windows Server 2008 x64, Windows 7, Windows 8.1, and Windows 10.

View File

@ -0,0 +1,128 @@
diff --git a/EasyHookDll/EasyHookDll.vcxproj b/EasyHookDll/EasyHookDll.vcxproj
index ec66f91..5773555 100644
--- a/EasyHookDll/EasyHookDll.vcxproj
+++ b/EasyHookDll/EasyHookDll.vcxproj
@@ -188,7 +188,7 @@
<StringPooling>true</StringPooling>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <SmallerTypeCheck>true</SmallerTypeCheck>
+ <SmallerTypeCheck>false</SmallerTypeCheck>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
@@ -207,10 +207,6 @@
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
- <PostBuildEvent>
- <Command>copy "$(TargetPath)" "$(TargetDir)..\x64\EasyHook32.dll"
-copy "$(TargetDir)EasyHook32.lib" "$(TargetDir)..\x64\EasyHook32.lib"</Command>
- </PostBuildEvent>
<MASM>
<UseSafeExceptionHandlers>false</UseSafeExceptionHandlers>
</MASM>
@@ -223,7 +219,7 @@ copy "$(TargetDir)EasyHook32.lib" "$(TargetDir)..\x64\EasyHook32.lib"</Command>
<StringPooling>true</StringPooling>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <SmallerTypeCheck>true</SmallerTypeCheck>
+ <SmallerTypeCheck>false</SmallerTypeCheck>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
@@ -242,10 +238,6 @@ copy "$(TargetDir)EasyHook32.lib" "$(TargetDir)..\x64\EasyHook32.lib"</Command>
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
- <PostBuildEvent>
- <Command>copy "$(TargetPath)" "$(TargetDir)..\x64\EasyHook32.dll"
-copy "$(TargetDir)EasyHook32.lib" "$(TargetDir)..\x64\EasyHook32.lib"</Command>
- </PostBuildEvent>
<MASM>
<UseSafeExceptionHandlers>false</UseSafeExceptionHandlers>
</MASM>
@@ -261,7 +253,7 @@ copy "$(TargetDir)EasyHook32.lib" "$(TargetDir)..\x64\EasyHook32.lib"</Command>
<StringPooling>true</StringPooling>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <SmallerTypeCheck>true</SmallerTypeCheck>
+ <SmallerTypeCheck>false</SmallerTypeCheck>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
@@ -278,10 +270,6 @@ copy "$(TargetDir)EasyHook32.lib" "$(TargetDir)..\x64\EasyHook32.lib"</Command>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>
- <PostBuildEvent>
- <Command>copy "$(TargetPath)" "$(TargetDir)..\x86\EasyHook64.dll"
-copy "$(TargetDir)EasyHook64.lib" "$(TargetDir)..\x86\EasyHook64.lib"</Command>
- </PostBuildEvent>
<MASM>
<UseSafeExceptionHandlers>false</UseSafeExceptionHandlers>
</MASM>
@@ -297,7 +285,7 @@ copy "$(TargetDir)EasyHook64.lib" "$(TargetDir)..\x86\EasyHook64.lib"</Command>
<StringPooling>true</StringPooling>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <SmallerTypeCheck>true</SmallerTypeCheck>
+ <SmallerTypeCheck>false</SmallerTypeCheck>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
@@ -314,10 +302,6 @@ copy "$(TargetDir)EasyHook64.lib" "$(TargetDir)..\x86\EasyHook64.lib"</Command>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>
- <PostBuildEvent>
- <Command>copy "$(TargetPath)" "$(TargetDir)..\x86\EasyHook64.dll"
-copy "$(TargetDir)EasyHook64.lib" "$(TargetDir)..\x86\EasyHook64.lib"</Command>
- </PostBuildEvent>
<MASM>
<UseSafeExceptionHandlers>false</UseSafeExceptionHandlers>
</MASM>
@@ -355,10 +339,6 @@ copy "$(TargetDir)EasyHook64.lib" "$(TargetDir)..\x86\EasyHook64.lib"</Command>
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
- <PostBuildEvent>
- <Command>copy "$(TargetPath)" "$(TargetDir)..\x64\EasyHook32.dll"
-copy "$(TargetDir)EasyHook32.lib" "$(TargetDir)..\x64\EasyHook32.lib"</Command>
- </PostBuildEvent>
<MASM>
<GenerateDebugInformation>false</GenerateDebugInformation>
<UseSafeExceptionHandlers>false</UseSafeExceptionHandlers>
@@ -397,10 +377,6 @@ copy "$(TargetDir)EasyHook32.lib" "$(TargetDir)..\x64\EasyHook32.lib"</Command>
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
- <PostBuildEvent>
- <Command>copy "$(TargetPath)" "$(TargetDir)..\x64\EasyHook32.dll"
-copy "$(TargetDir)EasyHook32.lib" "$(TargetDir)..\x64\EasyHook32.lib"</Command>
- </PostBuildEvent>
<MASM>
<GenerateDebugInformation>false</GenerateDebugInformation>
<UseSafeExceptionHandlers>false</UseSafeExceptionHandlers>
@@ -439,10 +415,6 @@ copy "$(TargetDir)EasyHook32.lib" "$(TargetDir)..\x64\EasyHook32.lib"</Command>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX64</TargetMachine>
</Link>
- <PostBuildEvent>
- <Command>copy "$(TargetPath)" "$(TargetDir)..\x86\EasyHook64.dll"
-copy "$(TargetDir)EasyHook64.lib" "$(TargetDir)..\x86\EasyHook64.lib"</Command>
- </PostBuildEvent>
<MASM>
<GenerateDebugInformation>false</GenerateDebugInformation>
<UseSafeExceptionHandlers>false</UseSafeExceptionHandlers>
@@ -481,10 +453,6 @@ copy "$(TargetDir)EasyHook64.lib" "$(TargetDir)..\x86\EasyHook64.lib"</Command>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX64</TargetMachine>
</Link>
- <PostBuildEvent>
- <Command>copy "$(TargetPath)" "$(TargetDir)..\x86\EasyHook64.dll"
-copy "$(TargetDir)EasyHook64.lib" "$(TargetDir)..\x86\EasyHook64.lib"</Command>
- </PostBuildEvent>
<MASM>
<GenerateDebugInformation>false</GenerateDebugInformation>
<UseSafeExceptionHandlers>false</UseSafeExceptionHandlers>

View File

@ -0,0 +1,38 @@
include(vcpkg_common_functions)
if (NOT VCPKG_TARGET_IS_WINDOWS)
message(FATAL_ERROR "easyhook only support windows.")
endif()
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
message(FATAL_ERROR "easyhook can only be built as dynamic library.")
endif()
message(".Net framework 4.0 is required, please install it before install easyhook.")
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO EasyHook/EasyHook
REF v2.7.6789.0
SHA512 a48b4fe6dd2e55a2d515bc917c0f3ff5b73f08d1778e671df802347c3b8e1d4638005582a494acdf891ffe3fa6eae3eab0096083a8af2352e3f0883eb83421d6
HEAD_REF master
PATCHES fix-build.patch
)
vcpkg_install_msbuild(
SOURCE_PATH ${SOURCE_PATH}
PROJECT_SUBPATH EasyHook.sln
TARGET EasyHookDll
RELEASE_CONFIGURATION "netfx4-Release"
DEBUG_CONFIGURATION "netfx4-Debug"
)
# These libraries are useless, so remove.
file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/EasyHook.dll ${CURRENT_PACKAGES_DIR}/bin/EasyHook.pdb)
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/EasyHook.dll ${CURRENT_PACKAGES_DIR}/debug/bin/EasyHook.pdb)
# Install includes
file(INSTALL ${SOURCE_PATH}/Public/easyhook.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/easyhook)
# Handle copyright
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/easyhook RENAME copyright)