diff --git a/ports/libmem/0001-CMakeLists.patch b/ports/libmem/0001-CMakeLists.patch index 14a3cb2694f212..c2bdf7d9715d33 100644 --- a/ports/libmem/0001-CMakeLists.patch +++ b/ports/libmem/0001-CMakeLists.patch @@ -1,116 +1,121 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 534057a..049805a 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,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}") --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..049805a 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") +@@ -66,6 +67,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") +@@ -89,10 +91,17 @@ 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 IMPORTED_TARGET keystone) ++find_package(capstone CONFIG REQUIRED) ++find_package(LLVM CONFIG REQUIRED) ++target_compile_definitions(LLVMDemangle INTERFACE ${LLVM_DEFINITIONS}) ++target_include_directories(LLVMDemangle INTERFACE ${LLVM_INCLUDE_DIRS}) ++ + set(LIBMEM_DEPS +- capstone +- keystone +- llvm ++ capstone::capstone ++ PkgConfig::keystone ++ LLVMDemangle + ) + + if (LIBMEM_BUILD_STATIC) +@@ -104,9 +113,6 @@ target_include_directories(libmem PRIVATE "${LIBMEM_DIR}/src" "${INTERNAL_DIR}" + + include_directories(${PROJECT_SOURCE_DIR} + ${LIBMEM_INC} +- ${CAPSTONE_INC} +- ${KEYSTONE_INC} +- ${LLVM_INC} + ) + + if (LIBMEM_BUILD_TESTS) +@@ -116,10 +122,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 +154,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 +195,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 +204,25 @@ 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-targets ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib ++ RUNTIME DESTINATION bin ++) ++install(EXPORT libmem-targets NAMESPACE libmem:: DESTINATION "share/libmem") ++include(CMakePackageConfigHelpers) ++configure_package_config_file( ++ "${CMAKE_CURRENT_LIST_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/libmem-config.cmake.in b/ports/libmem/libmem-config.cmake.in index 708fa1ed0c65a3..9f4067cd9725d4 100644 --- a/ports/libmem/libmem-config.cmake.in +++ b/ports/libmem/libmem-config.cmake.in @@ -1,5 +1,11 @@ @PACKAGE_INIT@ include(CMakeFindDependencyMacro) + find_dependency(capstone CONFIG) -include("${CMAKE_CURRENT_LIST_DIR}/libmem-target.cmake") -check_required_components(libmem) + +find_dependency(PkgConfig) +pkg_check_modules(keystone REQUIRED IMPORTED_TARGET keystone) + +find_dependency(LLVM CONFIG) + +include("${CMAKE_CURRENT_LIST_DIR}/libmem-targets.cmake") diff --git a/ports/libmem/portfile.cmake b/ports/libmem/portfile.cmake index 65c58dd5396a57..68e7f2aee5ff4b 100644 --- a/ports/libmem/portfile.cmake +++ b/ports/libmem/portfile.cmake @@ -10,9 +10,13 @@ vcpkg_from_github( file(REMOVE "${SOURCE_PATH}/PreLoad.cmake") file(COPY "${CMAKE_CURRENT_LIST_DIR}/libmem-config.cmake.in" DESTINATION "${SOURCE_PATH}") vcpkg_find_acquire_program(PKGCONFIG) +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" LIBMEM_BUILD_STATIC) vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS + -DLIBMEM_BUILD_TESTS=OFF + -DLIBMEM_DEEP_TESTS=OFF + -DLIBMEM_BUILD_STATIC=${LIBMEM_BUILD_STATIC} "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" ) vcpkg_cmake_install() diff --git a/ports/libmem/vcpkg.json b/ports/libmem/vcpkg.json index 2e160634a714bb..857f9d00ed9b1c 100644 --- a/ports/libmem/vcpkg.json +++ b/ports/libmem/vcpkg.json @@ -1,6 +1,7 @@ { "name": "libmem", "version": "5.0.4", + "port-version": 2, "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", @@ -8,6 +9,10 @@ "dependencies": [ "capstone", "keystone", + { + "name": "llvm", + "default-features": false + }, { "name": "vcpkg-cmake", "host": true diff --git a/scripts/azure-pipelines/azure-pipelines.yml b/scripts/azure-pipelines/azure-pipelines.yml index 132e66793f35b6..b0097c9fb602ed 100644 --- a/scripts/azure-pipelines/azure-pipelines.yml +++ b/scripts/azure-pipelines/azure-pipelines.yml @@ -1,3 +1,5 @@ +fail() + # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: MIT # @@ -12,7 +14,7 @@ parameters: - name: tripletPattern displayName: 'Enable triplets which contain this substring' type: string - default: '-' + default: '_' jobs: - template: windows/azure-pipelines.yml diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 472df7f96b4a1d..73c80237e76ac0 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -536,8 +536,6 @@ libdc1394:arm64-android=fail libflac:arm-neon-android=fail libfreenect2:arm64-windows=fail libfreenect2:arm64-windows-static-md=fail -# inline assembly requires more registers than available -libgcrypt:x64-android=fail # error: call to undeclared function 'mktime_z' libgnutls:arm-neon-android=fail libgnutls:arm64-android=fail @@ -579,6 +577,16 @@ libmariadb:x64-windows-static-md=skip libmaxminddb:arm64-android=fail libmaxminddb:arm-neon-android=fail libmaxminddb:x64-android=fail +# libmem embedded lib llvm, fixing in https://github.com/microsoft/vcpkg/pull/43311 +libmem:arm64-uwp =skip +libmem:arm64-windows =skip +libmem:arm64-windows-static-md =skip +libmem:x64-linux =skip +libmem:x64-uwp =skip +libmem:x64-windows =skip +libmem:x64-windows-static =skip +libmem:x64-windows-static-md =skip +libmem:x86-windows =skip # libmesh installs tons of problematic files that conflict with other ports (boost, eigen, etc) libmesh:x64-linux=skip libmikmod:arm-neon-android=fail diff --git a/versions/baseline.json b/versions/baseline.json index 9fbdb6bf34425f..771e4a3ce0446a 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4790,7 +4790,7 @@ }, "libmem": { "baseline": "5.0.4", - "port-version": 0 + "port-version": 2 }, "libmesh": { "baseline": "1.5.0", diff --git a/versions/l-/libmem.json b/versions/l-/libmem.json index 79b955791ca547..b4bdbd574b3bb5 100644 --- a/versions/l-/libmem.json +++ b/versions/l-/libmem.json @@ -1,5 +1,15 @@ { "versions": [ + { + "git-tree": "cf4ee8b8768d991b6fe6d62f4abebd2f24e05a62", + "version": "5.0.4", + "port-version": 2 + }, + { + "git-tree": "e2f84592970ebe7a3daee5da032c04020cff2496", + "version": "5.0.4", + "port-version": 1 + }, { "git-tree": "1f851ca1aa9ecd0a88c38d20b44a6b09b3ce0d9f", "version": "5.0.4",