From db96f435614b8341055d0c3f04808f830bb9a6af Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 09:13:10 +0300 Subject: [PATCH 01/71] init --- ports/libmem/0001-CMakeLists.patch | 135 +++++++++++------------------ ports/libmem/portfile.cmake | 19 ++-- ports/libmem/usage | 4 - ports/libmem/vcpkg.json | 2 +- versions/baseline.json | 2 +- 5 files changed, 59 insertions(+), 103 deletions(-) delete mode 100644 ports/libmem/usage diff --git a/ports/libmem/0001-CMakeLists.patch b/ports/libmem/0001-CMakeLists.patch index 3dac50d0cb88df..b2e90185fd5f5a 100644 --- a/ports/libmem/0001-CMakeLists.patch +++ b/ports/libmem/0001-CMakeLists.patch @@ -1,95 +1,70 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 534057a..a4b8080 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.22.1) -include(ExternalProject) -+ ++set(CMAKE_CXX_STANDARD 17) project(libmem LANGUAGES -@@ -23,13 +23,23 @@ option(LIBMEM_DEEP_TESTS - OFF - ) +@@ -48,7 +48,7 @@ message(STATUS -+set(CMAKE_CXX_STANDARD 17) -+set(CMAKE_CXX_STANDARD_REQUIRED ON) -+set(targets_export_name libmem-target) -+ -+if (MSVC AND NOT(BUILD_SHARED_LIBS)) -+ add_definitions(/DLM_EXPORT) -+elseif(NOT(MSVC) AND BUILD_SHARED_LIBS) -+ add_definitions(-DLM_EXPORT) -+endif() -+if(0) - option(LIBMEM_BUILD_STATIC - "Build a static library" - OFF - ) -- -+endif() - set(LIBMEM_ARCH ${CMAKE_SYSTEM_PROCESSOR} CACHE STRING "Force a specific architecture") + message(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}") + message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") - +if(0) - message(STATUS - "[*] Architecture: ${LIBMEM_ARCH}" - ) -@@ -65,13 +75,17 @@ add_library(capstone STATIC IMPORTED) - set_target_properties(capstone PROPERTIES IMPORTED_LOCATION ${CAPSTONE_IMPORT_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}capstone${CMAKE_STATIC_LIBRARY_SUFFIX}) + # External dependencies + set(EXTERNAL_DEPENDENCIES_DIR "${PROJECT_SOURCE_DIR}/external") + set(CAPSTONE_DIR "${EXTERNAL_DEPENDENCIES_DIR}/capstone") +@@ -66,7 +66,7 @@ set_target_properties(capstone PROPERTIES IMPORTED_LOCATION ${CAPSTONE_IMPORT_DI add_library(keystone STATIC IMPORTED) set_target_properties(keystone PROPERTIES IMPORTED_LOCATION ${KEYSTONE_IMPORT_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}keystone${CMAKE_STATIC_LIBRARY_SUFFIX}) -+endif() -+find_package(PkgConfig) -+pkg_check_modules(keystone REQUIRED keystone) -+find_package(capstone CONFIG REQUIRED) # End of external dependencies - ++endif() set(LIBMEM_DIR "${PROJECT_SOURCE_DIR}") -+set(LLVM_DEM_DIR "${LIBMEM_DIR}/external/llvm") set(LIBMEM_INC "${LIBMEM_DIR}/include") set(INTERNAL_DIR "${LIBMEM_DIR}/internal") - set(COMMON_DIR "${LIBMEM_DIR}/src/common") -- -+file(GLOB_RECURSE LLVM_DEM_SRC "${LLVM_DEM_DIR}/lib/*.cpp") - if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) - file(GLOB_RECURSE LIBMEM_SRC "${LIBMEM_DIR}/src/win/*.c" "${LIBMEM_DIR}/src/common/*.c" "${LIBMEM_DIR}/src/common/*.cpp" "${INTERNAL_DIR}/winutils/*.c" "${INTERNAL_DIR}/demangler/*.cpp") - elseif(${CMAKE_SYSTEM_NAME} STREQUAL Linux) -@@ -89,16 +103,13 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD) +@@ -89,16 +89,18 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD) endif() file(GLOB LIBMEM_SRC ${LIBMEM_ARCH_SRC} "${LIBMEM_DIR}/src/freebsd/*.c" "${LIBMEM_DIR}/src/freebsd/ptrace/*.c" "${LIBMEM_DIR}/src/common/*.c" "${LIBMEM_DIR}/src/common/*.cpp" "${INTERNAL_DIR}/posixutils/*.c" "${INTERNAL_DIR}/elfutils/*.c" "${INTERNAL_DIR}/demangler/*.cpp") endif() --set(LIBMEM_DEPS ++find_package(PkgConfig) ++pkg_check_modules(keystone REQUIRED keystone) ++find_package(capstone CONFIG REQUIRED) + set(LIBMEM_DEPS - capstone - keystone - llvm --) - --if (LIBMEM_BUILD_STATIC) -+file(GLOB_RECURSE LIBMEM_PUBLIC_HEADERS "${LIBMEM_INC}/libmem/*.h" "${LIBMEM_INC}/libmem/*.hpp") -+ -+if (0) - add_library(libmem STATIC ${LIBMEM_SRC}) ++ capstone::capstone ++ ${keystone_LINK_LIBRARIES} + ) +- ++file(GLOB_RECURSE LLVM_DEM_SRC "${LIBMEM_DIR}/external/llvm/lib/*.cpp") + if (LIBMEM_BUILD_STATIC) +- add_library(libmem STATIC ${LIBMEM_SRC}) ++ add_library(libmem STATIC ${LIBMEM_SRC} ${LLVM_DEM_SRC}) else() - add_library(libmem SHARED ${LIBMEM_SRC}) -+ add_library(libmem ${LIBMEM_SRC} ${LLVM_DEM_SRC}) ++ add_library(libmem SHARED ${LIBMEM_SRC} ${LLVM_DEM_SRC}) endif() target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}") -@@ -109,17 +120,16 @@ include_directories(${PROJECT_SOURCE_DIR} - ${LLVM_INC} +@@ -106,7 +108,7 @@ include_directories(${PROJECT_SOURCE_DIR} + ${LIBMEM_INC} + ${CAPSTONE_INC} + ${KEYSTONE_INC} +- ${LLVM_INC} ++ ${LIBMEM_DIR}/external/llvm/include ) --if (LIBMEM_BUILD_TESTS) -+if (0) - set(TESTS_DIR "${PROJECT_SOURCE_DIR}/tests") - add_subdirectory(${TESTS_DIR}) - endif() + if (LIBMEM_BUILD_TESTS) +@@ -116,10 +118,6 @@ endif() --set_target_properties(libmem PROPERTIES POSITION_INDEPENDENT_CODE True INCLUDES ${LIBMEM_INC}) -+set_target_properties(libmem PROPERTIES POSITION_INDEPENDENT_CODE True PUBLIC_HEADER "${LIBMEM_PUBLIC_HEADERS}") -+target_compile_features(libmem PUBLIC cxx_std_17) -+target_compile_definitions(libmem PUBLIC LM_EXPORT) -+target_include_directories(libmem PRIVATE "${LLVM_DEM_DIR}/include" "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}" "${LIBMEM_INC}" INTERFACE $) + set_target_properties(libmem PROPERTIES POSITION_INDEPENDENT_CODE True INCLUDES ${LIBMEM_INC}) target_compile_definitions(libmem PUBLIC LM_EXPORT) -add_dependencies(libmem - capstone-engine @@ -98,18 +73,16 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) set(LIBMEM_DEPS -@@ -151,8 +161,8 @@ else() - message(FATAL_ERROR "[!] Unsupported platform") +@@ -152,7 +150,7 @@ else() endif() --target_link_libraries(libmem ${LIBMEM_DEPS}) + target_link_libraries(libmem ${LIBMEM_DEPS}) -if(LIBMEM_BUILD_STATIC) -+target_link_libraries(libmem PRIVATE ${LIBMEM_DEPS} ${keystone_LINK_LIBRARIES} capstone::capstone) +if(0) # Create a bundled static library containing all dependencies (to mimic the shared library behavior) set_target_properties(libmem PROPERTIES OUTPUT_NAME "libmem_partial") set(libmem_bundle_files "$") -@@ -193,7 +203,7 @@ if(LIBMEM_BUILD_STATIC) +@@ -193,7 +191,7 @@ if(LIBMEM_BUILD_STATIC) endif() endif() @@ -118,51 +91,45 @@ if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) cmake_path(SET CMAKE_INSTALL_PREFIX "$ENV{ProgramFiles}") else() -@@ -202,14 +212,44 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN +@@ -202,14 +200,39 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN endif() set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/libmem") execute_process(COMMAND mkdir "${CMAKE_INSTALL_PREFIX}") -else() -+elseif(0) ++ set(CMAKE_INSTALL_PREFIX "/usr") endif() -- + install(TARGETS libmem - LIBRARY DESTINATION lib) -+ EXPORT ${targets_export_name} -+ LIBRARY DESTINATION lib -+ ARCHIVE DESTINATION lib -+ PUBLIC_HEADER DESTINATION include/libmem +- +-install(TARGETS libmem +- RUNTIME DESTINATION lib) ++ EXPORT libmem-target ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib ++ PUBLIC_HEADER DESTINATION include/libmem + RUNTIME DESTINATION bin +) --install(TARGETS libmem -- RUNTIME DESTINATION lib) -+# Install the export file, which allows users to find the target + install(DIRECTORY ${LIBMEM_INC}/libmem DESTINATION include) +install( -+ EXPORT ${targets_export_name} ++ EXPORT libmem-target + NAMESPACE libmem:: -+ FILE ${targets_export_name}.cmake ++ FILE libmem-target.cmake + DESTINATION share/libmem +) - --install(DIRECTORY ${LIBMEM_INC}/libmem DESTINATION include) -+# Config and version files for the package +include(CMakePackageConfigHelpers) -+ +configure_package_config_file( + ${CMAKE_CURRENT_SOURCE_DIR}/libmem-config.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake + INSTALL_DESTINATION share/libmem +) -+ +write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" -+ VERSION 5.0.2 ++ VERSION 5.0.4 + COMPATIBILITY SameMajorVersion +) -+ -+# Install the config and version files +install( + FILES + ${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake diff --git a/ports/libmem/portfile.cmake b/ports/libmem/portfile.cmake index adbec78ec4e6f0..7a52440242ec67 100644 --- a/ports/libmem/portfile.cmake +++ b/ports/libmem/portfile.cmake @@ -1,27 +1,19 @@ -vcpkg_download_distfile( - EXPORT_SURFACE_PATCH - URLS https://github.com/rdbo/libmem/commit/04830fb5a6dd6c81843c1b54bd61dac5bd202b9a.patch?full_index=1 - FILENAME libmem-export-surface-04830fb5a6dd6c81843c1b54bd61dac5bd202b9a.patch - SHA512 9060f86514f866a24a61b6cd51ee524f169b23781969b5f47f6fa5d2144369e7648658848fb2e00e9f0aed72119c4ab20842ba5afe9b0a485eea15ff63934596 -) - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO rdbo/libmem REF ${VERSION} - SHA512 d7c5a1a42d65a00ed3aa8ba8f6974650801d3436ae90e072fea29d4dcb32a3963e2610c89a16b87d94a9613c8f2f0e8deb83b673a1771a9cd1eb716a56106a16 + SHA512 a3245fedb0447133a674dc39b3f9dc0bce86cb8ed775cb50bc3b58ee410632653cfc340d17c2ca0a914e51ade9b62f393e23feb5f3d0459b1a1a8ce690a0d025 HEAD_REF master PATCHES 0001-CMakeLists.patch - "${EXPORT_SURFACE_PATCH}" ) -message(WARNING "Removing PreLoad.cmake") file(REMOVE "${SOURCE_PATH}/PreLoad.cmake") -file(MAKE_DIRECTORY "${SOURCE_PATH}/cmake") +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" LIBMEM_BUILD_STATIC) -file(COPY "${CMAKE_CURRENT_LIST_DIR}/libmem-config.cmake.in" +file( + COPY "${CMAKE_CURRENT_LIST_DIR}/libmem-config.cmake.in" DESTINATION "${SOURCE_PATH}" ) @@ -29,6 +21,7 @@ vcpkg_find_acquire_program(PKGCONFIG) vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS + "-DLIBMEM_BUILD_STATIC=${LIBMEM_BUILD_STATIC}" "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" ) @@ -40,5 +33,5 @@ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share" ) -file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") + vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/ports/libmem/usage b/ports/libmem/usage deleted file mode 100644 index 22603e3f3d66bf..00000000000000 --- a/ports/libmem/usage +++ /dev/null @@ -1,4 +0,0 @@ -libmem provides CMake targets: - - find_package(libmem CONFIG REQUIRED) - target_link_libraries(main PRIVATE libmem::libmem) diff --git a/ports/libmem/vcpkg.json b/ports/libmem/vcpkg.json index df91e053e9907a..9621210dfe2f40 100644 --- a/ports/libmem/vcpkg.json +++ b/ports/libmem/vcpkg.json @@ -1,6 +1,6 @@ { "name": "libmem", - "version": "5.0.2", + "version": "5.0.4", "description": "Advanced Game Hacking Library for C, Modern C++, Rust and Python (Windows/Linux/FreeBSD) (Process/Memory Hacking) (Hooking/Detouring) (Cross Platform) (x86/x64/ARM/ARM64) (DLL/SO Injection) (Internal/External) (Assembler/Disassembler)", "homepage": "https://github.com/rdbo/libmem", "license": "AGPL-3.0-only", diff --git a/versions/baseline.json b/versions/baseline.json index 4ec4b5390fc7f0..dab2337b9d8ff8 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4805,7 +4805,7 @@ "port-version": 0 }, "libmem": { - "baseline": "5.0.2", + "baseline": "5.0.4", "port-version": 0 }, "libmesh": { From 736f98b24fc6301de92524b0df3295fa958e8a44 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 09:13:28 +0300 Subject: [PATCH 02/71] new ver --- versions/l-/libmem.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/versions/l-/libmem.json b/versions/l-/libmem.json index 67231a44a04ff4..920000546127d2 100644 --- a/versions/l-/libmem.json +++ b/versions/l-/libmem.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "3bb519de5da1802145a4c93cf9a1aadcc4276b12", + "version": "5.0.4", + "port-version": 0 + }, { "git-tree": "f594eb800c0b265eaa3bc2d96c383bc16f851305", "version": "5.0.2", From f1248a52bb978036281fc6442cf5e0fcf73f7e7f Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 09:51:51 +0300 Subject: [PATCH 03/71] test port --- scripts/test_ports/vcpkg-ci-libmem/portfile.cmake | 10 ++++++++++ .../vcpkg-ci-libmem/project/CMakeLists.txt | 5 +++++ scripts/test_ports/vcpkg-ci-libmem/project/main.cpp | 9 +++++++++ scripts/test_ports/vcpkg-ci-libmem/vcpkg.json | 12 ++++++++++++ 4 files changed, 36 insertions(+) create mode 100644 scripts/test_ports/vcpkg-ci-libmem/portfile.cmake create mode 100644 scripts/test_ports/vcpkg-ci-libmem/project/CMakeLists.txt create mode 100644 scripts/test_ports/vcpkg-ci-libmem/project/main.cpp create mode 100644 scripts/test_ports/vcpkg-ci-libmem/vcpkg.json diff --git a/scripts/test_ports/vcpkg-ci-libmem/portfile.cmake b/scripts/test_ports/vcpkg-ci-libmem/portfile.cmake new file mode 100644 index 00000000000000..dd2570612035c8 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-libmem/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/scripts/test_ports/vcpkg-ci-libmem/project/CMakeLists.txt b/scripts/test_ports/vcpkg-ci-libmem/project/CMakeLists.txt new file mode 100644 index 00000000000000..951df2e99818c4 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-libmem/project/CMakeLists.txt @@ -0,0 +1,5 @@ +project(libmem-test LANGUAGES C CXX) +set(CMAKE_CXX_STANDARD 17) +find_package(libmem CONFIG REQUIRED) +add_executable(main main.cpp) +target_link_libraries(main PRIVATE libmem::libmem) \ No newline at end of file diff --git a/scripts/test_ports/vcpkg-ci-libmem/project/main.cpp b/scripts/test_ports/vcpkg-ci-libmem/project/main.cpp new file mode 100644 index 00000000000000..e0038c35563946 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-libmem/project/main.cpp @@ -0,0 +1,9 @@ +#include +#include + +int main() +{ + lm_module_t moduled; + LM_FindModule("user32.dll", &moduled); + return 0; +} diff --git a/scripts/test_ports/vcpkg-ci-libmem/vcpkg.json b/scripts/test_ports/vcpkg-ci-libmem/vcpkg.json new file mode 100644 index 00000000000000..d31a99d9009a3e --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-libmem/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "vcpkg-ci-libmem", + "version-string": "ci", + "description": "Validates libmem", + "dependencies": [ + "libmem", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} From ae4dd45040a0e9304f6e8c5581df6200eadd9272 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 10:05:20 +0300 Subject: [PATCH 04/71] fmt --- scripts/test_ports/vcpkg-ci-libmem/project/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/test_ports/vcpkg-ci-libmem/project/CMakeLists.txt b/scripts/test_ports/vcpkg-ci-libmem/project/CMakeLists.txt index 951df2e99818c4..b9f41476ac2d02 100644 --- a/scripts/test_ports/vcpkg-ci-libmem/project/CMakeLists.txt +++ b/scripts/test_ports/vcpkg-ci-libmem/project/CMakeLists.txt @@ -2,4 +2,4 @@ project(libmem-test LANGUAGES C CXX) set(CMAKE_CXX_STANDARD 17) find_package(libmem CONFIG REQUIRED) add_executable(main main.cpp) -target_link_libraries(main PRIVATE libmem::libmem) \ No newline at end of file +target_link_libraries(main PRIVATE libmem::libmem) From 2c945fb977a3fa7b83368281ddb0d5b2bf66070f Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 10:35:35 +0300 Subject: [PATCH 05/71] fmt --- scripts/test_ports/vcpkg-ci-libmem/project/main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/test_ports/vcpkg-ci-libmem/project/main.cpp b/scripts/test_ports/vcpkg-ci-libmem/project/main.cpp index e0038c35563946..ec4f8bfae4096d 100644 --- a/scripts/test_ports/vcpkg-ci-libmem/project/main.cpp +++ b/scripts/test_ports/vcpkg-ci-libmem/project/main.cpp @@ -1,4 +1,3 @@ -#include #include int main() From f1fd1a124e4543eed7363ffdeb04c299662560e8 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 10:41:28 +0300 Subject: [PATCH 06/71] fmt --- scripts/test_ports/vcpkg-ci-libmem/portfile.cmake | 5 ----- 1 file changed, 5 deletions(-) diff --git a/scripts/test_ports/vcpkg-ci-libmem/portfile.cmake b/scripts/test_ports/vcpkg-ci-libmem/portfile.cmake index dd2570612035c8..8a2079b2178d36 100644 --- a/scripts/test_ports/vcpkg-ci-libmem/portfile.cmake +++ b/scripts/test_ports/vcpkg-ci-libmem/portfile.cmake @@ -1,10 +1,5 @@ set(VCPKG_POLICY_EMPTY_PACKAGE enabled) - -vcpkg_find_acquire_program(PKGCONFIG) - vcpkg_cmake_configure( SOURCE_PATH "${CURRENT_PORT_DIR}/project" - OPTIONS - "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" ) vcpkg_cmake_build() From 448ea19fc07d98e3a6b44fbe417831d5243ebd41 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 10:41:46 +0300 Subject: [PATCH 07/71] fmt --- scripts/test_ports/vcpkg-ci-libmem/portfile.cmake | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/test_ports/vcpkg-ci-libmem/portfile.cmake b/scripts/test_ports/vcpkg-ci-libmem/portfile.cmake index 8a2079b2178d36..7d4d2ec18b23f1 100644 --- a/scripts/test_ports/vcpkg-ci-libmem/portfile.cmake +++ b/scripts/test_ports/vcpkg-ci-libmem/portfile.cmake @@ -1,5 +1,3 @@ set(VCPKG_POLICY_EMPTY_PACKAGE enabled) -vcpkg_cmake_configure( - SOURCE_PATH "${CURRENT_PORT_DIR}/project" -) +vcpkg_cmake_configure(SOURCE_PATH "${CURRENT_PORT_DIR}/project") vcpkg_cmake_build() From b2c9c946a58a9ad2da080e88f6133ee4098da310 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 11:45:46 +0300 Subject: [PATCH 08/71] fmt --- ports/libmem/0001-CMakeLists.patch | 29 +++++++++---------- ports/libmem/portfile.cmake | 9 ------ .../vcpkg-ci-libmem/project/main.cpp | 1 - 3 files changed, 14 insertions(+), 25 deletions(-) diff --git a/ports/libmem/0001-CMakeLists.patch b/ports/libmem/0001-CMakeLists.patch index b2e90185fd5f5a..e672bd1c84881d 100644 --- a/ports/libmem/0001-CMakeLists.patch +++ b/ports/libmem/0001-CMakeLists.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 534057a..a4b8080 100644 +index 534057a..5e5e39e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ @@ -28,7 +28,7 @@ index 534057a..a4b8080 100644 set(LIBMEM_DIR "${PROJECT_SOURCE_DIR}") set(LIBMEM_INC "${LIBMEM_DIR}/include") set(INTERNAL_DIR "${LIBMEM_DIR}/internal") -@@ -89,16 +89,18 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD) +@@ -89,24 +89,23 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD) endif() file(GLOB LIBMEM_SRC ${LIBMEM_ARCH_SRC} "${LIBMEM_DIR}/src/freebsd/*.c" "${LIBMEM_DIR}/src/freebsd/ptrace/*.c" "${LIBMEM_DIR}/src/common/*.c" "${LIBMEM_DIR}/src/common/*.cpp" "${INTERNAL_DIR}/posixutils/*.c" "${INTERNAL_DIR}/elfutils/*.c" "${INTERNAL_DIR}/demangler/*.cpp") endif() @@ -42,18 +42,17 @@ index 534057a..a4b8080 100644 + capstone::capstone + ${keystone_LINK_LIBRARIES} ) -- +file(GLOB_RECURSE LLVM_DEM_SRC "${LIBMEM_DIR}/external/llvm/lib/*.cpp") - if (LIBMEM_BUILD_STATIC) + +-if (LIBMEM_BUILD_STATIC) - add_library(libmem STATIC ${LIBMEM_SRC}) -+ add_library(libmem STATIC ${LIBMEM_SRC} ${LLVM_DEM_SRC}) - else() +-else() - add_library(libmem SHARED ${LIBMEM_SRC}) -+ add_library(libmem SHARED ${LIBMEM_SRC} ${LLVM_DEM_SRC}) - endif() +-endif() ++add_library(libmem ${LIBMEM_SRC} ${LLVM_DEM_SRC}) target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}") -@@ -106,7 +108,7 @@ include_directories(${PROJECT_SOURCE_DIR} + include_directories(${PROJECT_SOURCE_DIR} ${LIBMEM_INC} ${CAPSTONE_INC} ${KEYSTONE_INC} @@ -62,7 +61,7 @@ index 534057a..a4b8080 100644 ) if (LIBMEM_BUILD_TESTS) -@@ -116,10 +118,6 @@ endif() +@@ -116,10 +115,6 @@ endif() set_target_properties(libmem PROPERTIES POSITION_INDEPENDENT_CODE True INCLUDES ${LIBMEM_INC}) target_compile_definitions(libmem PUBLIC LM_EXPORT) @@ -73,7 +72,7 @@ index 534057a..a4b8080 100644 if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) set(LIBMEM_DEPS -@@ -152,7 +150,7 @@ else() +@@ -152,7 +147,7 @@ else() endif() target_link_libraries(libmem ${LIBMEM_DEPS}) @@ -82,7 +81,7 @@ index 534057a..a4b8080 100644 # Create a bundled static library containing all dependencies (to mimic the shared library behavior) set_target_properties(libmem PROPERTIES OUTPUT_NAME "libmem_partial") set(libmem_bundle_files "$") -@@ -193,7 +191,7 @@ if(LIBMEM_BUILD_STATIC) +@@ -193,7 +188,7 @@ if(LIBMEM_BUILD_STATIC) endif() endif() @@ -91,7 +90,7 @@ index 534057a..a4b8080 100644 if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) cmake_path(SET CMAKE_INSTALL_PREFIX "$ENV{ProgramFiles}") else() -@@ -202,14 +200,39 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN +@@ -202,14 +197,39 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN endif() set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/libmem") execute_process(COMMAND mkdir "${CMAKE_INSTALL_PREFIX}") @@ -114,8 +113,8 @@ index 534057a..a4b8080 100644 install(DIRECTORY ${LIBMEM_INC}/libmem DESTINATION include) +install( -+ EXPORT libmem-target -+ NAMESPACE libmem:: ++ EXPORT libmem-target ++ NAMESPACE libmem:: + FILE libmem-target.cmake + DESTINATION share/libmem +) diff --git a/ports/libmem/portfile.cmake b/ports/libmem/portfile.cmake index 7a52440242ec67..2908951b8471ae 100644 --- a/ports/libmem/portfile.cmake +++ b/ports/libmem/portfile.cmake @@ -7,31 +7,22 @@ vcpkg_from_github( PATCHES 0001-CMakeLists.patch ) - file(REMOVE "${SOURCE_PATH}/PreLoad.cmake") - -string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" LIBMEM_BUILD_STATIC) - file( COPY "${CMAKE_CURRENT_LIST_DIR}/libmem-config.cmake.in" DESTINATION "${SOURCE_PATH}" ) - vcpkg_find_acquire_program(PKGCONFIG) vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS - "-DLIBMEM_BUILD_STATIC=${LIBMEM_BUILD_STATIC}" "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" ) - vcpkg_cmake_install() vcpkg_cmake_config_fixup() vcpkg_copy_pdbs() - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share" ) - vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/scripts/test_ports/vcpkg-ci-libmem/project/main.cpp b/scripts/test_ports/vcpkg-ci-libmem/project/main.cpp index ec4f8bfae4096d..359074167bfb28 100644 --- a/scripts/test_ports/vcpkg-ci-libmem/project/main.cpp +++ b/scripts/test_ports/vcpkg-ci-libmem/project/main.cpp @@ -1,5 +1,4 @@ #include - int main() { lm_module_t moduled; From e707698515f39eae7364171461dc14f4c57333d9 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 11:46:38 +0300 Subject: [PATCH 09/71] fmt --- ports/libmem/portfile.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/libmem/portfile.cmake b/ports/libmem/portfile.cmake index 2908951b8471ae..c1ec1d45d01e81 100644 --- a/ports/libmem/portfile.cmake +++ b/ports/libmem/portfile.cmake @@ -9,7 +9,7 @@ vcpkg_from_github( ) file(REMOVE "${SOURCE_PATH}/PreLoad.cmake") file( - COPY "${CMAKE_CURRENT_LIST_DIR}/libmem-config.cmake.in" + COPY "${CMAKE_CURRENT_LIST_DIR}/libmem-config.cmake.in" DESTINATION "${SOURCE_PATH}" ) vcpkg_find_acquire_program(PKGCONFIG) From 160b4c3bec414426cb6e575ca29bf33b4bbfa3e4 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 11:48:56 +0300 Subject: [PATCH 10/71] ver --- versions/l-/libmem.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/libmem.json b/versions/l-/libmem.json index 920000546127d2..80f3b1b8d8f26a 100644 --- a/versions/l-/libmem.json +++ b/versions/l-/libmem.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "3bb519de5da1802145a4c93cf9a1aadcc4276b12", + "git-tree": "82242105d21b9b483f7d574d8b10c801b7a827e4", "version": "5.0.4", "port-version": 0 }, From e8a4d590937bf0da632005393b7dcb19cacb92d0 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 12:07:20 +0300 Subject: [PATCH 11/71] fmt --- ports/libmem/portfile.cmake | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ports/libmem/portfile.cmake b/ports/libmem/portfile.cmake index c1ec1d45d01e81..9a6b2c5796c571 100644 --- a/ports/libmem/portfile.cmake +++ b/ports/libmem/portfile.cmake @@ -8,10 +8,7 @@ vcpkg_from_github( 0001-CMakeLists.patch ) file(REMOVE "${SOURCE_PATH}/PreLoad.cmake") -file( - COPY "${CMAKE_CURRENT_LIST_DIR}/libmem-config.cmake.in" - DESTINATION "${SOURCE_PATH}" -) +file(COPY "${CMAKE_CURRENT_LIST_DIR}/libmem-config.cmake.in" DESTINATION "${SOURCE_PATH}") vcpkg_find_acquire_program(PKGCONFIG) vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" From 68c26b1a83761c1cdafa1c9ef092260f9bf4e96f Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 12:07:46 +0300 Subject: [PATCH 12/71] ver --- versions/l-/libmem.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/libmem.json b/versions/l-/libmem.json index 80f3b1b8d8f26a..1e5addaa549e51 100644 --- a/versions/l-/libmem.json +++ b/versions/l-/libmem.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "82242105d21b9b483f7d574d8b10c801b7a827e4", + "git-tree": "328fead6bfdc7cbd6712a64d15efa7486704eed8", "version": "5.0.4", "port-version": 0 }, From fa83b23f9f15dd8dd71db0612bd163e3302c6065 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 12:08:47 +0300 Subject: [PATCH 13/71] fmt --- ports/libmem/portfile.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/libmem/portfile.cmake b/ports/libmem/portfile.cmake index 9a6b2c5796c571..ab647854714740 100644 --- a/ports/libmem/portfile.cmake +++ b/ports/libmem/portfile.cmake @@ -1,7 +1,7 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO rdbo/libmem - REF ${VERSION} + REF "${VERSION}" SHA512 a3245fedb0447133a674dc39b3f9dc0bce86cb8ed775cb50bc3b58ee410632653cfc340d17c2ca0a914e51ade9b62f393e23feb5f3d0459b1a1a8ce690a0d025 HEAD_REF master PATCHES From 8c348ae1bf4df79d00a29711c7cc33dbaaf1691a Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 12:09:09 +0300 Subject: [PATCH 14/71] ver --- versions/l-/libmem.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/libmem.json b/versions/l-/libmem.json index 1e5addaa549e51..388c1507ad01dc 100644 --- a/versions/l-/libmem.json +++ b/versions/l-/libmem.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "328fead6bfdc7cbd6712a64d15efa7486704eed8", + "git-tree": "13e44be714b15e48ee4a71f5da5fed5e4edc24e7", "version": "5.0.4", "port-version": 0 }, From e4e98ae60f08a80151382eccf142352fde550e8d Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 12:10:43 +0300 Subject: [PATCH 15/71] fmt --- ports/libmem/portfile.cmake | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ports/libmem/portfile.cmake b/ports/libmem/portfile.cmake index ab647854714740..65c58dd5396a57 100644 --- a/ports/libmem/portfile.cmake +++ b/ports/libmem/portfile.cmake @@ -18,8 +18,5 @@ vcpkg_cmake_configure( vcpkg_cmake_install() vcpkg_cmake_config_fixup() vcpkg_copy_pdbs() -file(REMOVE_RECURSE - "${CURRENT_PACKAGES_DIR}/debug/include" - "${CURRENT_PACKAGES_DIR}/debug/share" -) +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share") vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") From 92587417420285f563ddde2336b50ab67c434dbb Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 12:11:04 +0300 Subject: [PATCH 16/71] ver --- versions/l-/libmem.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/libmem.json b/versions/l-/libmem.json index 388c1507ad01dc..f746fec59a77b4 100644 --- a/versions/l-/libmem.json +++ b/versions/l-/libmem.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "13e44be714b15e48ee4a71f5da5fed5e4edc24e7", + "git-tree": "82f4bc39a65cbc04c2813f0cc478a606628acff2", "version": "5.0.4", "port-version": 0 }, From 4f70f94604821b49eed4b7be98bda046f6d09cce Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 12:14:05 +0300 Subject: [PATCH 17/71] fix --- ports/libmem/vcpkg.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ports/libmem/vcpkg.json b/ports/libmem/vcpkg.json index 9621210dfe2f40..a47c1f0e7ba5c9 100644 --- a/ports/libmem/vcpkg.json +++ b/ports/libmem/vcpkg.json @@ -16,10 +16,6 @@ "name": "vcpkg-cmake-config", "host": true }, - { - "name": "vcpkg-cmake-get-vars", - "host": true - }, { "name": "vcpkg-pkgconfig-get-modules", "host": true From 65b6213e67c854e7bd93b54695ce73f2cf3b993c Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 12:14:23 +0300 Subject: [PATCH 18/71] ver --- versions/l-/libmem.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/libmem.json b/versions/l-/libmem.json index f746fec59a77b4..bdc90b3e8f23ea 100644 --- a/versions/l-/libmem.json +++ b/versions/l-/libmem.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "82f4bc39a65cbc04c2813f0cc478a606628acff2", + "git-tree": "d0bfa8cc07b017da9d982b1d22a8aeee9179694f", "version": "5.0.4", "port-version": 0 }, From 3e9dd782124dbe839b785c6b2660503dcca51c2e Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 12:58:34 +0300 Subject: [PATCH 19/71] check supports --- ports/libmem/vcpkg.json | 1 - 1 file changed, 1 deletion(-) diff --git a/ports/libmem/vcpkg.json b/ports/libmem/vcpkg.json index a47c1f0e7ba5c9..32249719d66192 100644 --- a/ports/libmem/vcpkg.json +++ b/ports/libmem/vcpkg.json @@ -4,7 +4,6 @@ "description": "Advanced Game Hacking Library for C, Modern C++, Rust and Python (Windows/Linux/FreeBSD) (Process/Memory Hacking) (Hooking/Detouring) (Cross Platform) (x86/x64/ARM/ARM64) (DLL/SO Injection) (Internal/External) (Assembler/Disassembler)", "homepage": "https://github.com/rdbo/libmem", "license": "AGPL-3.0-only", - "supports": "!uwp & !xbox & !osx & !arm & !android & !ios", "dependencies": [ "capstone", "keystone", From 9797f74553e2c415df7ea591fffdb2a49427557b Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 12:58:55 +0300 Subject: [PATCH 20/71] ver --- versions/l-/libmem.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/libmem.json b/versions/l-/libmem.json index bdc90b3e8f23ea..d9f1ff5a26f613 100644 --- a/versions/l-/libmem.json +++ b/versions/l-/libmem.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "d0bfa8cc07b017da9d982b1d22a8aeee9179694f", + "git-tree": "371dc4ebde0eb88a915108468375404c5707d9f3", "version": "5.0.4", "port-version": 0 }, From 3739797809d1d83e9c885f3c2f8daf7cbfab29d2 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 13:10:52 +0300 Subject: [PATCH 21/71] finish up --- ports/libmem/vcpkg.json | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/libmem/vcpkg.json b/ports/libmem/vcpkg.json index 32249719d66192..fc347fc244d527 100644 --- a/ports/libmem/vcpkg.json +++ b/ports/libmem/vcpkg.json @@ -4,6 +4,7 @@ "description": "Advanced Game Hacking Library for C, Modern C++, Rust and Python (Windows/Linux/FreeBSD) (Process/Memory Hacking) (Hooking/Detouring) (Cross Platform) (x86/x64/ARM/ARM64) (DLL/SO Injection) (Internal/External) (Assembler/Disassembler)", "homepage": "https://github.com/rdbo/libmem", "license": "AGPL-3.0-only", + "supports": "windows | uwp | (linux | freebsd) & (x86 | x64)", "dependencies": [ "capstone", "keystone", From 8bb2ff41db1aacc40ace606e4c4f89614a5c5752 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 13:11:50 +0300 Subject: [PATCH 22/71] fixup --- ports/libmem/vcpkg.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/libmem/vcpkg.json b/ports/libmem/vcpkg.json index fc347fc244d527..ee7c74412b30c8 100644 --- a/ports/libmem/vcpkg.json +++ b/ports/libmem/vcpkg.json @@ -4,7 +4,7 @@ "description": "Advanced Game Hacking Library for C, Modern C++, Rust and Python (Windows/Linux/FreeBSD) (Process/Memory Hacking) (Hooking/Detouring) (Cross Platform) (x86/x64/ARM/ARM64) (DLL/SO Injection) (Internal/External) (Assembler/Disassembler)", "homepage": "https://github.com/rdbo/libmem", "license": "AGPL-3.0-only", - "supports": "windows | uwp | (linux | freebsd) & (x86 | x64)", + "supports": "windows | uwp | ((linux | freebsd) & (x86 | x64))", "dependencies": [ "capstone", "keystone", From fdb74a024900e88372a23a802033b79c4d4103af Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 13:12:08 +0300 Subject: [PATCH 23/71] ver --- versions/l-/libmem.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/libmem.json b/versions/l-/libmem.json index d9f1ff5a26f613..42229f81f1b8f1 100644 --- a/versions/l-/libmem.json +++ b/versions/l-/libmem.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "371dc4ebde0eb88a915108468375404c5707d9f3", + "git-tree": "95a7f6eec2adffbafc93489cd0d1dab02ea6166d", "version": "5.0.4", "port-version": 0 }, From 5d2315968f9580f4e84df025cb4f9ed667b849c1 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 17:54:13 +0300 Subject: [PATCH 24/71] fixup --- ports/libmem/0001-CMakeLists.patch | 271 ++++++++++++++--------------- ports/libmem/vcpkg.json | 2 +- 2 files changed, 135 insertions(+), 138 deletions(-) diff --git a/ports/libmem/0001-CMakeLists.patch b/ports/libmem/0001-CMakeLists.patch index e672bd1c84881d..cd39c9b3804b73 100644 --- a/ports/libmem/0001-CMakeLists.patch +++ b/ports/libmem/0001-CMakeLists.patch @@ -1,137 +1,134 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 534057a..5e5e39e 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1,6 +1,6 @@ - cmake_minimum_required(VERSION 3.22.1) - --include(ExternalProject) -+set(CMAKE_CXX_STANDARD 17) - - project(libmem - LANGUAGES -@@ -48,7 +48,7 @@ message(STATUS - - message(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}") - message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") -- -+if(0) - # External dependencies - set(EXTERNAL_DEPENDENCIES_DIR "${PROJECT_SOURCE_DIR}/external") - set(CAPSTONE_DIR "${EXTERNAL_DEPENDENCIES_DIR}/capstone") -@@ -66,7 +66,7 @@ set_target_properties(capstone PROPERTIES IMPORTED_LOCATION ${CAPSTONE_IMPORT_DI - add_library(keystone STATIC IMPORTED) - set_target_properties(keystone PROPERTIES IMPORTED_LOCATION ${KEYSTONE_IMPORT_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}keystone${CMAKE_STATIC_LIBRARY_SUFFIX}) - # End of external dependencies -- -+endif() - set(LIBMEM_DIR "${PROJECT_SOURCE_DIR}") - set(LIBMEM_INC "${LIBMEM_DIR}/include") - set(INTERNAL_DIR "${LIBMEM_DIR}/internal") -@@ -89,24 +89,23 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD) - endif() - file(GLOB LIBMEM_SRC ${LIBMEM_ARCH_SRC} "${LIBMEM_DIR}/src/freebsd/*.c" "${LIBMEM_DIR}/src/freebsd/ptrace/*.c" "${LIBMEM_DIR}/src/common/*.c" "${LIBMEM_DIR}/src/common/*.cpp" "${INTERNAL_DIR}/posixutils/*.c" "${INTERNAL_DIR}/elfutils/*.c" "${INTERNAL_DIR}/demangler/*.cpp") - endif() -+find_package(PkgConfig) -+pkg_check_modules(keystone REQUIRED keystone) -+find_package(capstone CONFIG REQUIRED) - set(LIBMEM_DEPS -- capstone -- keystone -- llvm -+ capstone::capstone -+ ${keystone_LINK_LIBRARIES} - ) -+file(GLOB_RECURSE LLVM_DEM_SRC "${LIBMEM_DIR}/external/llvm/lib/*.cpp") - --if (LIBMEM_BUILD_STATIC) -- add_library(libmem STATIC ${LIBMEM_SRC}) --else() -- add_library(libmem SHARED ${LIBMEM_SRC}) --endif() -+add_library(libmem ${LIBMEM_SRC} ${LLVM_DEM_SRC}) - target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}") - - include_directories(${PROJECT_SOURCE_DIR} - ${LIBMEM_INC} - ${CAPSTONE_INC} - ${KEYSTONE_INC} -- ${LLVM_INC} -+ ${LIBMEM_DIR}/external/llvm/include - ) - - if (LIBMEM_BUILD_TESTS) -@@ -116,10 +115,6 @@ endif() - - set_target_properties(libmem PROPERTIES POSITION_INDEPENDENT_CODE True INCLUDES ${LIBMEM_INC}) - target_compile_definitions(libmem PUBLIC LM_EXPORT) --add_dependencies(libmem -- capstone-engine -- keystone-engine --) - - if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) - set(LIBMEM_DEPS -@@ -152,7 +147,7 @@ else() - endif() - - target_link_libraries(libmem ${LIBMEM_DEPS}) --if(LIBMEM_BUILD_STATIC) -+if(0) - # Create a bundled static library containing all dependencies (to mimic the shared library behavior) - set_target_properties(libmem PROPERTIES OUTPUT_NAME "libmem_partial") - set(libmem_bundle_files "$") -@@ -193,7 +188,7 @@ if(LIBMEM_BUILD_STATIC) - endif() - endif() - --if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) -+if(0) - if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) - cmake_path(SET CMAKE_INSTALL_PREFIX "$ENV{ProgramFiles}") - else() -@@ -202,14 +197,39 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN - endif() - set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/libmem") - execute_process(COMMAND mkdir "${CMAKE_INSTALL_PREFIX}") --else() -+ - set(CMAKE_INSTALL_PREFIX "/usr") - endif() - - install(TARGETS libmem -- LIBRARY DESTINATION lib) -- --install(TARGETS libmem -- RUNTIME DESTINATION lib) -+ EXPORT libmem-target -+ LIBRARY DESTINATION lib -+ ARCHIVE DESTINATION lib -+ PUBLIC_HEADER DESTINATION include/libmem -+ RUNTIME DESTINATION bin -+) - - install(DIRECTORY ${LIBMEM_INC}/libmem DESTINATION include) -+install( -+ EXPORT libmem-target -+ NAMESPACE libmem:: -+ FILE libmem-target.cmake -+ DESTINATION share/libmem -+) -+include(CMakePackageConfigHelpers) -+configure_package_config_file( -+ ${CMAKE_CURRENT_SOURCE_DIR}/libmem-config.cmake.in -+ ${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake -+ INSTALL_DESTINATION share/libmem -+) -+write_basic_package_version_file( -+ "${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" -+ VERSION 5.0.4 -+ COMPATIBILITY SameMajorVersion -+) -+install( -+ FILES -+ ${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake -+ ${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake -+ DESTINATION share/libmem -+) +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 534057a..6aa1755 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,6 +1,6 @@ + cmake_minimum_required(VERSION 3.22.1) + +-include(ExternalProject) ++set(CMAKE_CXX_STANDARD 17) + + project(libmem + LANGUAGES +@@ -49,6 +49,7 @@ message(STATUS + message(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}") + message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") + ++if(0) + # External dependencies + set(EXTERNAL_DEPENDENCIES_DIR "${PROJECT_SOURCE_DIR}/external") + set(CAPSTONE_DIR "${EXTERNAL_DEPENDENCIES_DIR}/capstone") +@@ -67,6 +68,7 @@ add_library(keystone STATIC IMPORTED) + set_target_properties(keystone PROPERTIES IMPORTED_LOCATION ${KEYSTONE_IMPORT_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}keystone${CMAKE_STATIC_LIBRARY_SUFFIX}) + # End of external dependencies + ++endif() + set(LIBMEM_DIR "${PROJECT_SOURCE_DIR}") + set(LIBMEM_INC "${LIBMEM_DIR}/include") + set(INTERNAL_DIR "${LIBMEM_DIR}/internal") +@@ -89,24 +91,23 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD) + endif() + file(GLOB LIBMEM_SRC ${LIBMEM_ARCH_SRC} "${LIBMEM_DIR}/src/freebsd/*.c" "${LIBMEM_DIR}/src/freebsd/ptrace/*.c" "${LIBMEM_DIR}/src/common/*.c" "${LIBMEM_DIR}/src/common/*.cpp" "${INTERNAL_DIR}/posixutils/*.c" "${INTERNAL_DIR}/elfutils/*.c" "${INTERNAL_DIR}/demangler/*.cpp") + endif() ++find_package(PkgConfig) ++pkg_check_modules(keystone REQUIRED keystone) ++find_package(capstone CONFIG REQUIRED) + set(LIBMEM_DEPS +- capstone +- keystone +- llvm ++ capstone::capstone ++ ${keystone_LINK_LIBRARIES} + ) ++file(GLOB_RECURSE LLVM_DEM_SRC "${LIBMEM_DIR}/external/llvm/lib/*.cpp") + +-if (LIBMEM_BUILD_STATIC) +- add_library(libmem STATIC ${LIBMEM_SRC}) +-else() +- add_library(libmem SHARED ${LIBMEM_SRC}) +-endif() ++add_library(libmem ${LIBMEM_SRC} ${LLVM_DEM_SRC}) + target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}") + + include_directories(${PROJECT_SOURCE_DIR} + ${LIBMEM_INC} + ${CAPSTONE_INC} + ${KEYSTONE_INC} +- ${LLVM_INC} ++ ${LIBMEM_DIR}/external/llvm/include + ) + + if (LIBMEM_BUILD_TESTS) +@@ -116,10 +117,6 @@ endif() + + set_target_properties(libmem PROPERTIES POSITION_INDEPENDENT_CODE True INCLUDES ${LIBMEM_INC}) + target_compile_definitions(libmem PUBLIC LM_EXPORT) +-add_dependencies(libmem +- capstone-engine +- keystone-engine +-) + + if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) + set(LIBMEM_DEPS +@@ -152,7 +149,7 @@ else() + endif() + + target_link_libraries(libmem ${LIBMEM_DEPS}) +-if(LIBMEM_BUILD_STATIC) ++if(0) + # Create a bundled static library containing all dependencies (to mimic the shared library behavior) + set_target_properties(libmem PROPERTIES OUTPUT_NAME "libmem_partial") + set(libmem_bundle_files "$") +@@ -193,7 +190,7 @@ if(LIBMEM_BUILD_STATIC) + endif() + endif() + +-if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) ++if(0) + if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) + cmake_path(SET CMAKE_INSTALL_PREFIX "$ENV{ProgramFiles}") + else() +@@ -202,14 +199,38 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN + endif() + set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/libmem") + execute_process(COMMAND mkdir "${CMAKE_INSTALL_PREFIX}") +-else() + set(CMAKE_INSTALL_PREFIX "/usr") + endif() + + install(TARGETS libmem +- LIBRARY DESTINATION lib) +- +-install(TARGETS libmem +- RUNTIME DESTINATION lib) ++ EXPORT libmem-target ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib ++ PUBLIC_HEADER DESTINATION include/libmem ++ RUNTIME DESTINATION bin ++) + + install(DIRECTORY ${LIBMEM_INC}/libmem DESTINATION include) ++install( ++ EXPORT libmem-target ++ NAMESPACE libmem:: ++ FILE libmem-target.cmake ++ DESTINATION share/libmem ++) ++include(CMakePackageConfigHelpers) ++configure_package_config_file( ++ ${CMAKE_CURRENT_SOURCE_DIR}/libmem-config.cmake.in ++ ${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake ++ INSTALL_DESTINATION share/libmem ++) ++write_basic_package_version_file( ++ "${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" ++ VERSION 5.0.4 ++ COMPATIBILITY SameMajorVersion ++) ++install( ++ FILES ++ ${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake ++ ${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake ++ DESTINATION share/libmem ++) diff --git a/ports/libmem/vcpkg.json b/ports/libmem/vcpkg.json index ee7c74412b30c8..7e7542a1099708 100644 --- a/ports/libmem/vcpkg.json +++ b/ports/libmem/vcpkg.json @@ -4,7 +4,7 @@ "description": "Advanced Game Hacking Library for C, Modern C++, Rust and Python (Windows/Linux/FreeBSD) (Process/Memory Hacking) (Hooking/Detouring) (Cross Platform) (x86/x64/ARM/ARM64) (DLL/SO Injection) (Internal/External) (Assembler/Disassembler)", "homepage": "https://github.com/rdbo/libmem", "license": "AGPL-3.0-only", - "supports": "windows | uwp | ((linux | freebsd) & (x86 | x64))", + "supports": "windows | ((linux | freebsd) & (x86 | x64))", "dependencies": [ "capstone", "keystone", From 216e6ab839828b11444fff3bc73d253a227b1d83 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 17:54:28 +0300 Subject: [PATCH 25/71] ver --- versions/l-/libmem.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/libmem.json b/versions/l-/libmem.json index 42229f81f1b8f1..c390621e15ef95 100644 --- a/versions/l-/libmem.json +++ b/versions/l-/libmem.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "95a7f6eec2adffbafc93489cd0d1dab02ea6166d", + "git-tree": "0c73c9d6c29ce2ad906ee747cae63b2c96cf3839", "version": "5.0.4", "port-version": 0 }, From b39af749294adb805b6010fd68f37507b73552e3 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 17:59:48 +0300 Subject: [PATCH 26/71] clean --- ports/libmem/0001-CMakeLists.patch | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ports/libmem/0001-CMakeLists.patch b/ports/libmem/0001-CMakeLists.patch index cd39c9b3804b73..b025ae7b7d55e3 100644 --- a/ports/libmem/0001-CMakeLists.patch +++ b/ports/libmem/0001-CMakeLists.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 534057a..6aa1755 100644 +index 534057a..ac85e7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ @@ -101,8 +101,8 @@ index 534057a..6aa1755 100644 - -install(TARGETS libmem - RUNTIME DESTINATION lib) -+ EXPORT libmem-target + LIBRARY DESTINATION lib ++ EXPORT libmem-target + ARCHIVE DESTINATION lib + PUBLIC_HEADER DESTINATION include/libmem + RUNTIME DESTINATION bin @@ -117,8 +117,8 @@ index 534057a..6aa1755 100644 +) +include(CMakePackageConfigHelpers) +configure_package_config_file( -+ ${CMAKE_CURRENT_SOURCE_DIR}/libmem-config.cmake.in -+ ${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake ++ "${CMAKE_CURRENT_SOURCE_DIR}/libmem-config.cmake.in" ++ "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" + INSTALL_DESTINATION share/libmem +) +write_basic_package_version_file( @@ -128,7 +128,7 @@ index 534057a..6aa1755 100644 +) +install( + FILES -+ ${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake -+ ${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake ++ "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" ++ "${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" + DESTINATION share/libmem +) From e5e936b8e0c3a1066bc249941a8df6c73babed3a Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 18:00:05 +0300 Subject: [PATCH 27/71] ver --- versions/l-/libmem.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/libmem.json b/versions/l-/libmem.json index c390621e15ef95..159934a4fb0e64 100644 --- a/versions/l-/libmem.json +++ b/versions/l-/libmem.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "0c73c9d6c29ce2ad906ee747cae63b2c96cf3839", + "git-tree": "78a5d261a824bd763742bd2e9317be946c9f9af6", "version": "5.0.4", "port-version": 0 }, From 7c5193677c4c0316283cec324239215672b69767 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 18:36:12 +0300 Subject: [PATCH 28/71] test --- ports/libmem/0001-CMakeLists.patch | 249 +++++++++++++---------------- 1 file changed, 115 insertions(+), 134 deletions(-) diff --git a/ports/libmem/0001-CMakeLists.patch b/ports/libmem/0001-CMakeLists.patch index b025ae7b7d55e3..4ca77ca2fcc675 100644 --- a/ports/libmem/0001-CMakeLists.patch +++ b/ports/libmem/0001-CMakeLists.patch @@ -1,134 +1,115 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 534057a..ac85e7b 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1,6 +1,6 @@ - cmake_minimum_required(VERSION 3.22.1) - --include(ExternalProject) -+set(CMAKE_CXX_STANDARD 17) - - project(libmem - LANGUAGES -@@ -49,6 +49,7 @@ message(STATUS - message(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}") - message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") - -+if(0) - # External dependencies - set(EXTERNAL_DEPENDENCIES_DIR "${PROJECT_SOURCE_DIR}/external") - set(CAPSTONE_DIR "${EXTERNAL_DEPENDENCIES_DIR}/capstone") -@@ -67,6 +68,7 @@ add_library(keystone STATIC IMPORTED) - set_target_properties(keystone PROPERTIES IMPORTED_LOCATION ${KEYSTONE_IMPORT_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}keystone${CMAKE_STATIC_LIBRARY_SUFFIX}) - # End of external dependencies - -+endif() - set(LIBMEM_DIR "${PROJECT_SOURCE_DIR}") - set(LIBMEM_INC "${LIBMEM_DIR}/include") - set(INTERNAL_DIR "${LIBMEM_DIR}/internal") -@@ -89,24 +91,23 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD) - endif() - file(GLOB LIBMEM_SRC ${LIBMEM_ARCH_SRC} "${LIBMEM_DIR}/src/freebsd/*.c" "${LIBMEM_DIR}/src/freebsd/ptrace/*.c" "${LIBMEM_DIR}/src/common/*.c" "${LIBMEM_DIR}/src/common/*.cpp" "${INTERNAL_DIR}/posixutils/*.c" "${INTERNAL_DIR}/elfutils/*.c" "${INTERNAL_DIR}/demangler/*.cpp") - endif() -+find_package(PkgConfig) -+pkg_check_modules(keystone REQUIRED keystone) -+find_package(capstone CONFIG REQUIRED) - set(LIBMEM_DEPS -- capstone -- keystone -- llvm -+ capstone::capstone -+ ${keystone_LINK_LIBRARIES} - ) -+file(GLOB_RECURSE LLVM_DEM_SRC "${LIBMEM_DIR}/external/llvm/lib/*.cpp") - --if (LIBMEM_BUILD_STATIC) -- add_library(libmem STATIC ${LIBMEM_SRC}) --else() -- add_library(libmem SHARED ${LIBMEM_SRC}) --endif() -+add_library(libmem ${LIBMEM_SRC} ${LLVM_DEM_SRC}) - target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}") - - include_directories(${PROJECT_SOURCE_DIR} - ${LIBMEM_INC} - ${CAPSTONE_INC} - ${KEYSTONE_INC} -- ${LLVM_INC} -+ ${LIBMEM_DIR}/external/llvm/include - ) - - if (LIBMEM_BUILD_TESTS) -@@ -116,10 +117,6 @@ endif() - - set_target_properties(libmem PROPERTIES POSITION_INDEPENDENT_CODE True INCLUDES ${LIBMEM_INC}) - target_compile_definitions(libmem PUBLIC LM_EXPORT) --add_dependencies(libmem -- capstone-engine -- keystone-engine --) - - if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) - set(LIBMEM_DEPS -@@ -152,7 +149,7 @@ else() - endif() - - target_link_libraries(libmem ${LIBMEM_DEPS}) --if(LIBMEM_BUILD_STATIC) -+if(0) - # Create a bundled static library containing all dependencies (to mimic the shared library behavior) - set_target_properties(libmem PROPERTIES OUTPUT_NAME "libmem_partial") - set(libmem_bundle_files "$") -@@ -193,7 +190,7 @@ if(LIBMEM_BUILD_STATIC) - endif() - endif() - --if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) -+if(0) - if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) - cmake_path(SET CMAKE_INSTALL_PREFIX "$ENV{ProgramFiles}") - else() -@@ -202,14 +199,38 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN - endif() - set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/libmem") - execute_process(COMMAND mkdir "${CMAKE_INSTALL_PREFIX}") --else() - set(CMAKE_INSTALL_PREFIX "/usr") - endif() - - install(TARGETS libmem -- LIBRARY DESTINATION lib) -- --install(TARGETS libmem -- RUNTIME DESTINATION lib) -+ LIBRARY DESTINATION lib -+ EXPORT libmem-target -+ ARCHIVE DESTINATION lib -+ PUBLIC_HEADER DESTINATION include/libmem -+ RUNTIME DESTINATION bin -+) - - install(DIRECTORY ${LIBMEM_INC}/libmem DESTINATION include) -+install( -+ EXPORT libmem-target -+ NAMESPACE libmem:: -+ FILE libmem-target.cmake -+ DESTINATION share/libmem -+) -+include(CMakePackageConfigHelpers) -+configure_package_config_file( -+ "${CMAKE_CURRENT_SOURCE_DIR}/libmem-config.cmake.in" -+ "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" -+ INSTALL_DESTINATION share/libmem -+) -+write_basic_package_version_file( -+ "${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" -+ VERSION 5.0.4 -+ COMPATIBILITY SameMajorVersion -+) -+install( -+ FILES -+ "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" -+ "${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" -+ DESTINATION share/libmem -+) +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 534057a..dd01de4 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,6 +1,10 @@ + cmake_minimum_required(VERSION 3.22.1) + +-include(ExternalProject) ++set(CMAKE_CXX_STANDARD 17) ++file(GLOB_RECURSE LLVM_DEM_SRC "${LIBMEM_DIR}/external/llvm/lib/*.cpp") ++find_package(PkgConfig) ++pkg_check_modules(keystone REQUIRED keystone) ++find_package(capstone CONFIG REQUIRED) + + project(libmem + LANGUAGES +@@ -49,6 +53,7 @@ message(STATUS + message(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}") + message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") + ++if(0) + # External dependencies + set(EXTERNAL_DEPENDENCIES_DIR "${PROJECT_SOURCE_DIR}/external") + set(CAPSTONE_DIR "${EXTERNAL_DEPENDENCIES_DIR}/capstone") +@@ -67,6 +72,7 @@ add_library(keystone STATIC IMPORTED) + set_target_properties(keystone PROPERTIES IMPORTED_LOCATION ${KEYSTONE_IMPORT_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}keystone${CMAKE_STATIC_LIBRARY_SUFFIX}) + # End of external dependencies + ++endif() + set(LIBMEM_DIR "${PROJECT_SOURCE_DIR}") + set(LIBMEM_INC "${LIBMEM_DIR}/include") + set(INTERNAL_DIR "${LIBMEM_DIR}/internal") +@@ -90,23 +96,18 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD) + file(GLOB LIBMEM_SRC ${LIBMEM_ARCH_SRC} "${LIBMEM_DIR}/src/freebsd/*.c" "${LIBMEM_DIR}/src/freebsd/ptrace/*.c" "${LIBMEM_DIR}/src/common/*.c" "${LIBMEM_DIR}/src/common/*.cpp" "${INTERNAL_DIR}/posixutils/*.c" "${INTERNAL_DIR}/elfutils/*.c" "${INTERNAL_DIR}/demangler/*.cpp") + endif() + set(LIBMEM_DEPS +- capstone +- keystone +- llvm ++ capstone::capstone ++ ${keystone_LINK_LIBRARIES} + ) + +-if (LIBMEM_BUILD_STATIC) +- add_library(libmem STATIC ${LIBMEM_SRC}) +-else() +- add_library(libmem SHARED ${LIBMEM_SRC}) +-endif() ++add_library(libmem ${LIBMEM_SRC} ${LLVM_DEM_SRC}) + target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}") + + include_directories(${PROJECT_SOURCE_DIR} + ${LIBMEM_INC} + ${CAPSTONE_INC} + ${KEYSTONE_INC} +- ${LLVM_INC} ++ "${LIBMEM_DIR}/external/llvm/include" + ) + + if (LIBMEM_BUILD_TESTS) +@@ -116,10 +117,6 @@ endif() + + set_target_properties(libmem PROPERTIES POSITION_INDEPENDENT_CODE True INCLUDES ${LIBMEM_INC}) + target_compile_definitions(libmem PUBLIC LM_EXPORT) +-add_dependencies(libmem +- capstone-engine +- keystone-engine +-) + + if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) + set(LIBMEM_DEPS +@@ -152,7 +149,7 @@ else() + endif() + + target_link_libraries(libmem ${LIBMEM_DEPS}) +-if(LIBMEM_BUILD_STATIC) ++if(0) + # Create a bundled static library containing all dependencies (to mimic the shared library behavior) + set_target_properties(libmem PROPERTIES OUTPUT_NAME "libmem_partial") + set(libmem_bundle_files "$") +@@ -193,7 +190,7 @@ if(LIBMEM_BUILD_STATIC) + endif() + endif() + +-if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) ++if(0) + if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) + cmake_path(SET CMAKE_INSTALL_PREFIX "$ENV{ProgramFiles}") + else() +@@ -202,14 +199,18 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN + endif() + set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/libmem") + execute_process(COMMAND mkdir "${CMAKE_INSTALL_PREFIX}") +-else() + set(CMAKE_INSTALL_PREFIX "/usr") + endif() + +-install(TARGETS libmem +- LIBRARY DESTINATION lib) +- +-install(TARGETS libmem +- RUNTIME DESTINATION lib) +- ++install(TARGETS libmem EXPORT libmem-target ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib ++ RUNTIME DESTINATION bin ++ PUBLIC_HEADER DESTINATION include/libmem ++) + install(DIRECTORY ${LIBMEM_INC}/libmem DESTINATION include) ++install(EXPORT libmem-target DESTINATION share/libmem) ++include(CMakePackageConfigHelpers) ++configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libmem-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" INSTALL_DESTINATION share/libmem @ONLY) ++write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" VERSION 5.0.4 COMPATIBILITY SameMajorVersion) ++install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" DESTINATION "share/libmem") From 6f744e2dfb034405d2e152d0b007a9f4ba039691 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 18:36:27 +0300 Subject: [PATCH 29/71] ver --- versions/l-/libmem.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/libmem.json b/versions/l-/libmem.json index 159934a4fb0e64..930316281e4e82 100644 --- a/versions/l-/libmem.json +++ b/versions/l-/libmem.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "78a5d261a824bd763742bd2e9317be946c9f9af6", + "git-tree": "be07920659c1ff3a637b0ad8056ba70d0eb72fcc", "version": "5.0.4", "port-version": 0 }, From 8b10afd0f08a3acf65c7580c7c157eadeaca3a28 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 18:48:24 +0300 Subject: [PATCH 30/71] fixup test port --- scripts/test_ports/vcpkg-ci-libmem/portfile.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/test_ports/vcpkg-ci-libmem/portfile.cmake b/scripts/test_ports/vcpkg-ci-libmem/portfile.cmake index 7d4d2ec18b23f1..52f74814dfe488 100644 --- a/scripts/test_ports/vcpkg-ci-libmem/portfile.cmake +++ b/scripts/test_ports/vcpkg-ci-libmem/portfile.cmake @@ -1,3 +1,8 @@ set(VCPKG_POLICY_EMPTY_PACKAGE enabled) -vcpkg_cmake_configure(SOURCE_PATH "${CURRENT_PORT_DIR}/project") +vcpkg_find_acquire_program(PKGCONFIG) +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) vcpkg_cmake_build() From 20e5ee986ac984acd0920d8d89f0b7c285605648 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 19:17:19 +0300 Subject: [PATCH 31/71] test --- ports/libmem/vcpkg.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ports/libmem/vcpkg.json b/ports/libmem/vcpkg.json index 7e7542a1099708..e5102d75665141 100644 --- a/ports/libmem/vcpkg.json +++ b/ports/libmem/vcpkg.json @@ -15,10 +15,6 @@ { "name": "vcpkg-cmake-config", "host": true - }, - { - "name": "vcpkg-pkgconfig-get-modules", - "host": true } ] } From a590ea1aed99b9f6a49e99a9df9d7136641eaf7b Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 19:17:46 +0300 Subject: [PATCH 32/71] ver --- versions/l-/libmem.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/libmem.json b/versions/l-/libmem.json index 930316281e4e82..c38dfc47c7cecb 100644 --- a/versions/l-/libmem.json +++ b/versions/l-/libmem.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "be07920659c1ff3a637b0ad8056ba70d0eb72fcc", + "git-tree": "c93c8d83106e21dbbc915363d963b1c4a2e0a1df", "version": "5.0.4", "port-version": 0 }, From 26fca93372d140730fc80e197629bd3960e1be9c Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 19:42:30 +0300 Subject: [PATCH 33/71] test --- ports/libmem/libmem-config.cmake.in | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ports/libmem/libmem-config.cmake.in b/ports/libmem/libmem-config.cmake.in index 0ab88745d420e8..bf205ca272b475 100644 --- a/ports/libmem/libmem-config.cmake.in +++ b/ports/libmem/libmem-config.cmake.in @@ -1,7 +1,6 @@ @PACKAGE_INIT@ - include(CMakeFindDependencyMacro) find_dependency(capstone CONFIG) - +find_dependency(keystone) include("${CMAKE_CURRENT_LIST_DIR}/libmem-target.cmake") check_required_components(libmem) From 9af03195f3d004fc7f218318be1ab186808a3de8 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 19:51:55 +0300 Subject: [PATCH 34/71] turn back --- ports/libmem/libmem-config.cmake.in | 1 - ports/libmem/vcpkg.json | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ports/libmem/libmem-config.cmake.in b/ports/libmem/libmem-config.cmake.in index bf205ca272b475..708fa1ed0c65a3 100644 --- a/ports/libmem/libmem-config.cmake.in +++ b/ports/libmem/libmem-config.cmake.in @@ -1,6 +1,5 @@ @PACKAGE_INIT@ include(CMakeFindDependencyMacro) find_dependency(capstone CONFIG) -find_dependency(keystone) include("${CMAKE_CURRENT_LIST_DIR}/libmem-target.cmake") check_required_components(libmem) diff --git a/ports/libmem/vcpkg.json b/ports/libmem/vcpkg.json index e5102d75665141..7e7542a1099708 100644 --- a/ports/libmem/vcpkg.json +++ b/ports/libmem/vcpkg.json @@ -15,6 +15,10 @@ { "name": "vcpkg-cmake-config", "host": true + }, + { + "name": "vcpkg-pkgconfig-get-modules", + "host": true } ] } From cc2a6c8f00b426c83b51e8cc9087e5e687a1059f Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 20:28:40 +0300 Subject: [PATCH 35/71] check --- ports/libmem/0001-CMakeLists.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/libmem/0001-CMakeLists.patch b/ports/libmem/0001-CMakeLists.patch index 4ca77ca2fcc675..a47ab544acddd1 100644 --- a/ports/libmem/0001-CMakeLists.patch +++ b/ports/libmem/0001-CMakeLists.patch @@ -8,9 +8,9 @@ index 534057a..dd01de4 100644 -include(ExternalProject) +set(CMAKE_CXX_STANDARD 17) +file(GLOB_RECURSE LLVM_DEM_SRC "${LIBMEM_DIR}/external/llvm/lib/*.cpp") -+find_package(PkgConfig) -+pkg_check_modules(keystone REQUIRED keystone) ++find_package(PkgConfig REQUIRED) +find_package(capstone CONFIG REQUIRED) ++pkg_check_modules(keystone REQUIRED keystone) project(libmem LANGUAGES From eff72ee9c190db4de1d61372e134f89e7e95aeda Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 22:04:05 +0300 Subject: [PATCH 36/71] test --- ports/libmem/0001-CMakeLists.patch | 231 +++++++++++++++-------------- ports/libmem/vcpkg.json | 4 - 2 files changed, 116 insertions(+), 119 deletions(-) diff --git a/ports/libmem/0001-CMakeLists.patch b/ports/libmem/0001-CMakeLists.patch index a47ab544acddd1..fc69f6526c5063 100644 --- a/ports/libmem/0001-CMakeLists.patch +++ b/ports/libmem/0001-CMakeLists.patch @@ -1,115 +1,116 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 534057a..dd01de4 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1,6 +1,10 @@ - cmake_minimum_required(VERSION 3.22.1) - --include(ExternalProject) -+set(CMAKE_CXX_STANDARD 17) -+file(GLOB_RECURSE LLVM_DEM_SRC "${LIBMEM_DIR}/external/llvm/lib/*.cpp") -+find_package(PkgConfig REQUIRED) -+find_package(capstone CONFIG REQUIRED) -+pkg_check_modules(keystone REQUIRED keystone) - - project(libmem - LANGUAGES -@@ -49,6 +53,7 @@ message(STATUS - message(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}") - message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") - -+if(0) - # External dependencies - set(EXTERNAL_DEPENDENCIES_DIR "${PROJECT_SOURCE_DIR}/external") - set(CAPSTONE_DIR "${EXTERNAL_DEPENDENCIES_DIR}/capstone") -@@ -67,6 +72,7 @@ add_library(keystone STATIC IMPORTED) - set_target_properties(keystone PROPERTIES IMPORTED_LOCATION ${KEYSTONE_IMPORT_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}keystone${CMAKE_STATIC_LIBRARY_SUFFIX}) - # End of external dependencies - -+endif() - set(LIBMEM_DIR "${PROJECT_SOURCE_DIR}") - set(LIBMEM_INC "${LIBMEM_DIR}/include") - set(INTERNAL_DIR "${LIBMEM_DIR}/internal") -@@ -90,23 +96,18 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD) - file(GLOB LIBMEM_SRC ${LIBMEM_ARCH_SRC} "${LIBMEM_DIR}/src/freebsd/*.c" "${LIBMEM_DIR}/src/freebsd/ptrace/*.c" "${LIBMEM_DIR}/src/common/*.c" "${LIBMEM_DIR}/src/common/*.cpp" "${INTERNAL_DIR}/posixutils/*.c" "${INTERNAL_DIR}/elfutils/*.c" "${INTERNAL_DIR}/demangler/*.cpp") - endif() - set(LIBMEM_DEPS -- capstone -- keystone -- llvm -+ capstone::capstone -+ ${keystone_LINK_LIBRARIES} - ) - --if (LIBMEM_BUILD_STATIC) -- add_library(libmem STATIC ${LIBMEM_SRC}) --else() -- add_library(libmem SHARED ${LIBMEM_SRC}) --endif() -+add_library(libmem ${LIBMEM_SRC} ${LLVM_DEM_SRC}) - target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}") - - include_directories(${PROJECT_SOURCE_DIR} - ${LIBMEM_INC} - ${CAPSTONE_INC} - ${KEYSTONE_INC} -- ${LLVM_INC} -+ "${LIBMEM_DIR}/external/llvm/include" - ) - - if (LIBMEM_BUILD_TESTS) -@@ -116,10 +117,6 @@ endif() - - set_target_properties(libmem PROPERTIES POSITION_INDEPENDENT_CODE True INCLUDES ${LIBMEM_INC}) - target_compile_definitions(libmem PUBLIC LM_EXPORT) --add_dependencies(libmem -- capstone-engine -- keystone-engine --) - - if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) - set(LIBMEM_DEPS -@@ -152,7 +149,7 @@ else() - endif() - - target_link_libraries(libmem ${LIBMEM_DEPS}) --if(LIBMEM_BUILD_STATIC) -+if(0) - # Create a bundled static library containing all dependencies (to mimic the shared library behavior) - set_target_properties(libmem PROPERTIES OUTPUT_NAME "libmem_partial") - set(libmem_bundle_files "$") -@@ -193,7 +190,7 @@ if(LIBMEM_BUILD_STATIC) - endif() - endif() - --if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) -+if(0) - if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) - cmake_path(SET CMAKE_INSTALL_PREFIX "$ENV{ProgramFiles}") - else() -@@ -202,14 +199,18 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN - endif() - set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/libmem") - execute_process(COMMAND mkdir "${CMAKE_INSTALL_PREFIX}") --else() - set(CMAKE_INSTALL_PREFIX "/usr") - endif() - --install(TARGETS libmem -- LIBRARY DESTINATION lib) -- --install(TARGETS libmem -- RUNTIME DESTINATION lib) -- -+install(TARGETS libmem EXPORT libmem-target -+ LIBRARY DESTINATION lib -+ ARCHIVE DESTINATION lib -+ RUNTIME DESTINATION bin -+ PUBLIC_HEADER DESTINATION include/libmem -+) - install(DIRECTORY ${LIBMEM_INC}/libmem DESTINATION include) -+install(EXPORT libmem-target DESTINATION share/libmem) -+include(CMakePackageConfigHelpers) -+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libmem-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" INSTALL_DESTINATION share/libmem @ONLY) -+write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" VERSION 5.0.4 COMPATIBILITY SameMajorVersion) -+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" DESTINATION "share/libmem") +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 534057a..ea80f2d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,6 +1,7 @@ + cmake_minimum_required(VERSION 3.22.1) + +-include(ExternalProject) ++set(CMAKE_CXX_STANDARD 17) ++file(GLOB_RECURSE LLVM_DEM_SRC "${LIBMEM_DIR}/external/llvm/lib/*.cpp") + + project(libmem + LANGUAGES +@@ -49,6 +50,7 @@ message(STATUS + message(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}") + message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") + ++if(0) + # External dependencies + set(EXTERNAL_DEPENDENCIES_DIR "${PROJECT_SOURCE_DIR}/external") + set(CAPSTONE_DIR "${EXTERNAL_DEPENDENCIES_DIR}/capstone") +@@ -67,6 +69,7 @@ add_library(keystone STATIC IMPORTED) + set_target_properties(keystone PROPERTIES IMPORTED_LOCATION ${KEYSTONE_IMPORT_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}keystone${CMAKE_STATIC_LIBRARY_SUFFIX}) + # End of external dependencies + ++endif() + set(LIBMEM_DIR "${PROJECT_SOURCE_DIR}") + set(LIBMEM_INC "${LIBMEM_DIR}/include") + set(INTERNAL_DIR "${LIBMEM_DIR}/internal") +@@ -90,23 +93,18 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD) + file(GLOB LIBMEM_SRC ${LIBMEM_ARCH_SRC} "${LIBMEM_DIR}/src/freebsd/*.c" "${LIBMEM_DIR}/src/freebsd/ptrace/*.c" "${LIBMEM_DIR}/src/common/*.c" "${LIBMEM_DIR}/src/common/*.cpp" "${INTERNAL_DIR}/posixutils/*.c" "${INTERNAL_DIR}/elfutils/*.c" "${INTERNAL_DIR}/demangler/*.cpp") + endif() + set(LIBMEM_DEPS +- capstone +- keystone +- llvm ++ capstone::capstone ++ ${keystone_LINK_LIBRARIES} + ) + +-if (LIBMEM_BUILD_STATIC) +- add_library(libmem STATIC ${LIBMEM_SRC}) +-else() +- add_library(libmem SHARED ${LIBMEM_SRC}) +-endif() ++add_library(libmem ${LIBMEM_SRC} ${LLVM_DEM_SRC}) + target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}") + + include_directories(${PROJECT_SOURCE_DIR} + ${LIBMEM_INC} + ${CAPSTONE_INC} + ${KEYSTONE_INC} +- ${LLVM_INC} ++ "${LIBMEM_DIR}/external/llvm/include" + ) + + if (LIBMEM_BUILD_TESTS) +@@ -116,10 +114,6 @@ endif() + + set_target_properties(libmem PROPERTIES POSITION_INDEPENDENT_CODE True INCLUDES ${LIBMEM_INC}) + target_compile_definitions(libmem PUBLIC LM_EXPORT) +-add_dependencies(libmem +- capstone-engine +- keystone-engine +-) + + if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) + set(LIBMEM_DEPS +@@ -151,8 +145,11 @@ else() + message(FATAL_ERROR "[!] Unsupported platform") + endif() + ++find_package(PkgConfig) ++pkg_check_modules(keystone REQUIRED keystone) ++find_package(capstone CONFIG REQUIRED) + target_link_libraries(libmem ${LIBMEM_DEPS}) +-if(LIBMEM_BUILD_STATIC) ++if(0) + # Create a bundled static library containing all dependencies (to mimic the shared library behavior) + set_target_properties(libmem PROPERTIES OUTPUT_NAME "libmem_partial") + set(libmem_bundle_files "$") +@@ -193,7 +190,7 @@ if(LIBMEM_BUILD_STATIC) + endif() + endif() + +-if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) ++if(0) + if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) + cmake_path(SET CMAKE_INSTALL_PREFIX "$ENV{ProgramFiles}") + else() +@@ -202,14 +199,18 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN + endif() + set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/libmem") + execute_process(COMMAND mkdir "${CMAKE_INSTALL_PREFIX}") +-else() + set(CMAKE_INSTALL_PREFIX "/usr") + endif() + +-install(TARGETS libmem +- LIBRARY DESTINATION lib) +- +-install(TARGETS libmem +- RUNTIME DESTINATION lib) +- ++install(TARGETS libmem EXPORT libmem-target ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib ++ RUNTIME DESTINATION bin ++ PUBLIC_HEADER DESTINATION include/libmem ++) + install(DIRECTORY ${LIBMEM_INC}/libmem DESTINATION include) ++install(EXPORT libmem-target DESTINATION share/libmem) ++include(CMakePackageConfigHelpers) ++configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libmem-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" INSTALL_DESTINATION share/libmem @ONLY) ++write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" VERSION 5.0.4 COMPATIBILITY SameMajorVersion) ++install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" DESTINATION "share/libmem") diff --git a/ports/libmem/vcpkg.json b/ports/libmem/vcpkg.json index 7e7542a1099708..e5102d75665141 100644 --- a/ports/libmem/vcpkg.json +++ b/ports/libmem/vcpkg.json @@ -15,10 +15,6 @@ { "name": "vcpkg-cmake-config", "host": true - }, - { - "name": "vcpkg-pkgconfig-get-modules", - "host": true } ] } From 00f71c1895a44852c5656c1ee542dafd45455198 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 22:04:25 +0300 Subject: [PATCH 37/71] ver --- versions/l-/libmem.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/libmem.json b/versions/l-/libmem.json index c38dfc47c7cecb..4207257c7e6126 100644 --- a/versions/l-/libmem.json +++ b/versions/l-/libmem.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "c93c8d83106e21dbbc915363d963b1c4a2e0a1df", + "git-tree": "dbef6c8130e930c67f41d96c6951e31466917132", "version": "5.0.4", "port-version": 0 }, From ec7368da5a6a8e2b4d48f9ec7d4dd24399ab0606 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 22:12:59 +0300 Subject: [PATCH 38/71] clean --- ports/libmem/0001-CMakeLists.patch | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ports/libmem/0001-CMakeLists.patch b/ports/libmem/0001-CMakeLists.patch index fc69f6526c5063..4ff8feaa05d020 100644 --- a/ports/libmem/0001-CMakeLists.patch +++ b/ports/libmem/0001-CMakeLists.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 534057a..ea80f2d 100644 +index 534057a..91f145d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ @@ -102,15 +102,16 @@ index 534057a..ea80f2d 100644 -install(TARGETS libmem - RUNTIME DESTINATION lib) - +-install(DIRECTORY ${LIBMEM_INC}/libmem DESTINATION include) +install(TARGETS libmem EXPORT libmem-target + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin -+ PUBLIC_HEADER DESTINATION include/libmem ++ PUBLIC_HEADER DESTINATION "include/libmem" +) - install(DIRECTORY ${LIBMEM_INC}/libmem DESTINATION include) -+install(EXPORT libmem-target DESTINATION share/libmem) ++install(DIRECTORY "${LIBMEM_INC}/libmem" DESTINATION "include") ++install(EXPORT libmem-target DESTINATION "share/libmem") +include(CMakePackageConfigHelpers) -+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libmem-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" INSTALL_DESTINATION share/libmem @ONLY) ++configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libmem-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" INSTALL_DESTINATION "share/libmem" @ONLY) +write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" VERSION 5.0.4 COMPATIBILITY SameMajorVersion) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" DESTINATION "share/libmem") From 89f48804b49f37ed0b630cdff6bd55245d43e1d8 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 22:13:17 +0300 Subject: [PATCH 39/71] ver --- versions/l-/libmem.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/libmem.json b/versions/l-/libmem.json index 4207257c7e6126..6c6e258815834e 100644 --- a/versions/l-/libmem.json +++ b/versions/l-/libmem.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "dbef6c8130e930c67f41d96c6951e31466917132", + "git-tree": "a3aa17c074b30dad3d6f522200d18db9825c344c", "version": "5.0.4", "port-version": 0 }, From fb6abc17b41847b421bfc6d90078833303c13ba8 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 22:30:23 +0300 Subject: [PATCH 40/71] fixup --- ports/libmem/0001-CMakeLists.patch | 235 +++++++++++++++-------------- 1 file changed, 118 insertions(+), 117 deletions(-) diff --git a/ports/libmem/0001-CMakeLists.patch b/ports/libmem/0001-CMakeLists.patch index 4ff8feaa05d020..3f01bd4e7b2a61 100644 --- a/ports/libmem/0001-CMakeLists.patch +++ b/ports/libmem/0001-CMakeLists.patch @@ -1,117 +1,118 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 534057a..91f145d 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1,6 +1,7 @@ - cmake_minimum_required(VERSION 3.22.1) - --include(ExternalProject) -+set(CMAKE_CXX_STANDARD 17) -+file(GLOB_RECURSE LLVM_DEM_SRC "${LIBMEM_DIR}/external/llvm/lib/*.cpp") - - project(libmem - LANGUAGES -@@ -49,6 +50,7 @@ message(STATUS - message(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}") - message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") - -+if(0) - # External dependencies - set(EXTERNAL_DEPENDENCIES_DIR "${PROJECT_SOURCE_DIR}/external") - set(CAPSTONE_DIR "${EXTERNAL_DEPENDENCIES_DIR}/capstone") -@@ -67,6 +69,7 @@ add_library(keystone STATIC IMPORTED) - set_target_properties(keystone PROPERTIES IMPORTED_LOCATION ${KEYSTONE_IMPORT_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}keystone${CMAKE_STATIC_LIBRARY_SUFFIX}) - # End of external dependencies - -+endif() - set(LIBMEM_DIR "${PROJECT_SOURCE_DIR}") - set(LIBMEM_INC "${LIBMEM_DIR}/include") - set(INTERNAL_DIR "${LIBMEM_DIR}/internal") -@@ -90,23 +93,18 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD) - file(GLOB LIBMEM_SRC ${LIBMEM_ARCH_SRC} "${LIBMEM_DIR}/src/freebsd/*.c" "${LIBMEM_DIR}/src/freebsd/ptrace/*.c" "${LIBMEM_DIR}/src/common/*.c" "${LIBMEM_DIR}/src/common/*.cpp" "${INTERNAL_DIR}/posixutils/*.c" "${INTERNAL_DIR}/elfutils/*.c" "${INTERNAL_DIR}/demangler/*.cpp") - endif() - set(LIBMEM_DEPS -- capstone -- keystone -- llvm -+ capstone::capstone -+ ${keystone_LINK_LIBRARIES} - ) - --if (LIBMEM_BUILD_STATIC) -- add_library(libmem STATIC ${LIBMEM_SRC}) --else() -- add_library(libmem SHARED ${LIBMEM_SRC}) --endif() -+add_library(libmem ${LIBMEM_SRC} ${LLVM_DEM_SRC}) - target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}") - - include_directories(${PROJECT_SOURCE_DIR} - ${LIBMEM_INC} - ${CAPSTONE_INC} - ${KEYSTONE_INC} -- ${LLVM_INC} -+ "${LIBMEM_DIR}/external/llvm/include" - ) - - if (LIBMEM_BUILD_TESTS) -@@ -116,10 +114,6 @@ endif() - - set_target_properties(libmem PROPERTIES POSITION_INDEPENDENT_CODE True INCLUDES ${LIBMEM_INC}) - target_compile_definitions(libmem PUBLIC LM_EXPORT) --add_dependencies(libmem -- capstone-engine -- keystone-engine --) - - if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) - set(LIBMEM_DEPS -@@ -151,8 +145,11 @@ else() - message(FATAL_ERROR "[!] Unsupported platform") - endif() - -+find_package(PkgConfig) -+pkg_check_modules(keystone REQUIRED keystone) -+find_package(capstone CONFIG REQUIRED) - target_link_libraries(libmem ${LIBMEM_DEPS}) --if(LIBMEM_BUILD_STATIC) -+if(0) - # Create a bundled static library containing all dependencies (to mimic the shared library behavior) - set_target_properties(libmem PROPERTIES OUTPUT_NAME "libmem_partial") - set(libmem_bundle_files "$") -@@ -193,7 +190,7 @@ if(LIBMEM_BUILD_STATIC) - endif() - endif() - --if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) -+if(0) - if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) - cmake_path(SET CMAKE_INSTALL_PREFIX "$ENV{ProgramFiles}") - else() -@@ -202,14 +199,18 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN - endif() - set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/libmem") - execute_process(COMMAND mkdir "${CMAKE_INSTALL_PREFIX}") --else() - set(CMAKE_INSTALL_PREFIX "/usr") - endif() - --install(TARGETS libmem -- LIBRARY DESTINATION lib) -- --install(TARGETS libmem -- RUNTIME DESTINATION lib) -- --install(DIRECTORY ${LIBMEM_INC}/libmem DESTINATION include) -+install(TARGETS libmem EXPORT libmem-target -+ LIBRARY DESTINATION lib -+ ARCHIVE DESTINATION lib -+ RUNTIME DESTINATION bin -+ PUBLIC_HEADER DESTINATION "include/libmem" -+) -+install(DIRECTORY "${LIBMEM_INC}/libmem" DESTINATION "include") -+install(EXPORT libmem-target DESTINATION "share/libmem") -+include(CMakePackageConfigHelpers) -+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libmem-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" INSTALL_DESTINATION "share/libmem" @ONLY) -+write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" VERSION 5.0.4 COMPATIBILITY SameMajorVersion) -+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" DESTINATION "share/libmem") +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 534057a..9544bda 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,6 +1,7 @@ + cmake_minimum_required(VERSION 3.22.1) + +-include(ExternalProject) ++set(CMAKE_CXX_STANDARD 17) ++file(GLOB_RECURSE LLVM_DEM_SRC "${LIBMEM_DIR}/external/llvm/lib/*.cpp") + + project(libmem + LANGUAGES +@@ -49,6 +50,7 @@ message(STATUS + message(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}") + message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") + ++if(0) + # External dependencies + set(EXTERNAL_DEPENDENCIES_DIR "${PROJECT_SOURCE_DIR}/external") + set(CAPSTONE_DIR "${EXTERNAL_DEPENDENCIES_DIR}/capstone") +@@ -67,6 +69,7 @@ add_library(keystone STATIC IMPORTED) + set_target_properties(keystone PROPERTIES IMPORTED_LOCATION ${KEYSTONE_IMPORT_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}keystone${CMAKE_STATIC_LIBRARY_SUFFIX}) + # End of external dependencies + ++endif() + set(LIBMEM_DIR "${PROJECT_SOURCE_DIR}") + set(LIBMEM_INC "${LIBMEM_DIR}/include") + set(INTERNAL_DIR "${LIBMEM_DIR}/internal") +@@ -90,23 +93,18 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD) + file(GLOB LIBMEM_SRC ${LIBMEM_ARCH_SRC} "${LIBMEM_DIR}/src/freebsd/*.c" "${LIBMEM_DIR}/src/freebsd/ptrace/*.c" "${LIBMEM_DIR}/src/common/*.c" "${LIBMEM_DIR}/src/common/*.cpp" "${INTERNAL_DIR}/posixutils/*.c" "${INTERNAL_DIR}/elfutils/*.c" "${INTERNAL_DIR}/demangler/*.cpp") + endif() + set(LIBMEM_DEPS +- capstone +- keystone +- llvm ++ capstone::capstone ++ ${keystone_LINK_LIBRARIES} + ) + +-if (LIBMEM_BUILD_STATIC) +- add_library(libmem STATIC ${LIBMEM_SRC}) +-else() +- add_library(libmem SHARED ${LIBMEM_SRC}) +-endif() +-target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}") ++add_library(libmem ${LIBMEM_SRC} ${LLVM_DEM_SRC}) ++target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}" "$" "$") + + include_directories(${PROJECT_SOURCE_DIR} + ${LIBMEM_INC} + ${CAPSTONE_INC} + ${KEYSTONE_INC} +- ${LLVM_INC} ++ "${LIBMEM_DIR}/external/llvm/include" + ) + + if (LIBMEM_BUILD_TESTS) +@@ -116,10 +114,6 @@ endif() + + set_target_properties(libmem PROPERTIES POSITION_INDEPENDENT_CODE True INCLUDES ${LIBMEM_INC}) + target_compile_definitions(libmem PUBLIC LM_EXPORT) +-add_dependencies(libmem +- capstone-engine +- keystone-engine +-) + + if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) + set(LIBMEM_DEPS +@@ -151,8 +145,11 @@ else() + message(FATAL_ERROR "[!] Unsupported platform") + endif() + ++find_package(PkgConfig) ++pkg_check_modules(keystone REQUIRED keystone) ++find_package(capstone CONFIG REQUIRED) + target_link_libraries(libmem ${LIBMEM_DEPS}) +-if(LIBMEM_BUILD_STATIC) ++if(0) + # Create a bundled static library containing all dependencies (to mimic the shared library behavior) + set_target_properties(libmem PROPERTIES OUTPUT_NAME "libmem_partial") + set(libmem_bundle_files "$") +@@ -193,7 +190,7 @@ if(LIBMEM_BUILD_STATIC) + endif() + endif() + +-if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) ++if(0) + if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) + cmake_path(SET CMAKE_INSTALL_PREFIX "$ENV{ProgramFiles}") + else() +@@ -202,14 +199,18 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN + endif() + set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/libmem") + execute_process(COMMAND mkdir "${CMAKE_INSTALL_PREFIX}") +-else() + set(CMAKE_INSTALL_PREFIX "/usr") + endif() + +-install(TARGETS libmem +- LIBRARY DESTINATION lib) +- +-install(TARGETS libmem +- RUNTIME DESTINATION lib) +- +-install(DIRECTORY ${LIBMEM_INC}/libmem DESTINATION include) ++install(TARGETS libmem EXPORT libmem-target ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib ++ RUNTIME DESTINATION bin ++ PUBLIC_HEADER DESTINATION "include/libmem" ++) ++install(DIRECTORY "${LIBMEM_INC}/libmem" DESTINATION "include") ++install(EXPORT libmem-target DESTINATION "share/libmem") ++include(CMakePackageConfigHelpers) ++configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libmem-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" INSTALL_DESTINATION "share/libmem" @ONLY) ++write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" VERSION 5.0.4 COMPATIBILITY SameMajorVersion) ++install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" DESTINATION "share/libmem") From e068121c9e85d118788e7820ecace5cc5b80bb18 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 22:30:42 +0300 Subject: [PATCH 41/71] ver --- versions/l-/libmem.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/libmem.json b/versions/l-/libmem.json index 6c6e258815834e..c1a8eea657faf2 100644 --- a/versions/l-/libmem.json +++ b/versions/l-/libmem.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "a3aa17c074b30dad3d6f522200d18db9825c344c", + "git-tree": "ff63606903a515e566358af199eb40984a434373", "version": "5.0.4", "port-version": 0 }, From 124dcb8399041929b4d4638930209e4ea1dbbed9 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 22:41:11 +0300 Subject: [PATCH 42/71] fixup --- ports/libmem/0001-CMakeLists.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/libmem/0001-CMakeLists.patch b/ports/libmem/0001-CMakeLists.patch index 3f01bd4e7b2a61..9bb5f8c6f3d8a4 100644 --- a/ports/libmem/0001-CMakeLists.patch +++ b/ports/libmem/0001-CMakeLists.patch @@ -45,7 +45,7 @@ index 534057a..9544bda 100644 -endif() -target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}") +add_library(libmem ${LIBMEM_SRC} ${LLVM_DEM_SRC}) -+target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}" "$" "$") ++target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}" INTERFACE "$" "$") include_directories(${PROJECT_SOURCE_DIR} ${LIBMEM_INC} From c7901a94274a0c6c732e6bf22dc94c75b1a2a51b Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 22:41:29 +0300 Subject: [PATCH 43/71] ver --- versions/l-/libmem.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/libmem.json b/versions/l-/libmem.json index c1a8eea657faf2..f32abf01acfc2f 100644 --- a/versions/l-/libmem.json +++ b/versions/l-/libmem.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "ff63606903a515e566358af199eb40984a434373", + "git-tree": "5ae43307774dd54c26b213813876a3e52975450b", "version": "5.0.4", "port-version": 0 }, From 89787235bc6da0895b0e3588bb0fadc0f71fe96e Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 22:59:40 +0300 Subject: [PATCH 44/71] check --- ports/libmem/0001-CMakeLists.patch | 2 +- ports/libmem/vcpkg.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/libmem/0001-CMakeLists.patch b/ports/libmem/0001-CMakeLists.patch index 9bb5f8c6f3d8a4..faf1c6abf01843 100644 --- a/ports/libmem/0001-CMakeLists.patch +++ b/ports/libmem/0001-CMakeLists.patch @@ -45,7 +45,7 @@ index 534057a..9544bda 100644 -endif() -target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}") +add_library(libmem ${LIBMEM_SRC} ${LLVM_DEM_SRC}) -+target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}" INTERFACE "$" "$") ++target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}" PUBLIC "$") include_directories(${PROJECT_SOURCE_DIR} ${LIBMEM_INC} diff --git a/ports/libmem/vcpkg.json b/ports/libmem/vcpkg.json index e5102d75665141..9c9cf3f5bbf381 100644 --- a/ports/libmem/vcpkg.json +++ b/ports/libmem/vcpkg.json @@ -4,7 +4,7 @@ "description": "Advanced Game Hacking Library for C, Modern C++, Rust and Python (Windows/Linux/FreeBSD) (Process/Memory Hacking) (Hooking/Detouring) (Cross Platform) (x86/x64/ARM/ARM64) (DLL/SO Injection) (Internal/External) (Assembler/Disassembler)", "homepage": "https://github.com/rdbo/libmem", "license": "AGPL-3.0-only", - "supports": "windows | ((linux | freebsd) & (x86 | x64))", + "supports": "!xbox | windows | ((linux | freebsd) & (x86 | x64))", "dependencies": [ "capstone", "keystone", From e7e18b420378d404554bf6aef9b34438129736bb Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 22:59:59 +0300 Subject: [PATCH 45/71] ver --- versions/l-/libmem.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/libmem.json b/versions/l-/libmem.json index f32abf01acfc2f..ba34299c064c0a 100644 --- a/versions/l-/libmem.json +++ b/versions/l-/libmem.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "5ae43307774dd54c26b213813876a3e52975450b", + "git-tree": "987eb5699c7e576c1815ea1eb1c5aec745b44714", "version": "5.0.4", "port-version": 0 }, From 3abe478ebfefcd78843a2864e37498bada544fb6 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 23:03:35 +0300 Subject: [PATCH 46/71] fixup --- ports/libmem/vcpkg.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/libmem/vcpkg.json b/ports/libmem/vcpkg.json index 9c9cf3f5bbf381..b60eb4e4a114b2 100644 --- a/ports/libmem/vcpkg.json +++ b/ports/libmem/vcpkg.json @@ -4,7 +4,7 @@ "description": "Advanced Game Hacking Library for C, Modern C++, Rust and Python (Windows/Linux/FreeBSD) (Process/Memory Hacking) (Hooking/Detouring) (Cross Platform) (x86/x64/ARM/ARM64) (DLL/SO Injection) (Internal/External) (Assembler/Disassembler)", "homepage": "https://github.com/rdbo/libmem", "license": "AGPL-3.0-only", - "supports": "!xbox | windows | ((linux | freebsd) & (x86 | x64))", + "supports": "!xbox & windows | ((linux | freebsd) & (x86 | x64))", "dependencies": [ "capstone", "keystone", From ddb8c3b47cf555deabf8e1c921c28fbddb56f671 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 23:11:25 +0300 Subject: [PATCH 47/71] Update vcpkg.json --- ports/libmem/vcpkg.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/libmem/vcpkg.json b/ports/libmem/vcpkg.json index b60eb4e4a114b2..9f29a052f69f4f 100644 --- a/ports/libmem/vcpkg.json +++ b/ports/libmem/vcpkg.json @@ -4,7 +4,7 @@ "description": "Advanced Game Hacking Library for C, Modern C++, Rust and Python (Windows/Linux/FreeBSD) (Process/Memory Hacking) (Hooking/Detouring) (Cross Platform) (x86/x64/ARM/ARM64) (DLL/SO Injection) (Internal/External) (Assembler/Disassembler)", "homepage": "https://github.com/rdbo/libmem", "license": "AGPL-3.0-only", - "supports": "!xbox & windows | ((linux | freebsd) & (x86 | x64))", + "supports": "(!xbox & windows) | ((linux | freebsd) & (x86 | x64))", "dependencies": [ "capstone", "keystone", From 0b3b318cadaa36cf4158ce660c821a2c369f2731 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 23:23:17 +0300 Subject: [PATCH 48/71] Update vcpkg.json --- ports/libmem/vcpkg.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ports/libmem/vcpkg.json b/ports/libmem/vcpkg.json index 9f29a052f69f4f..2e160634a714bb 100644 --- a/ports/libmem/vcpkg.json +++ b/ports/libmem/vcpkg.json @@ -15,6 +15,10 @@ { "name": "vcpkg-cmake-config", "host": true + }, + { + "name": "vcpkg-pkgconfig-get-modules", + "host": true } ] } From 48b27671bd4680c5f577aae8a0ef2dd7738a0c67 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 23:36:29 +0300 Subject: [PATCH 49/71] fixup configure_file --- ports/libmem/0001-CMakeLists.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/libmem/0001-CMakeLists.patch b/ports/libmem/0001-CMakeLists.patch index faf1c6abf01843..750bd0fa59dc82 100644 --- a/ports/libmem/0001-CMakeLists.patch +++ b/ports/libmem/0001-CMakeLists.patch @@ -113,6 +113,6 @@ index 534057a..9544bda 100644 +install(DIRECTORY "${LIBMEM_INC}/libmem" DESTINATION "include") +install(EXPORT libmem-target DESTINATION "share/libmem") +include(CMakePackageConfigHelpers) -+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libmem-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" INSTALL_DESTINATION "share/libmem" @ONLY) ++configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libmem-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" "share/libmem" @ONLY) +write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" VERSION 5.0.4 COMPATIBILITY SameMajorVersion) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" DESTINATION "share/libmem") From b3f17b16603063422c621a9a6c3d93ce7c1cfa77 Mon Sep 17 00:00:00 2001 From: Saikari Date: Thu, 9 Jan 2025 23:36:58 +0300 Subject: [PATCH 50/71] Update 0001-CMakeLists.patch --- ports/libmem/0001-CMakeLists.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/libmem/0001-CMakeLists.patch b/ports/libmem/0001-CMakeLists.patch index 750bd0fa59dc82..5a01266fff9466 100644 --- a/ports/libmem/0001-CMakeLists.patch +++ b/ports/libmem/0001-CMakeLists.patch @@ -113,6 +113,6 @@ index 534057a..9544bda 100644 +install(DIRECTORY "${LIBMEM_INC}/libmem" DESTINATION "include") +install(EXPORT libmem-target DESTINATION "share/libmem") +include(CMakePackageConfigHelpers) -+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libmem-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" "share/libmem" @ONLY) ++configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libmem-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" @ONLY) +write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" VERSION 5.0.4 COMPATIBILITY SameMajorVersion) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" DESTINATION "share/libmem") From d71c51d1ee0ee158da2e6d953e4ff1dbc62ae2d6 Mon Sep 17 00:00:00 2001 From: Saikari Date: Fri, 10 Jan 2025 00:11:32 +0300 Subject: [PATCH 51/71] test --- ports/libmem/0001-CMakeLists.patch | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ports/libmem/0001-CMakeLists.patch b/ports/libmem/0001-CMakeLists.patch index 5a01266fff9466..485e7ea384a8a5 100644 --- a/ports/libmem/0001-CMakeLists.patch +++ b/ports/libmem/0001-CMakeLists.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 534057a..9544bda 100644 +index 534057a..e8f0f4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ @@ -27,7 +27,7 @@ index 534057a..9544bda 100644 set(LIBMEM_DIR "${PROJECT_SOURCE_DIR}") set(LIBMEM_INC "${LIBMEM_DIR}/include") set(INTERNAL_DIR "${LIBMEM_DIR}/internal") -@@ -90,23 +93,18 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD) +@@ -90,23 +93,17 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD) file(GLOB LIBMEM_SRC ${LIBMEM_ARCH_SRC} "${LIBMEM_DIR}/src/freebsd/*.c" "${LIBMEM_DIR}/src/freebsd/ptrace/*.c" "${LIBMEM_DIR}/src/common/*.c" "${LIBMEM_DIR}/src/common/*.cpp" "${INTERNAL_DIR}/posixutils/*.c" "${INTERNAL_DIR}/elfutils/*.c" "${INTERNAL_DIR}/demangler/*.cpp") endif() set(LIBMEM_DEPS @@ -45,10 +45,10 @@ index 534057a..9544bda 100644 -endif() -target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}") +add_library(libmem ${LIBMEM_SRC} ${LLVM_DEM_SRC}) -+target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}" PUBLIC "$") ++target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}" "${LIBMEM_INC}" INTERFACE $) include_directories(${PROJECT_SOURCE_DIR} - ${LIBMEM_INC} +- ${LIBMEM_INC} ${CAPSTONE_INC} ${KEYSTONE_INC} - ${LLVM_INC} @@ -56,7 +56,7 @@ index 534057a..9544bda 100644 ) if (LIBMEM_BUILD_TESTS) -@@ -116,10 +114,6 @@ endif() +@@ -116,10 +113,6 @@ endif() set_target_properties(libmem PROPERTIES POSITION_INDEPENDENT_CODE True INCLUDES ${LIBMEM_INC}) target_compile_definitions(libmem PUBLIC LM_EXPORT) @@ -67,7 +67,7 @@ index 534057a..9544bda 100644 if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) set(LIBMEM_DEPS -@@ -151,8 +145,11 @@ else() +@@ -151,8 +144,11 @@ else() message(FATAL_ERROR "[!] Unsupported platform") endif() @@ -80,7 +80,7 @@ index 534057a..9544bda 100644 # Create a bundled static library containing all dependencies (to mimic the shared library behavior) set_target_properties(libmem PROPERTIES OUTPUT_NAME "libmem_partial") set(libmem_bundle_files "$") -@@ -193,7 +190,7 @@ if(LIBMEM_BUILD_STATIC) +@@ -193,7 +189,7 @@ if(LIBMEM_BUILD_STATIC) endif() endif() @@ -89,7 +89,7 @@ index 534057a..9544bda 100644 if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) cmake_path(SET CMAKE_INSTALL_PREFIX "$ENV{ProgramFiles}") else() -@@ -202,14 +199,18 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN +@@ -202,14 +198,18 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN endif() set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/libmem") execute_process(COMMAND mkdir "${CMAKE_INSTALL_PREFIX}") From 77b23b7bf7b38fae3e39d6021dca473338760e06 Mon Sep 17 00:00:00 2001 From: Saikari Date: Fri, 10 Jan 2025 07:21:25 +0300 Subject: [PATCH 52/71] test --- ports/libmem/0001-CMakeLists.patch | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ports/libmem/0001-CMakeLists.patch b/ports/libmem/0001-CMakeLists.patch index 485e7ea384a8a5..23759a3099eb37 100644 --- a/ports/libmem/0001-CMakeLists.patch +++ b/ports/libmem/0001-CMakeLists.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 534057a..e8f0f4e 100644 +index 534057a..e433396 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ @@ -50,8 +50,9 @@ index 534057a..e8f0f4e 100644 include_directories(${PROJECT_SOURCE_DIR} - ${LIBMEM_INC} ${CAPSTONE_INC} - ${KEYSTONE_INC} +- ${KEYSTONE_INC} - ${LLVM_INC} ++ ${keystone_INCLUDE_DIRS} + "${LIBMEM_DIR}/external/llvm/include" ) From 653a13fb6b0db671c72892da711a7154341ea465 Mon Sep 17 00:00:00 2001 From: Saikari Date: Fri, 10 Jan 2025 07:32:31 +0300 Subject: [PATCH 53/71] test --- ports/libmem/0001-CMakeLists.patch | 238 ++++++++++++++--------------- 1 file changed, 119 insertions(+), 119 deletions(-) diff --git a/ports/libmem/0001-CMakeLists.patch b/ports/libmem/0001-CMakeLists.patch index 23759a3099eb37..ea33e86153e593 100644 --- a/ports/libmem/0001-CMakeLists.patch +++ b/ports/libmem/0001-CMakeLists.patch @@ -1,119 +1,119 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 534057a..e433396 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1,6 +1,7 @@ - cmake_minimum_required(VERSION 3.22.1) - --include(ExternalProject) -+set(CMAKE_CXX_STANDARD 17) -+file(GLOB_RECURSE LLVM_DEM_SRC "${LIBMEM_DIR}/external/llvm/lib/*.cpp") - - project(libmem - LANGUAGES -@@ -49,6 +50,7 @@ message(STATUS - message(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}") - message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") - -+if(0) - # External dependencies - set(EXTERNAL_DEPENDENCIES_DIR "${PROJECT_SOURCE_DIR}/external") - set(CAPSTONE_DIR "${EXTERNAL_DEPENDENCIES_DIR}/capstone") -@@ -67,6 +69,7 @@ add_library(keystone STATIC IMPORTED) - set_target_properties(keystone PROPERTIES IMPORTED_LOCATION ${KEYSTONE_IMPORT_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}keystone${CMAKE_STATIC_LIBRARY_SUFFIX}) - # End of external dependencies - -+endif() - set(LIBMEM_DIR "${PROJECT_SOURCE_DIR}") - set(LIBMEM_INC "${LIBMEM_DIR}/include") - set(INTERNAL_DIR "${LIBMEM_DIR}/internal") -@@ -90,23 +93,17 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD) - file(GLOB LIBMEM_SRC ${LIBMEM_ARCH_SRC} "${LIBMEM_DIR}/src/freebsd/*.c" "${LIBMEM_DIR}/src/freebsd/ptrace/*.c" "${LIBMEM_DIR}/src/common/*.c" "${LIBMEM_DIR}/src/common/*.cpp" "${INTERNAL_DIR}/posixutils/*.c" "${INTERNAL_DIR}/elfutils/*.c" "${INTERNAL_DIR}/demangler/*.cpp") - endif() - set(LIBMEM_DEPS -- capstone -- keystone -- llvm -+ capstone::capstone -+ ${keystone_LINK_LIBRARIES} - ) - --if (LIBMEM_BUILD_STATIC) -- add_library(libmem STATIC ${LIBMEM_SRC}) --else() -- add_library(libmem SHARED ${LIBMEM_SRC}) --endif() --target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}") -+add_library(libmem ${LIBMEM_SRC} ${LLVM_DEM_SRC}) -+target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}" "${LIBMEM_INC}" INTERFACE $) - - include_directories(${PROJECT_SOURCE_DIR} -- ${LIBMEM_INC} - ${CAPSTONE_INC} -- ${KEYSTONE_INC} -- ${LLVM_INC} -+ ${keystone_INCLUDE_DIRS} -+ "${LIBMEM_DIR}/external/llvm/include" - ) - - if (LIBMEM_BUILD_TESTS) -@@ -116,10 +113,6 @@ endif() - - set_target_properties(libmem PROPERTIES POSITION_INDEPENDENT_CODE True INCLUDES ${LIBMEM_INC}) - target_compile_definitions(libmem PUBLIC LM_EXPORT) --add_dependencies(libmem -- capstone-engine -- keystone-engine --) - - if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) - set(LIBMEM_DEPS -@@ -151,8 +144,11 @@ else() - message(FATAL_ERROR "[!] Unsupported platform") - endif() - -+find_package(PkgConfig) -+pkg_check_modules(keystone REQUIRED keystone) -+find_package(capstone CONFIG REQUIRED) - target_link_libraries(libmem ${LIBMEM_DEPS}) --if(LIBMEM_BUILD_STATIC) -+if(0) - # Create a bundled static library containing all dependencies (to mimic the shared library behavior) - set_target_properties(libmem PROPERTIES OUTPUT_NAME "libmem_partial") - set(libmem_bundle_files "$") -@@ -193,7 +189,7 @@ if(LIBMEM_BUILD_STATIC) - endif() - endif() - --if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) -+if(0) - if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) - cmake_path(SET CMAKE_INSTALL_PREFIX "$ENV{ProgramFiles}") - else() -@@ -202,14 +198,18 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN - endif() - set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/libmem") - execute_process(COMMAND mkdir "${CMAKE_INSTALL_PREFIX}") --else() - set(CMAKE_INSTALL_PREFIX "/usr") - endif() - --install(TARGETS libmem -- LIBRARY DESTINATION lib) -- --install(TARGETS libmem -- RUNTIME DESTINATION lib) -- --install(DIRECTORY ${LIBMEM_INC}/libmem DESTINATION include) -+install(TARGETS libmem EXPORT libmem-target -+ LIBRARY DESTINATION lib -+ ARCHIVE DESTINATION lib -+ RUNTIME DESTINATION bin -+ PUBLIC_HEADER DESTINATION "include/libmem" -+) -+install(DIRECTORY "${LIBMEM_INC}/libmem" DESTINATION "include") -+install(EXPORT libmem-target DESTINATION "share/libmem") -+include(CMakePackageConfigHelpers) -+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libmem-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" @ONLY) -+write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" VERSION 5.0.4 COMPATIBILITY SameMajorVersion) -+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" DESTINATION "share/libmem") +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 534057a..c8115ea 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,6 +1,7 @@ + cmake_minimum_required(VERSION 3.22.1) + +-include(ExternalProject) ++set(CMAKE_CXX_STANDARD 17) ++file(GLOB_RECURSE LLVM_DEM_SRC "${LIBMEM_DIR}/external/llvm/lib/*.cpp") + + project(libmem + LANGUAGES +@@ -49,6 +50,7 @@ message(STATUS + message(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}") + message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") + ++if(0) + # External dependencies + set(EXTERNAL_DEPENDENCIES_DIR "${PROJECT_SOURCE_DIR}/external") + set(CAPSTONE_DIR "${EXTERNAL_DEPENDENCIES_DIR}/capstone") +@@ -67,6 +69,7 @@ add_library(keystone STATIC IMPORTED) + set_target_properties(keystone PROPERTIES IMPORTED_LOCATION ${KEYSTONE_IMPORT_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}keystone${CMAKE_STATIC_LIBRARY_SUFFIX}) + # End of external dependencies + ++endif() + set(LIBMEM_DIR "${PROJECT_SOURCE_DIR}") + set(LIBMEM_INC "${LIBMEM_DIR}/include") + set(INTERNAL_DIR "${LIBMEM_DIR}/internal") +@@ -90,23 +93,16 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD) + file(GLOB LIBMEM_SRC ${LIBMEM_ARCH_SRC} "${LIBMEM_DIR}/src/freebsd/*.c" "${LIBMEM_DIR}/src/freebsd/ptrace/*.c" "${LIBMEM_DIR}/src/common/*.c" "${LIBMEM_DIR}/src/common/*.cpp" "${INTERNAL_DIR}/posixutils/*.c" "${INTERNAL_DIR}/elfutils/*.c" "${INTERNAL_DIR}/demangler/*.cpp") + endif() + set(LIBMEM_DEPS +- capstone +- keystone +- llvm ++ capstone::capstone ++ "${keystone_LINK_LIBRARIES}" + ) + +-if (LIBMEM_BUILD_STATIC) +- add_library(libmem STATIC ${LIBMEM_SRC}) +-else() +- add_library(libmem SHARED ${LIBMEM_SRC}) +-endif() +-target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}") ++add_library(libmem ${LIBMEM_SRC} ${LLVM_DEM_SRC}) ++target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}" "${LIBMEM_INC}" INTERFACE $) + + include_directories(${PROJECT_SOURCE_DIR} +- ${LIBMEM_INC} +- ${CAPSTONE_INC} +- ${KEYSTONE_INC} +- ${LLVM_INC} ++ "${keystone_INCLUDE_DIRS}" ++ "${LIBMEM_DIR}/external/llvm/include" + ) + + if (LIBMEM_BUILD_TESTS) +@@ -116,10 +112,6 @@ endif() + + set_target_properties(libmem PROPERTIES POSITION_INDEPENDENT_CODE True INCLUDES ${LIBMEM_INC}) + target_compile_definitions(libmem PUBLIC LM_EXPORT) +-add_dependencies(libmem +- capstone-engine +- keystone-engine +-) + + if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) + set(LIBMEM_DEPS +@@ -151,8 +143,11 @@ else() + message(FATAL_ERROR "[!] Unsupported platform") + endif() + ++find_package(PkgConfig) ++pkg_check_modules(keystone REQUIRED keystone) ++find_package(capstone CONFIG REQUIRED) + target_link_libraries(libmem ${LIBMEM_DEPS}) +-if(LIBMEM_BUILD_STATIC) ++if(0) + # Create a bundled static library containing all dependencies (to mimic the shared library behavior) + set_target_properties(libmem PROPERTIES OUTPUT_NAME "libmem_partial") + set(libmem_bundle_files "$") +@@ -193,7 +188,7 @@ if(LIBMEM_BUILD_STATIC) + endif() + endif() + +-if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) ++if(0) + if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) + cmake_path(SET CMAKE_INSTALL_PREFIX "$ENV{ProgramFiles}") + else() +@@ -202,14 +197,18 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN + endif() + set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/libmem") + execute_process(COMMAND mkdir "${CMAKE_INSTALL_PREFIX}") +-else() + set(CMAKE_INSTALL_PREFIX "/usr") + endif() + +-install(TARGETS libmem +- LIBRARY DESTINATION lib) +- +-install(TARGETS libmem +- RUNTIME DESTINATION lib) +- +-install(DIRECTORY ${LIBMEM_INC}/libmem DESTINATION include) ++install(TARGETS libmem EXPORT libmem-target ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib ++ RUNTIME DESTINATION bin ++ PUBLIC_HEADER DESTINATION "include/libmem" ++) ++install(DIRECTORY "${LIBMEM_INC}/libmem" DESTINATION "include") ++install(EXPORT libmem-target DESTINATION "share/libmem") ++include(CMakePackageConfigHelpers) ++configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libmem-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" @ONLY) ++write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" VERSION 5.0.4 COMPATIBILITY SameMajorVersion) ++install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" DESTINATION "share/libmem") From 98acc086b20e31b15103dfb60c20dfd061ffa743 Mon Sep 17 00:00:00 2001 From: Saikari Date: Fri, 10 Jan 2025 07:42:38 +0300 Subject: [PATCH 54/71] test --- ports/libmem/0001-CMakeLists.patch | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ports/libmem/0001-CMakeLists.patch b/ports/libmem/0001-CMakeLists.patch index ea33e86153e593..cb39e2bd463d24 100644 --- a/ports/libmem/0001-CMakeLists.patch +++ b/ports/libmem/0001-CMakeLists.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 534057a..c8115ea 100644 +index 534057a..496f37d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ @@ -27,9 +27,13 @@ index 534057a..c8115ea 100644 set(LIBMEM_DIR "${PROJECT_SOURCE_DIR}") set(LIBMEM_INC "${LIBMEM_DIR}/include") set(INTERNAL_DIR "${LIBMEM_DIR}/internal") -@@ -90,23 +93,16 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD) +@@ -89,24 +92,20 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD) + endif() file(GLOB LIBMEM_SRC ${LIBMEM_ARCH_SRC} "${LIBMEM_DIR}/src/freebsd/*.c" "${LIBMEM_DIR}/src/freebsd/ptrace/*.c" "${LIBMEM_DIR}/src/common/*.c" "${LIBMEM_DIR}/src/common/*.cpp" "${INTERNAL_DIR}/posixutils/*.c" "${INTERNAL_DIR}/elfutils/*.c" "${INTERNAL_DIR}/demangler/*.cpp") endif() ++find_package(PkgConfig) ++pkg_check_modules(keystone REQUIRED keystone) ++find_package(capstone CONFIG REQUIRED) set(LIBMEM_DEPS - capstone - keystone @@ -57,7 +61,7 @@ index 534057a..c8115ea 100644 ) if (LIBMEM_BUILD_TESTS) -@@ -116,10 +112,6 @@ endif() +@@ -116,10 +115,6 @@ endif() set_target_properties(libmem PROPERTIES POSITION_INDEPENDENT_CODE True INCLUDES ${LIBMEM_INC}) target_compile_definitions(libmem PUBLIC LM_EXPORT) @@ -68,13 +72,9 @@ index 534057a..c8115ea 100644 if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) set(LIBMEM_DEPS -@@ -151,8 +143,11 @@ else() - message(FATAL_ERROR "[!] Unsupported platform") +@@ -152,7 +147,7 @@ else() endif() -+find_package(PkgConfig) -+pkg_check_modules(keystone REQUIRED keystone) -+find_package(capstone CONFIG REQUIRED) target_link_libraries(libmem ${LIBMEM_DEPS}) -if(LIBMEM_BUILD_STATIC) +if(0) From bab93e3d65be0d9d408349c490a4ad458a06372f Mon Sep 17 00:00:00 2001 From: Saikari Date: Fri, 10 Jan 2025 08:14:42 +0300 Subject: [PATCH 55/71] fixup namespace --- ports/libmem/0001-CMakeLists.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/libmem/0001-CMakeLists.patch b/ports/libmem/0001-CMakeLists.patch index cb39e2bd463d24..d0611bc9a62e15 100644 --- a/ports/libmem/0001-CMakeLists.patch +++ b/ports/libmem/0001-CMakeLists.patch @@ -112,7 +112,7 @@ index 534057a..496f37d 100644 + PUBLIC_HEADER DESTINATION "include/libmem" +) +install(DIRECTORY "${LIBMEM_INC}/libmem" DESTINATION "include") -+install(EXPORT libmem-target DESTINATION "share/libmem") ++install(EXPORT libmem-target NAMESPACE libmem:: DESTINATION "share/libmem") +include(CMakePackageConfigHelpers) +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libmem-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" @ONLY) +write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" VERSION 5.0.4 COMPATIBILITY SameMajorVersion) From 89527f323a35a8380a1dc8fd86c4d737b7ec6d9a Mon Sep 17 00:00:00 2001 From: Saikari Date: Fri, 10 Jan 2025 08:28:40 +0300 Subject: [PATCH 56/71] test --- ports/libmem/0001-CMakeLists.patch | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ports/libmem/0001-CMakeLists.patch b/ports/libmem/0001-CMakeLists.patch index cb39e2bd463d24..1d97951b9ce911 100644 --- a/ports/libmem/0001-CMakeLists.patch +++ b/ports/libmem/0001-CMakeLists.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 534057a..496f37d 100644 +index 534057a..86b4136 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ @@ -47,9 +47,8 @@ index 534057a..496f37d 100644 -else() - add_library(libmem SHARED ${LIBMEM_SRC}) -endif() --target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}") +add_library(libmem ${LIBMEM_SRC} ${LLVM_DEM_SRC}) -+target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}" "${LIBMEM_INC}" INTERFACE $) + target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}") include_directories(${PROJECT_SOURCE_DIR} - ${LIBMEM_INC} @@ -112,7 +111,7 @@ index 534057a..496f37d 100644 + PUBLIC_HEADER DESTINATION "include/libmem" +) +install(DIRECTORY "${LIBMEM_INC}/libmem" DESTINATION "include") -+install(EXPORT libmem-target DESTINATION "share/libmem") ++install(EXPORT libmem-target NAMESPACE libmem:: DESTINATION "share/libmem") +include(CMakePackageConfigHelpers) +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libmem-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" @ONLY) +write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" VERSION 5.0.4 COMPATIBILITY SameMajorVersion) From 454dac85687078030769698970065934c32fd27e Mon Sep 17 00:00:00 2001 From: Saikari Date: Fri, 10 Jan 2025 08:29:02 +0300 Subject: [PATCH 57/71] ver --- versions/l-/libmem.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/libmem.json b/versions/l-/libmem.json index ba34299c064c0a..612e9d4266ac12 100644 --- a/versions/l-/libmem.json +++ b/versions/l-/libmem.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "987eb5699c7e576c1815ea1eb1c5aec745b44714", + "git-tree": "3858239c26cdf47e15b80381e29c7c0b5603005b", "version": "5.0.4", "port-version": 0 }, From 7bb76514891c61cc68470e30b383f202abdb38fc Mon Sep 17 00:00:00 2001 From: Saikari Date: Fri, 10 Jan 2025 08:35:26 +0300 Subject: [PATCH 58/71] test --- ports/libmem/0001-CMakeLists.patch | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ports/libmem/0001-CMakeLists.patch b/ports/libmem/0001-CMakeLists.patch index 1d97951b9ce911..52cf646f42c89e 100644 --- a/ports/libmem/0001-CMakeLists.patch +++ b/ports/libmem/0001-CMakeLists.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 534057a..86b4136 100644 +index 534057a..e695861 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ @@ -27,7 +27,7 @@ index 534057a..86b4136 100644 set(LIBMEM_DIR "${PROJECT_SOURCE_DIR}") set(LIBMEM_INC "${LIBMEM_DIR}/include") set(INTERNAL_DIR "${LIBMEM_DIR}/internal") -@@ -89,24 +92,20 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD) +@@ -89,24 +92,21 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD) endif() file(GLOB LIBMEM_SRC ${LIBMEM_ARCH_SRC} "${LIBMEM_DIR}/src/freebsd/*.c" "${LIBMEM_DIR}/src/freebsd/ptrace/*.c" "${LIBMEM_DIR}/src/common/*.c" "${LIBMEM_DIR}/src/common/*.cpp" "${INTERNAL_DIR}/posixutils/*.c" "${INTERNAL_DIR}/elfutils/*.c" "${INTERNAL_DIR}/demangler/*.cpp") endif() @@ -55,12 +55,13 @@ index 534057a..86b4136 100644 - ${CAPSTONE_INC} - ${KEYSTONE_INC} - ${LLVM_INC} ++ "${LIBMEM_INC}" + "${keystone_INCLUDE_DIRS}" + "${LIBMEM_DIR}/external/llvm/include" ) if (LIBMEM_BUILD_TESTS) -@@ -116,10 +115,6 @@ endif() +@@ -116,10 +116,6 @@ endif() set_target_properties(libmem PROPERTIES POSITION_INDEPENDENT_CODE True INCLUDES ${LIBMEM_INC}) target_compile_definitions(libmem PUBLIC LM_EXPORT) @@ -71,7 +72,7 @@ index 534057a..86b4136 100644 if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) set(LIBMEM_DEPS -@@ -152,7 +147,7 @@ else() +@@ -152,7 +148,7 @@ else() endif() target_link_libraries(libmem ${LIBMEM_DEPS}) @@ -80,7 +81,7 @@ index 534057a..86b4136 100644 # Create a bundled static library containing all dependencies (to mimic the shared library behavior) set_target_properties(libmem PROPERTIES OUTPUT_NAME "libmem_partial") set(libmem_bundle_files "$") -@@ -193,7 +188,7 @@ if(LIBMEM_BUILD_STATIC) +@@ -193,7 +189,7 @@ if(LIBMEM_BUILD_STATIC) endif() endif() @@ -89,7 +90,7 @@ index 534057a..86b4136 100644 if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) cmake_path(SET CMAKE_INSTALL_PREFIX "$ENV{ProgramFiles}") else() -@@ -202,14 +197,18 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN +@@ -202,14 +198,18 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN endif() set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/libmem") execute_process(COMMAND mkdir "${CMAKE_INSTALL_PREFIX}") From de8445844d5e30ffa95dce4fdffc78705f755a08 Mon Sep 17 00:00:00 2001 From: Saikari Date: Fri, 10 Jan 2025 08:35:40 +0300 Subject: [PATCH 59/71] ver --- versions/l-/libmem.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/libmem.json b/versions/l-/libmem.json index 612e9d4266ac12..96d35316936cfe 100644 --- a/versions/l-/libmem.json +++ b/versions/l-/libmem.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "3858239c26cdf47e15b80381e29c7c0b5603005b", + "git-tree": "917f9654bc7c656d9f802784f8ec31bdaa588f0f", "version": "5.0.4", "port-version": 0 }, From 58c0eb33fa97893d58a31f5fe322cd9493a5a2ea Mon Sep 17 00:00:00 2001 From: Saikari Date: Fri, 10 Jan 2025 08:42:53 +0300 Subject: [PATCH 60/71] test --- ports/libmem/0001-CMakeLists.patch | 236 ++++++++++++++--------------- 1 file changed, 117 insertions(+), 119 deletions(-) diff --git a/ports/libmem/0001-CMakeLists.patch b/ports/libmem/0001-CMakeLists.patch index 52cf646f42c89e..393e33ae494f98 100644 --- a/ports/libmem/0001-CMakeLists.patch +++ b/ports/libmem/0001-CMakeLists.patch @@ -1,119 +1,117 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 534057a..e695861 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1,6 +1,7 @@ - cmake_minimum_required(VERSION 3.22.1) - --include(ExternalProject) -+set(CMAKE_CXX_STANDARD 17) -+file(GLOB_RECURSE LLVM_DEM_SRC "${LIBMEM_DIR}/external/llvm/lib/*.cpp") - - project(libmem - LANGUAGES -@@ -49,6 +50,7 @@ message(STATUS - message(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}") - message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") - -+if(0) - # External dependencies - set(EXTERNAL_DEPENDENCIES_DIR "${PROJECT_SOURCE_DIR}/external") - set(CAPSTONE_DIR "${EXTERNAL_DEPENDENCIES_DIR}/capstone") -@@ -67,6 +69,7 @@ add_library(keystone STATIC IMPORTED) - set_target_properties(keystone PROPERTIES IMPORTED_LOCATION ${KEYSTONE_IMPORT_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}keystone${CMAKE_STATIC_LIBRARY_SUFFIX}) - # End of external dependencies - -+endif() - set(LIBMEM_DIR "${PROJECT_SOURCE_DIR}") - set(LIBMEM_INC "${LIBMEM_DIR}/include") - set(INTERNAL_DIR "${LIBMEM_DIR}/internal") -@@ -89,24 +92,21 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD) - endif() - file(GLOB LIBMEM_SRC ${LIBMEM_ARCH_SRC} "${LIBMEM_DIR}/src/freebsd/*.c" "${LIBMEM_DIR}/src/freebsd/ptrace/*.c" "${LIBMEM_DIR}/src/common/*.c" "${LIBMEM_DIR}/src/common/*.cpp" "${INTERNAL_DIR}/posixutils/*.c" "${INTERNAL_DIR}/elfutils/*.c" "${INTERNAL_DIR}/demangler/*.cpp") - endif() -+find_package(PkgConfig) -+pkg_check_modules(keystone REQUIRED keystone) -+find_package(capstone CONFIG REQUIRED) - set(LIBMEM_DEPS -- capstone -- keystone -- llvm -+ capstone::capstone -+ "${keystone_LINK_LIBRARIES}" - ) - --if (LIBMEM_BUILD_STATIC) -- add_library(libmem STATIC ${LIBMEM_SRC}) --else() -- add_library(libmem SHARED ${LIBMEM_SRC}) --endif() -+add_library(libmem ${LIBMEM_SRC} ${LLVM_DEM_SRC}) - target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}") - - include_directories(${PROJECT_SOURCE_DIR} -- ${LIBMEM_INC} -- ${CAPSTONE_INC} -- ${KEYSTONE_INC} -- ${LLVM_INC} -+ "${LIBMEM_INC}" -+ "${keystone_INCLUDE_DIRS}" -+ "${LIBMEM_DIR}/external/llvm/include" - ) - - if (LIBMEM_BUILD_TESTS) -@@ -116,10 +116,6 @@ endif() - - set_target_properties(libmem PROPERTIES POSITION_INDEPENDENT_CODE True INCLUDES ${LIBMEM_INC}) - target_compile_definitions(libmem PUBLIC LM_EXPORT) --add_dependencies(libmem -- capstone-engine -- keystone-engine --) - - if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) - set(LIBMEM_DEPS -@@ -152,7 +148,7 @@ else() - endif() - - target_link_libraries(libmem ${LIBMEM_DEPS}) --if(LIBMEM_BUILD_STATIC) -+if(0) - # Create a bundled static library containing all dependencies (to mimic the shared library behavior) - set_target_properties(libmem PROPERTIES OUTPUT_NAME "libmem_partial") - set(libmem_bundle_files "$") -@@ -193,7 +189,7 @@ if(LIBMEM_BUILD_STATIC) - endif() - endif() - --if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) -+if(0) - if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) - cmake_path(SET CMAKE_INSTALL_PREFIX "$ENV{ProgramFiles}") - else() -@@ -202,14 +198,18 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN - endif() - set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/libmem") - execute_process(COMMAND mkdir "${CMAKE_INSTALL_PREFIX}") --else() - set(CMAKE_INSTALL_PREFIX "/usr") - endif() - --install(TARGETS libmem -- LIBRARY DESTINATION lib) -- --install(TARGETS libmem -- RUNTIME DESTINATION lib) -- --install(DIRECTORY ${LIBMEM_INC}/libmem DESTINATION include) -+install(TARGETS libmem EXPORT libmem-target -+ LIBRARY DESTINATION lib -+ ARCHIVE DESTINATION lib -+ RUNTIME DESTINATION bin -+ PUBLIC_HEADER DESTINATION "include/libmem" -+) -+install(DIRECTORY "${LIBMEM_INC}/libmem" DESTINATION "include") -+install(EXPORT libmem-target NAMESPACE libmem:: DESTINATION "share/libmem") -+include(CMakePackageConfigHelpers) -+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libmem-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" @ONLY) -+write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" VERSION 5.0.4 COMPATIBILITY SameMajorVersion) -+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" DESTINATION "share/libmem") +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 534057a..a4afa93 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,6 +1,7 @@ + cmake_minimum_required(VERSION 3.22.1) + +-include(ExternalProject) ++set(CMAKE_CXX_STANDARD 17) ++file(GLOB_RECURSE LLVM_DEM_SRC "${LIBMEM_DIR}/external/llvm/lib/*.cpp") + + project(libmem + LANGUAGES +@@ -49,6 +50,7 @@ message(STATUS + message(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}") + message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") + ++if(0) + # External dependencies + set(EXTERNAL_DEPENDENCIES_DIR "${PROJECT_SOURCE_DIR}/external") + set(CAPSTONE_DIR "${EXTERNAL_DEPENDENCIES_DIR}/capstone") +@@ -67,6 +69,7 @@ add_library(keystone STATIC IMPORTED) + set_target_properties(keystone PROPERTIES IMPORTED_LOCATION ${KEYSTONE_IMPORT_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}keystone${CMAKE_STATIC_LIBRARY_SUFFIX}) + # End of external dependencies + ++endif() + set(LIBMEM_DIR "${PROJECT_SOURCE_DIR}") + set(LIBMEM_INC "${LIBMEM_DIR}/include") + set(INTERNAL_DIR "${LIBMEM_DIR}/internal") +@@ -89,24 +92,21 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD) + endif() + file(GLOB LIBMEM_SRC ${LIBMEM_ARCH_SRC} "${LIBMEM_DIR}/src/freebsd/*.c" "${LIBMEM_DIR}/src/freebsd/ptrace/*.c" "${LIBMEM_DIR}/src/common/*.c" "${LIBMEM_DIR}/src/common/*.cpp" "${INTERNAL_DIR}/posixutils/*.c" "${INTERNAL_DIR}/elfutils/*.c" "${INTERNAL_DIR}/demangler/*.cpp") + endif() ++find_package(PkgConfig) ++pkg_check_modules(keystone REQUIRED keystone) ++find_package(capstone CONFIG REQUIRED) + set(LIBMEM_DEPS +- capstone +- keystone +- llvm ++ capstone::capstone ++ "${keystone_LINK_LIBRARIES}" + ) + +-if (LIBMEM_BUILD_STATIC) +- add_library(libmem STATIC ${LIBMEM_SRC}) +-else() +- add_library(libmem SHARED ${LIBMEM_SRC}) +-endif() ++add_library(libmem ${LIBMEM_SRC} ${LLVM_DEM_SRC}) + target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}") + + include_directories(${PROJECT_SOURCE_DIR} + ${LIBMEM_INC} +- ${CAPSTONE_INC} +- ${KEYSTONE_INC} +- ${LLVM_INC} ++ "${keystone_INCLUDE_DIRS}" ++ "${LIBMEM_DIR}/external/llvm/include" + ) + + if (LIBMEM_BUILD_TESTS) +@@ -116,10 +116,6 @@ endif() + + set_target_properties(libmem PROPERTIES POSITION_INDEPENDENT_CODE True INCLUDES ${LIBMEM_INC}) + target_compile_definitions(libmem PUBLIC LM_EXPORT) +-add_dependencies(libmem +- capstone-engine +- keystone-engine +-) + + if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) + set(LIBMEM_DEPS +@@ -152,7 +148,7 @@ else() + endif() + + target_link_libraries(libmem ${LIBMEM_DEPS}) +-if(LIBMEM_BUILD_STATIC) ++if(0) + # Create a bundled static library containing all dependencies (to mimic the shared library behavior) + set_target_properties(libmem PROPERTIES OUTPUT_NAME "libmem_partial") + set(libmem_bundle_files "$") +@@ -193,7 +189,7 @@ if(LIBMEM_BUILD_STATIC) + endif() + endif() + +-if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) ++if(0) + if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) + cmake_path(SET CMAKE_INSTALL_PREFIX "$ENV{ProgramFiles}") + else() +@@ -202,14 +198,18 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN + endif() + set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/libmem") + execute_process(COMMAND mkdir "${CMAKE_INSTALL_PREFIX}") +-else() + set(CMAKE_INSTALL_PREFIX "/usr") + endif() + +-install(TARGETS libmem +- LIBRARY DESTINATION lib) +- +-install(TARGETS libmem +- RUNTIME DESTINATION lib) +- + install(DIRECTORY ${LIBMEM_INC}/libmem DESTINATION include) ++install(TARGETS libmem ++ EXPORT libmem-target ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib ++ RUNTIME DESTINATION bin ++) ++install(EXPORT libmem-target NAMESPACE libmem:: DESTINATION "share/libmem") ++include(CMakePackageConfigHelpers) ++configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libmem-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" @ONLY) ++write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" VERSION 5.0.4 COMPATIBILITY SameMajorVersion) ++install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" DESTINATION "share/libmem") From 9923aac950234b9e13c99b06f62d9dd2038473d6 Mon Sep 17 00:00:00 2001 From: Saikari Date: Fri, 10 Jan 2025 08:43:09 +0300 Subject: [PATCH 61/71] ver --- versions/l-/libmem.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/libmem.json b/versions/l-/libmem.json index 96d35316936cfe..e45a0a1b1e5547 100644 --- a/versions/l-/libmem.json +++ b/versions/l-/libmem.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "917f9654bc7c656d9f802784f8ec31bdaa588f0f", + "git-tree": "b702cf34a36f67165c03a30bb15a7a7cbe4bb58c", "version": "5.0.4", "port-version": 0 }, From 5b744777d34e134370612ca02e9dd78c4e526c5e Mon Sep 17 00:00:00 2001 From: Saikari Date: Fri, 10 Jan 2025 08:43:53 +0300 Subject: [PATCH 62/71] test --- ports/libmem/0001-CMakeLists.patch | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ports/libmem/0001-CMakeLists.patch b/ports/libmem/0001-CMakeLists.patch index 393e33ae494f98..22a3f6f5e978e6 100644 --- a/ports/libmem/0001-CMakeLists.patch +++ b/ports/libmem/0001-CMakeLists.patch @@ -104,8 +104,7 @@ index 534057a..a4afa93 100644 - RUNTIME DESTINATION lib) - install(DIRECTORY ${LIBMEM_INC}/libmem DESTINATION include) -+install(TARGETS libmem -+ EXPORT libmem-target ++install(TARGETS libmem EXPORT libmem-target + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin From 029a5584f2751bd6346b75a2d5f72ff19fb3a144 Mon Sep 17 00:00:00 2001 From: Saikari Date: Fri, 10 Jan 2025 08:44:10 +0300 Subject: [PATCH 63/71] ver --- versions/l-/libmem.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/libmem.json b/versions/l-/libmem.json index e45a0a1b1e5547..4fb8dba8359c94 100644 --- a/versions/l-/libmem.json +++ b/versions/l-/libmem.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "b702cf34a36f67165c03a30bb15a7a7cbe4bb58c", + "git-tree": "456fbd86bf41a4a19b008758a69429010145869e", "version": "5.0.4", "port-version": 0 }, From 5b65bcc28372891c0d12bba3efa1aaadc6707f4f Mon Sep 17 00:00:00 2001 From: Saikari Date: Fri, 10 Jan 2025 08:48:51 +0300 Subject: [PATCH 64/71] test --- ports/libmem/0001-CMakeLists.patch | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ports/libmem/0001-CMakeLists.patch b/ports/libmem/0001-CMakeLists.patch index 22a3f6f5e978e6..409efd09f071af 100644 --- a/ports/libmem/0001-CMakeLists.patch +++ b/ports/libmem/0001-CMakeLists.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 534057a..a4afa93 100644 +index 534057a..b6d6a39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ @@ -104,7 +104,8 @@ index 534057a..a4afa93 100644 - RUNTIME DESTINATION lib) - install(DIRECTORY ${LIBMEM_INC}/libmem DESTINATION include) -+install(TARGETS libmem EXPORT libmem-target ++install(TARGETS libmem ++ EXPORT libmem-target + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin From 923c15d66044f6ce5f5a79fd1ee329c07000fec5 Mon Sep 17 00:00:00 2001 From: Saikari Date: Fri, 10 Jan 2025 08:49:29 +0300 Subject: [PATCH 65/71] ver --- versions/l-/libmem.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/libmem.json b/versions/l-/libmem.json index 4fb8dba8359c94..6a91748e7f3be6 100644 --- a/versions/l-/libmem.json +++ b/versions/l-/libmem.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "456fbd86bf41a4a19b008758a69429010145869e", + "git-tree": "2e84e07b71f8b1f2d633d2a3671f7f23d4fb1903", "version": "5.0.4", "port-version": 0 }, From d09333953965766309356673fcc6dbffff535303 Mon Sep 17 00:00:00 2001 From: Saikari Date: Fri, 10 Jan 2025 09:06:01 +0300 Subject: [PATCH 66/71] fixup --- ports/libmem/0001-CMakeLists.patch | 234 ++++++++++++++--------------- 1 file changed, 117 insertions(+), 117 deletions(-) diff --git a/ports/libmem/0001-CMakeLists.patch b/ports/libmem/0001-CMakeLists.patch index 409efd09f071af..24ae850d0be7d4 100644 --- a/ports/libmem/0001-CMakeLists.patch +++ b/ports/libmem/0001-CMakeLists.patch @@ -1,117 +1,117 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 534057a..b6d6a39 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1,6 +1,7 @@ - cmake_minimum_required(VERSION 3.22.1) - --include(ExternalProject) -+set(CMAKE_CXX_STANDARD 17) -+file(GLOB_RECURSE LLVM_DEM_SRC "${LIBMEM_DIR}/external/llvm/lib/*.cpp") - - project(libmem - LANGUAGES -@@ -49,6 +50,7 @@ message(STATUS - message(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}") - message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") - -+if(0) - # External dependencies - set(EXTERNAL_DEPENDENCIES_DIR "${PROJECT_SOURCE_DIR}/external") - set(CAPSTONE_DIR "${EXTERNAL_DEPENDENCIES_DIR}/capstone") -@@ -67,6 +69,7 @@ add_library(keystone STATIC IMPORTED) - set_target_properties(keystone PROPERTIES IMPORTED_LOCATION ${KEYSTONE_IMPORT_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}keystone${CMAKE_STATIC_LIBRARY_SUFFIX}) - # End of external dependencies - -+endif() - set(LIBMEM_DIR "${PROJECT_SOURCE_DIR}") - set(LIBMEM_INC "${LIBMEM_DIR}/include") - set(INTERNAL_DIR "${LIBMEM_DIR}/internal") -@@ -89,24 +92,21 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD) - endif() - file(GLOB LIBMEM_SRC ${LIBMEM_ARCH_SRC} "${LIBMEM_DIR}/src/freebsd/*.c" "${LIBMEM_DIR}/src/freebsd/ptrace/*.c" "${LIBMEM_DIR}/src/common/*.c" "${LIBMEM_DIR}/src/common/*.cpp" "${INTERNAL_DIR}/posixutils/*.c" "${INTERNAL_DIR}/elfutils/*.c" "${INTERNAL_DIR}/demangler/*.cpp") - endif() -+find_package(PkgConfig) -+pkg_check_modules(keystone REQUIRED keystone) -+find_package(capstone CONFIG REQUIRED) - set(LIBMEM_DEPS -- capstone -- keystone -- llvm -+ capstone::capstone -+ "${keystone_LINK_LIBRARIES}" - ) - --if (LIBMEM_BUILD_STATIC) -- add_library(libmem STATIC ${LIBMEM_SRC}) --else() -- add_library(libmem SHARED ${LIBMEM_SRC}) --endif() -+add_library(libmem ${LIBMEM_SRC} ${LLVM_DEM_SRC}) - target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}") - - include_directories(${PROJECT_SOURCE_DIR} - ${LIBMEM_INC} -- ${CAPSTONE_INC} -- ${KEYSTONE_INC} -- ${LLVM_INC} -+ "${keystone_INCLUDE_DIRS}" -+ "${LIBMEM_DIR}/external/llvm/include" - ) - - if (LIBMEM_BUILD_TESTS) -@@ -116,10 +116,6 @@ endif() - - set_target_properties(libmem PROPERTIES POSITION_INDEPENDENT_CODE True INCLUDES ${LIBMEM_INC}) - target_compile_definitions(libmem PUBLIC LM_EXPORT) --add_dependencies(libmem -- capstone-engine -- keystone-engine --) - - if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) - set(LIBMEM_DEPS -@@ -152,7 +148,7 @@ else() - endif() - - target_link_libraries(libmem ${LIBMEM_DEPS}) --if(LIBMEM_BUILD_STATIC) -+if(0) - # Create a bundled static library containing all dependencies (to mimic the shared library behavior) - set_target_properties(libmem PROPERTIES OUTPUT_NAME "libmem_partial") - set(libmem_bundle_files "$") -@@ -193,7 +189,7 @@ if(LIBMEM_BUILD_STATIC) - endif() - endif() - --if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) -+if(0) - if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) - cmake_path(SET CMAKE_INSTALL_PREFIX "$ENV{ProgramFiles}") - else() -@@ -202,14 +198,18 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN - endif() - set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/libmem") - execute_process(COMMAND mkdir "${CMAKE_INSTALL_PREFIX}") --else() - set(CMAKE_INSTALL_PREFIX "/usr") - endif() - --install(TARGETS libmem -- LIBRARY DESTINATION lib) -- --install(TARGETS libmem -- RUNTIME DESTINATION lib) -- - install(DIRECTORY ${LIBMEM_INC}/libmem DESTINATION include) -+install(TARGETS libmem -+ EXPORT libmem-target -+ LIBRARY DESTINATION lib -+ ARCHIVE DESTINATION lib -+ RUNTIME DESTINATION bin -+) -+install(EXPORT libmem-target NAMESPACE libmem:: DESTINATION "share/libmem") -+include(CMakePackageConfigHelpers) -+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libmem-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" @ONLY) -+write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" VERSION 5.0.4 COMPATIBILITY SameMajorVersion) -+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" DESTINATION "share/libmem") +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 534057a..c6e7b97 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,6 +1,6 @@ + cmake_minimum_required(VERSION 3.22.1) + +-include(ExternalProject) ++set(CMAKE_CXX_STANDARD 17) + + project(libmem + LANGUAGES +@@ -49,6 +49,7 @@ message(STATUS + message(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}") + message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") + ++if(0) + # External dependencies + set(EXTERNAL_DEPENDENCIES_DIR "${PROJECT_SOURCE_DIR}/external") + set(CAPSTONE_DIR "${EXTERNAL_DEPENDENCIES_DIR}/capstone") +@@ -67,6 +68,7 @@ add_library(keystone STATIC IMPORTED) + set_target_properties(keystone PROPERTIES IMPORTED_LOCATION ${KEYSTONE_IMPORT_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}keystone${CMAKE_STATIC_LIBRARY_SUFFIX}) + # End of external dependencies + ++endif() + set(LIBMEM_DIR "${PROJECT_SOURCE_DIR}") + set(LIBMEM_INC "${LIBMEM_DIR}/include") + set(INTERNAL_DIR "${LIBMEM_DIR}/internal") +@@ -89,24 +91,21 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD) + endif() + file(GLOB LIBMEM_SRC ${LIBMEM_ARCH_SRC} "${LIBMEM_DIR}/src/freebsd/*.c" "${LIBMEM_DIR}/src/freebsd/ptrace/*.c" "${LIBMEM_DIR}/src/common/*.c" "${LIBMEM_DIR}/src/common/*.cpp" "${INTERNAL_DIR}/posixutils/*.c" "${INTERNAL_DIR}/elfutils/*.c" "${INTERNAL_DIR}/demangler/*.cpp") + endif() ++find_package(PkgConfig) ++pkg_check_modules(keystone REQUIRED keystone) ++find_package(capstone CONFIG REQUIRED) + set(LIBMEM_DEPS +- capstone +- keystone +- llvm ++ capstone::capstone ++ "${keystone_LINK_LIBRARIES}" + ) +- +-if (LIBMEM_BUILD_STATIC) +- add_library(libmem STATIC ${LIBMEM_SRC}) +-else() +- add_library(libmem SHARED ${LIBMEM_SRC}) +-endif() ++file(GLOB_RECURSE LLVM_DEM_SRC "${LIBMEM_DIR}/external/llvm/lib/*.cpp") ++add_library(libmem ${LIBMEM_SRC} ${LLVM_DEM_SRC}) + target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" "${COMMON_DIR}") + + include_directories(${PROJECT_SOURCE_DIR} + ${LIBMEM_INC} +- ${CAPSTONE_INC} +- ${KEYSTONE_INC} +- ${LLVM_INC} ++ "${keystone_INCLUDE_DIRS}" ++ "${LIBMEM_DIR}/external/llvm/include" + ) + + if (LIBMEM_BUILD_TESTS) +@@ -116,10 +115,6 @@ endif() + + set_target_properties(libmem PROPERTIES POSITION_INDEPENDENT_CODE True INCLUDES ${LIBMEM_INC}) + target_compile_definitions(libmem PUBLIC LM_EXPORT) +-add_dependencies(libmem +- capstone-engine +- keystone-engine +-) + + if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) + set(LIBMEM_DEPS +@@ -152,7 +147,7 @@ else() + endif() + + target_link_libraries(libmem ${LIBMEM_DEPS}) +-if(LIBMEM_BUILD_STATIC) ++if(0) + # Create a bundled static library containing all dependencies (to mimic the shared library behavior) + set_target_properties(libmem PROPERTIES OUTPUT_NAME "libmem_partial") + set(libmem_bundle_files "$") +@@ -193,7 +188,7 @@ if(LIBMEM_BUILD_STATIC) + endif() + endif() + +-if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) ++if(0) + if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) + cmake_path(SET CMAKE_INSTALL_PREFIX "$ENV{ProgramFiles}") + else() +@@ -202,14 +197,18 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN + endif() + set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/libmem") + execute_process(COMMAND mkdir "${CMAKE_INSTALL_PREFIX}") +-else() + set(CMAKE_INSTALL_PREFIX "/usr") + endif() + +-install(TARGETS libmem +- LIBRARY DESTINATION lib) +- +-install(TARGETS libmem +- RUNTIME DESTINATION lib) +- + install(DIRECTORY ${LIBMEM_INC}/libmem DESTINATION include) ++install(TARGETS libmem ++ LIBRARY DESTINATION lib ++ EXPORT libmem-target ++ ARCHIVE DESTINATION lib ++ RUNTIME DESTINATION bin ++) ++install(EXPORT libmem-target NAMESPACE libmem:: DESTINATION "share/libmem") ++include(CMakePackageConfigHelpers) ++configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libmem-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" @ONLY) ++write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" VERSION 5.0.4 COMPATIBILITY SameMajorVersion) ++install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libmem-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/libmem-config-version.cmake" DESTINATION "share/libmem") From a57199412e52f319fffb459ae70bb570c8961acc Mon Sep 17 00:00:00 2001 From: Saikari Date: Fri, 10 Jan 2025 09:06:16 +0300 Subject: [PATCH 67/71] ver --- versions/l-/libmem.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/libmem.json b/versions/l-/libmem.json index 6a91748e7f3be6..853caf7a273748 100644 --- a/versions/l-/libmem.json +++ b/versions/l-/libmem.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "2e84e07b71f8b1f2d633d2a3671f7f23d4fb1903", + "git-tree": "a847ceb54f58bb1569860a394371842c8533b92f", "version": "5.0.4", "port-version": 0 }, From 3beaa17a8a9bd8d67023b0f5da0c19fcd3786d26 Mon Sep 17 00:00:00 2001 From: Saikari Date: Fri, 10 Jan 2025 09:14:43 +0300 Subject: [PATCH 68/71] fixup --- ports/libmem/0001-CMakeLists.patch | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ports/libmem/0001-CMakeLists.patch b/ports/libmem/0001-CMakeLists.patch index 24ae850d0be7d4..14a3cb2694f212 100644 --- a/ports/libmem/0001-CMakeLists.patch +++ b/ports/libmem/0001-CMakeLists.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 534057a..c6e7b97 100644 +index 534057a..049805a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ @@ -89,7 +89,7 @@ index 534057a..c6e7b97 100644 if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN) cmake_path(SET CMAKE_INSTALL_PREFIX "$ENV{ProgramFiles}") else() -@@ -202,14 +197,18 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN +@@ -202,14 +197,17 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL CYGWIN endif() set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/libmem") execute_process(COMMAND mkdir "${CMAKE_INSTALL_PREFIX}") @@ -104,9 +104,8 @@ index 534057a..c6e7b97 100644 - RUNTIME DESTINATION lib) - install(DIRECTORY ${LIBMEM_INC}/libmem DESTINATION include) -+install(TARGETS libmem ++install(TARGETS libmem EXPORT libmem-target + LIBRARY DESTINATION lib -+ EXPORT libmem-target + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin +) From f32b0013d4fdffffce6fdeb0e41d688fed83ce75 Mon Sep 17 00:00:00 2001 From: Saikari Date: Fri, 10 Jan 2025 09:15:00 +0300 Subject: [PATCH 69/71] ver --- versions/l-/libmem.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/libmem.json b/versions/l-/libmem.json index 853caf7a273748..79b955791ca547 100644 --- a/versions/l-/libmem.json +++ b/versions/l-/libmem.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "a847ceb54f58bb1569860a394371842c8533b92f", + "git-tree": "1f851ca1aa9ecd0a88c38d20b44a6b09b3ce0d9f", "version": "5.0.4", "port-version": 0 }, From 9d9a43758c0dbea97d39464fda278430c03136cb Mon Sep 17 00:00:00 2001 From: Saikari Date: Fri, 10 Jan 2025 09:50:11 +0300 Subject: [PATCH 70/71] cleanup --- scripts/test_ports/vcpkg-ci-libmem/portfile.cmake | 3 --- scripts/test_ports/vcpkg-ci-libmem/project/CMakeLists.txt | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/test_ports/vcpkg-ci-libmem/portfile.cmake b/scripts/test_ports/vcpkg-ci-libmem/portfile.cmake index 52f74814dfe488..8a2079b2178d36 100644 --- a/scripts/test_ports/vcpkg-ci-libmem/portfile.cmake +++ b/scripts/test_ports/vcpkg-ci-libmem/portfile.cmake @@ -1,8 +1,5 @@ set(VCPKG_POLICY_EMPTY_PACKAGE enabled) -vcpkg_find_acquire_program(PKGCONFIG) vcpkg_cmake_configure( SOURCE_PATH "${CURRENT_PORT_DIR}/project" - OPTIONS - "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" ) vcpkg_cmake_build() diff --git a/scripts/test_ports/vcpkg-ci-libmem/project/CMakeLists.txt b/scripts/test_ports/vcpkg-ci-libmem/project/CMakeLists.txt index b9f41476ac2d02..f398f67ddbad99 100644 --- a/scripts/test_ports/vcpkg-ci-libmem/project/CMakeLists.txt +++ b/scripts/test_ports/vcpkg-ci-libmem/project/CMakeLists.txt @@ -1,4 +1,4 @@ -project(libmem-test LANGUAGES C CXX) +project(libmem-test) set(CMAKE_CXX_STANDARD 17) find_package(libmem CONFIG REQUIRED) add_executable(main main.cpp) From 0882a6723ce31c322c0f519f083e3f3f704ce3e7 Mon Sep 17 00:00:00 2001 From: Saikari Date: Fri, 10 Jan 2025 09:51:47 +0300 Subject: [PATCH 71/71] fmt --- scripts/test_ports/vcpkg-ci-libmem/portfile.cmake | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/test_ports/vcpkg-ci-libmem/portfile.cmake b/scripts/test_ports/vcpkg-ci-libmem/portfile.cmake index 8a2079b2178d36..bc785962c8d5de 100644 --- a/scripts/test_ports/vcpkg-ci-libmem/portfile.cmake +++ b/scripts/test_ports/vcpkg-ci-libmem/portfile.cmake @@ -1,5 +1,4 @@ set(VCPKG_POLICY_EMPTY_PACKAGE enabled) -vcpkg_cmake_configure( - SOURCE_PATH "${CURRENT_PORT_DIR}/project" -) + +vcpkg_cmake_configure(SOURCE_PATH "${CURRENT_PORT_DIR}/project") vcpkg_cmake_build()