Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[safetyhook] new port #43983

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions ports/safetyhook/fix-cmake-install.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
diff --git a/cmake/safetyhook-config.cmake.in b/cmake/safetyhook-config.cmake.in
new file mode 100644
index 0000000..5d08ca1
--- /dev/null
+++ b/cmake/safetyhook-config.cmake.in
@@ -0,0 +1,7 @@
+@PACKAGE_INIT@
+
+include(CMakeFindDependencyMacro)
+find_dependency(zydis CONFIG)
+
+include("${CMAKE_CURRENT_LIST_DIR}/safetyhook-targets.cmake")
+check_required_components(safetyhook)
diff --git a/cmake.toml b/cmake.toml
index 04645b8..3f6ec3d 100644
--- a/cmake.toml
+++ b/cmake.toml
@@ -84,10 +84,17 @@ if(SAFETYHOOK_USE_CXXMODULES)
endif()

include(GNUInstallDirs)
+include(CMakePackageConfigHelpers)
+
+configure_package_config_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/safetyhook-config.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/safetyhook-config.cmake
+ INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/safetyhook
+)

install(
TARGETS safetyhook
- EXPORT safetyhook-export
+ EXPORT safetyhook-targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
@@ -100,11 +107,16 @@ install(
)

install(
- EXPORT safetyhook-export
- FILE safetyhook-config.cmake
+ EXPORT safetyhook-targets
+ FILE safetyhook-targets.cmake
NAMESPACE safetyhook::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/safetyhook
)
+
+install(
+ FILES ${CMAKE_CURRENT_BINARY_DIR}/safetyhook-config.cmake
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/safetyhook
+)
"""

[target.docs]
25 changes: 25 additions & 0 deletions ports/safetyhook/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO cursey/safetyhook
REF "v${VERSION}"
SHA512 29fe65c6c6a5fbf6c9fc8effbd33a04b08c88c09d009e2ea55a5d459ca0feaac4c8d09621b983f607f30fcb1a56a45f4e4843731362ff8375b6d1dcf84126f25
HEAD_REF main
PATCHES
"fix-cmake-install.patch"
)

vcpkg_find_acquire_program(GIT)

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
"-DGIT_EXECUTABLE=${GIT}"
"-DSAFETYHOOK_FETCH_ZYDIS=OFF"
)

vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/safetyhook)

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

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
19 changes: 19 additions & 0 deletions ports/safetyhook/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "safetyhook",
"version-semver": "0.6.4",
"description": "C++23 procedure hooking library.",
"homepage": "https://github.com/cursey/safetyhook",
"license": "BSL-1.0",
"supports": "(windows | linux) & !arm & !uwp",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
},
"zydis"
]
}
1 change: 1 addition & 0 deletions scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,7 @@ rpclib:x64-uwp=fail
rtmidi:arm-neon-android=fail
rtmidi:arm64-android=fail
rtmidi:x64-android=fail
safetyhook:x64-linux=fail
salome-medcoupling:x64-linux=fail
scintilla:arm-neon-android=fail
scintilla:arm64-android=fail
Expand Down
4 changes: 4 additions & 0 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -8152,6 +8152,10 @@
"baseline": "3.0.28",
"port-version": 0
},
"safetyhook": {
"baseline": "0.6.4",
"port-version": 0
},
"sail": {
"baseline": "0.9.8",
"port-version": 0
Expand Down
9 changes: 9 additions & 0 deletions versions/s-/safetyhook.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "66ba3f81271640fdca4669d76513fa5c263d1f0e",
"version-semver": "0.6.4",
"port-version": 0
}
]
}
Loading