From f2131fb106c3753d991e7d22a3797a12d0bc0d38 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Illera Date: Wed, 16 Feb 2022 02:57:40 +1100 Subject: [PATCH 01/17] Add Triton port --- ports/triton/portfile.cmake | 75 +++++++++++++++++++++++++++++++++++++ ports/triton/vcpkg.json | 33 ++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 ports/triton/portfile.cmake create mode 100644 ports/triton/vcpkg.json diff --git a/ports/triton/portfile.cmake b/ports/triton/portfile.cmake new file mode 100644 index 00000000000000..13b34630e274f2 --- /dev/null +++ b/ports/triton/portfile.cmake @@ -0,0 +1,75 @@ +set(VERSION v0.9) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO JonathanSalwan/Triton + REF ${VERSION} + SHA512 f34cc9787837dc826e21997a86c32087b29ed9662bc8e0ac8ddb934978a64bdfd54c3d1303689be2a9dff4a0f3c9128219e04881e6c98f5e21a27ecd57489586 +) + +set(STATICLIB OFF) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + set(STATICLIB ON) +endif() + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + "python" PYTHON_BINDINGS +) + +if("python" IN_LIST FEATURES) + vcpkg_find_acquire_program(PYTHON3) + list(APPEND ADDITIONAL_OPTIONS + -DPYTHON_BINDINGS=ON + ) +endif() + +# Capstone path should be adapted in Windows +if(VCPKG_TARGET_IS_WINDOWS) + if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + set(CAPSTONE_LIBRARY ${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/lib/capstone${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}) + else() + set(CAPSTONE_LIBRARY ${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/lib/capstone_dll${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}) + endif() + + set(CAPSTONE_INCLUDE_DIR ${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/include/capstone) +else() + set(CAPSTONE_INCLUDE_DIR ${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/include) + set(CAPSTONE_LIBRARY ${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/lib/libcapstone${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}) +endif() + +# Z3 +set(Z3_LIBRARY ${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/lib/libz3${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}) + +message(STATUS ${ADDITIONAL_OPTIONS}) +message(STATUS ${PYTHON_BINDINGS}) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DZ3_INTERFACE=ON + -DPYTHON_BINDINGS=${PYTHON_BINDINGS} + -DBUILD_SHARED_LIBS=${STATICLIB} + -DMSVC_STATIC=ON + -DZ3_LIBRARY=${Z3_LIBRARY} + -DCAPSTONE_LIBRARY=${CAPSTONE_LIBRARY} + -DCAPSTONE_INCLUDE_DIR=${CAPSTONE_INCLUDE_DIR} + ${ADDITIONAL_OPTIONS} + +) + +vcpkg_cmake_install() +vcpkg_copy_pdbs() +vcpkg_fixup_pkgconfig() + +# Move cmake configs +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/${PORT}) + +# Remove duplicate files +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include + ${CURRENT_PACKAGES_DIR}/debug/share) + +# Handle copyright +file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) + +vcpkg_fixup_pkgconfig() diff --git a/ports/triton/vcpkg.json b/ports/triton/vcpkg.json new file mode 100644 index 00000000000000..4d16e0f2772f42 --- /dev/null +++ b/ports/triton/vcpkg.json @@ -0,0 +1,33 @@ +{ + "name": "triton", + "version-string": "v0.9", + "description": "Triton is a Dynamic Binary Analysis (DBA) framework. It provides internal components like a Dynamic Symbolic Execution (DSE) engine, a dynamic taint engine, AST representations of the x86, x86-64, ARM32 and AArch64 Instructions Set Architecture (ISA), SMT simplification passes, an SMT solver interface and, the last but not least, Python bindings.", + "homepage": "https://github.com/JonathanSalwan/Triton", + "license": "Apache-2.0", + "dependencies": [ + "boost-math", + "boost-multiprecision", + "boost-numeric-conversion", + "capstone", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + "z3" + ], + "features": { + "python": { + "description": "Build Triton with Python bindings", + "dependencies": [ + { + "name": "python3", + "default-features": false + } + ] + } + } +} From cbed831169730bd35c421c0529e267f4a590a1d7 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Illera Date: Wed, 16 Feb 2022 03:10:48 +1100 Subject: [PATCH 02/17] Delete debugging --- ports/triton/portfile.cmake | 3 --- 1 file changed, 3 deletions(-) diff --git a/ports/triton/portfile.cmake b/ports/triton/portfile.cmake index 13b34630e274f2..37e7cd00bf0db7 100644 --- a/ports/triton/portfile.cmake +++ b/ports/triton/portfile.cmake @@ -41,9 +41,6 @@ endif() # Z3 set(Z3_LIBRARY ${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/lib/libz3${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}) -message(STATUS ${ADDITIONAL_OPTIONS}) -message(STATUS ${PYTHON_BINDINGS}) - vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS From 1be452a07f0519d971b6824cfff60da8abcd2b97 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Illera Date: Wed, 16 Feb 2022 12:18:12 +1100 Subject: [PATCH 03/17] add versioning --- versions/baseline.json | 4 ++++ versions/t-/triton.json | 9 +++++++++ 2 files changed, 13 insertions(+) create mode 100644 versions/t-/triton.json diff --git a/versions/baseline.json b/versions/baseline.json index 716c99c2070b4c..d35fd12d62c3cc 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -7008,6 +7008,10 @@ "baseline": "1.6", "port-version": 2 }, + "triton": { + "baseline": "v0.9", + "port-version": 0 + }, "trompeloeil": { "baseline": "41", "port-version": 0 diff --git a/versions/t-/triton.json b/versions/t-/triton.json new file mode 100644 index 00000000000000..78ae43e1d2b534 --- /dev/null +++ b/versions/t-/triton.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "4a5375cb3821109f648393170e4a062c52cb7b8e", + "version-string": "v0.9", + "port-version": 0 + } + ] +} From 3b5fcc5462d39bb34099b6c2ff9959d289552412 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Illera Date: Wed, 16 Feb 2022 17:56:17 +1100 Subject: [PATCH 04/17] add port-version --- ports/triton/vcpkg.json | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/triton/vcpkg.json b/ports/triton/vcpkg.json index 4d16e0f2772f42..5219d29619ea48 100644 --- a/ports/triton/vcpkg.json +++ b/ports/triton/vcpkg.json @@ -1,6 +1,7 @@ { "name": "triton", "version-string": "v0.9", + "port-version": 3, "description": "Triton is a Dynamic Binary Analysis (DBA) framework. It provides internal components like a Dynamic Symbolic Execution (DSE) engine, a dynamic taint engine, AST representations of the x86, x86-64, ARM32 and AArch64 Instructions Set Architecture (ISA), SMT simplification passes, an SMT solver interface and, the last but not least, Python bindings.", "homepage": "https://github.com/JonathanSalwan/Triton", "license": "Apache-2.0", From e3c13f3703f6a62c5b0cbb98f992b6edd5b91ca1 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Illera Date: Wed, 16 Feb 2022 18:04:06 +1100 Subject: [PATCH 05/17] run x-add-version --all --- versions/baseline.json | 2 +- versions/t-/triton.json | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/versions/baseline.json b/versions/baseline.json index d35fd12d62c3cc..0bd332c65a6fd6 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -7010,7 +7010,7 @@ }, "triton": { "baseline": "v0.9", - "port-version": 0 + "port-version": 3 }, "trompeloeil": { "baseline": "41", diff --git a/versions/t-/triton.json b/versions/t-/triton.json index 78ae43e1d2b534..a327bbe1c87764 100644 --- a/versions/t-/triton.json +++ b/versions/t-/triton.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "3644b66aeb7fa748fc71da5949f104dcdc1f8951", + "version-string": "v0.9", + "port-version": 3 + }, { "git-tree": "4a5375cb3821109f648393170e4a062c52cb7b8e", "version-string": "v0.9", From ae5361262f8272a0a14b3fde70b3ed8d43a1a918 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Illera Date: Wed, 16 Feb 2022 18:07:47 +1100 Subject: [PATCH 06/17] reverse port-version --- ports/triton/vcpkg.json | 1 - versions/baseline.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/ports/triton/vcpkg.json b/ports/triton/vcpkg.json index 5219d29619ea48..4d16e0f2772f42 100644 --- a/ports/triton/vcpkg.json +++ b/ports/triton/vcpkg.json @@ -1,7 +1,6 @@ { "name": "triton", "version-string": "v0.9", - "port-version": 3, "description": "Triton is a Dynamic Binary Analysis (DBA) framework. It provides internal components like a Dynamic Symbolic Execution (DSE) engine, a dynamic taint engine, AST representations of the x86, x86-64, ARM32 and AArch64 Instructions Set Architecture (ISA), SMT simplification passes, an SMT solver interface and, the last but not least, Python bindings.", "homepage": "https://github.com/JonathanSalwan/Triton", "license": "Apache-2.0", diff --git a/versions/baseline.json b/versions/baseline.json index 0bd332c65a6fd6..d35fd12d62c3cc 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -7010,7 +7010,7 @@ }, "triton": { "baseline": "v0.9", - "port-version": 3 + "port-version": 0 }, "trompeloeil": { "baseline": "41", From 1b0cdee6c66b898632ba43a859c182ff010deaf3 Mon Sep 17 00:00:00 2001 From: JackBoosY Date: Wed, 16 Feb 2022 01:08:02 -0800 Subject: [PATCH 07/17] Fix build --- ports/triton/fix-build.patch | 21 ++++++++++++ ports/triton/fix-dependencies.patch | 37 ++++++++++++++++++++ ports/triton/portfile.cmake | 53 +++++++++++------------------ ports/triton/vcpkg.json | 2 +- 4 files changed, 78 insertions(+), 35 deletions(-) create mode 100644 ports/triton/fix-build.patch create mode 100644 ports/triton/fix-dependencies.patch diff --git a/ports/triton/fix-build.patch b/ports/triton/fix-build.patch new file mode 100644 index 00000000000000..8e71f251ce881a --- /dev/null +++ b/ports/triton/fix-build.patch @@ -0,0 +1,21 @@ +diff --git a/src/libtriton/CMakeLists.txt b/src/libtriton/CMakeLists.txt +index 7a62a92..778d801 100644 +--- a/src/libtriton/CMakeLists.txt ++++ b/src/libtriton/CMakeLists.txt +@@ -275,7 +275,7 @@ if(MSVC AND MSVC_STATIC) + endif() + + if(WIN32 AND BUILD_SHARED_LIBS) +- target_compile_definitions(triton PUBLIC TRITON_BUILDING_DLL) ++ target_compile_definitions(triton PRIVATE BUILDING_DLL) + endif() + + # Install tritonTargets.cmake +@@ -289,6 +289,7 @@ install( + install( + TARGETS triton + EXPORT tritonTargets ++ RUNTIME DESTINATION bin + PUBLIC_HEADER DESTINATION include/triton + INCLUDES DESTINATION include + ARCHIVE DESTINATION lib diff --git a/ports/triton/fix-dependencies.patch b/ports/triton/fix-dependencies.patch new file mode 100644 index 00000000000000..9d12f8be681e40 --- /dev/null +++ b/ports/triton/fix-dependencies.patch @@ -0,0 +1,37 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d62306d..e9b90cf 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -97,9 +97,9 @@ list(APPEND CMAKE_MODULE_PATH "${TRITON_ROOT}/CMakeModules/") + # Find Z3 + if(Z3_INTERFACE) + message(STATUS "Compiling with Z3 SMT solver") +- find_package(Z3 REQUIRED) +- include_directories(${Z3_INCLUDE_DIRS}) ++ find_package(Z3 CONFIG REQUIRED) + set(TRITON_Z3_INTERFACE ON) ++ set(Z3_LIBRARIES z3::libz3) + endif() + + # Find bitwuzla +diff --git a/CMakeModules/FindCAPSTONE.cmake b/CMakeModules/FindCAPSTONE.cmake +index 46d7f4a..25abae0 100644 +--- a/CMakeModules/FindCAPSTONE.cmake ++++ b/CMakeModules/FindCAPSTONE.cmake +@@ -26,13 +26,15 @@ if(NOT CAPSTONE_INCLUDE_DIRS AND NOT CAPSTONE_LIBRARIES) + NAMES capstone/capstone.h + PATHS ${CAPSTONE_PKGCONF_INCLUDE_DIRS} + ) ++ ++ string(APPEND CAPSTONE_INCLUDE_DIR "/capstone") + + if(NOT BUILD_SHARED_LIBS) + SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a") + endif() + + find_library(CAPSTONE_LIBRARY +- NAMES capstone ++ NAMES capstone capstone_dll + PATHS ${CAPSTONE_PKGCONF_LIBRARY_DIRS} + ) + diff --git a/ports/triton/portfile.cmake b/ports/triton/portfile.cmake index 37e7cd00bf0db7..8e431b7b22fcb8 100644 --- a/ports/triton/portfile.cmake +++ b/ports/triton/portfile.cmake @@ -1,22 +1,24 @@ -set(VERSION v0.9) - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO JonathanSalwan/Triton - REF ${VERSION} + REF v0.9 SHA512 f34cc9787837dc826e21997a86c32087b29ed9662bc8e0ac8ddb934978a64bdfd54c3d1303689be2a9dff4a0f3c9128219e04881e6c98f5e21a27ecd57489586 + PATCHES + fix-dependencies.patch + fix-build.patch ) -set(STATICLIB OFF) -if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - set(STATICLIB ON) -endif() +file(REMOVE "${SOURCE_PATH}/CMakeModules/FindZ3.cmake") + +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" STATICLIB) +string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" STATICCRT) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS FEATURES "python" PYTHON_BINDINGS ) +set(ADDITIONAL_OPTIONS ) if("python" IN_LIST FEATURES) vcpkg_find_acquire_program(PYTHON3) list(APPEND ADDITIONAL_OPTIONS @@ -24,34 +26,19 @@ if("python" IN_LIST FEATURES) ) endif() -# Capstone path should be adapted in Windows -if(VCPKG_TARGET_IS_WINDOWS) - if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - set(CAPSTONE_LIBRARY ${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/lib/capstone${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}) - else() - set(CAPSTONE_LIBRARY ${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/lib/capstone_dll${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}) - endif() - - set(CAPSTONE_INCLUDE_DIR ${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/include/capstone) -else() - set(CAPSTONE_INCLUDE_DIR ${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/include) - set(CAPSTONE_LIBRARY ${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/lib/libcapstone${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}) -endif() - -# Z3 -set(Z3_LIBRARY ${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/lib/libz3${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}) - vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS + ${FEATURE_OPTIONS} -DZ3_INTERFACE=ON - -DPYTHON_BINDINGS=${PYTHON_BINDINGS} -DBUILD_SHARED_LIBS=${STATICLIB} - -DMSVC_STATIC=ON - -DZ3_LIBRARY=${Z3_LIBRARY} - -DCAPSTONE_LIBRARY=${CAPSTONE_LIBRARY} - -DCAPSTONE_INCLUDE_DIR=${CAPSTONE_INCLUDE_DIR} + -DMSVC_STATIC=${STATICCRT} + -DCAPSTONE_PKGCONF_INCLUDE_DIRS="${CURRENT_INSTALLED_DIR}/include" ${ADDITIONAL_OPTIONS} + OPTIONS_DEBUG + -DCAPSTONE_PKGCONF_LIBRARY_DIRS="${CURRENT_INSTALLED_DIR}/debug/lib" + OPTIONS_RELEASE + -DCAPSTONE_PKGCONF_LIBRARY_DIRS="${CURRENT_INSTALLED_DIR}/lib" ) @@ -63,10 +50,8 @@ vcpkg_fixup_pkgconfig() vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/${PORT}) # Remove duplicate files -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") # Handle copyright -file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) - -vcpkg_fixup_pkgconfig() +file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/triton/vcpkg.json b/ports/triton/vcpkg.json index 4d16e0f2772f42..9bcd2ea90ed447 100644 --- a/ports/triton/vcpkg.json +++ b/ports/triton/vcpkg.json @@ -1,6 +1,6 @@ { "name": "triton", - "version-string": "v0.9", + "version": "0.9", "description": "Triton is a Dynamic Binary Analysis (DBA) framework. It provides internal components like a Dynamic Symbolic Execution (DSE) engine, a dynamic taint engine, AST representations of the x86, x86-64, ARM32 and AArch64 Instructions Set Architecture (ISA), SMT simplification passes, an SMT solver interface and, the last but not least, Python bindings.", "homepage": "https://github.com/JonathanSalwan/Triton", "license": "Apache-2.0", From 7228b33b3b1419503990c47afbf1e87fddb74ed8 Mon Sep 17 00:00:00 2001 From: JackBoosY Date: Wed, 16 Feb 2022 01:29:59 -0800 Subject: [PATCH 08/17] Fix usage --- ports/triton/fix-usage.patch | 23 +++++++++++++++++++++++ ports/triton/portfile.cmake | 1 + 2 files changed, 24 insertions(+) create mode 100644 ports/triton/fix-usage.patch diff --git a/ports/triton/fix-usage.patch b/ports/triton/fix-usage.patch new file mode 100644 index 00000000000000..f5a5133e134e8a --- /dev/null +++ b/ports/triton/fix-usage.patch @@ -0,0 +1,23 @@ +diff --git a/src/libtriton/Config.cmake.in b/src/libtriton/Config.cmake.in +index 0464166..35549dd 100644 +--- a/src/libtriton/Config.cmake.in ++++ b/src/libtriton/Config.cmake.in +@@ -1,5 +1,12 @@ + @PACKAGE_INIT@ + ++include(CMakeFindDependencyMacro) ++find_dependency(CAPSTONE) ++find_dependency(Boost) ++if (@Z3_INTERFACE@) ++ find_dependency(Z3 CONFIG) ++endif() ++ + include("${CMAKE_CURRENT_LIST_DIR}/tritonTargets.cmake") + + set(TRITON_ARCHIVE "@CMAKE_INSTALL_PREFIX@/lib/@CMAKE_STATIC_LIBRARY_PREFIX@triton@CMAKE_STATIC_LIBRARY_SUFFIX@") +@@ -16,5 +23,3 @@ set(TRITON_Z3_INTERFACE @Z3_INTERFACE@) + + message(STATUS "Found Triton: ${CMAKE_CURRENT_LIST_DIR}/tritonConfig.cmake (found version ${TRITON_VERSION})") + +-include(CMakeFindDependencyMacro) +-find_dependency(Boost) diff --git a/ports/triton/portfile.cmake b/ports/triton/portfile.cmake index 8e431b7b22fcb8..3de99111b3c409 100644 --- a/ports/triton/portfile.cmake +++ b/ports/triton/portfile.cmake @@ -5,6 +5,7 @@ vcpkg_from_github( SHA512 f34cc9787837dc826e21997a86c32087b29ed9662bc8e0ac8ddb934978a64bdfd54c3d1303689be2a9dff4a0f3c9128219e04881e6c98f5e21a27ecd57489586 PATCHES fix-dependencies.patch + fix-usage.patch fix-build.patch ) From d2739c28c2d51a9aa9358c8cdcf23492cbcf4c95 Mon Sep 17 00:00:00 2001 From: JackBoosY Date: Wed, 16 Feb 2022 23:10:41 -0800 Subject: [PATCH 09/17] Not support arm triplets --- ports/triton/vcpkg.json | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/triton/vcpkg.json b/ports/triton/vcpkg.json index 9bcd2ea90ed447..28327bb9f8b986 100644 --- a/ports/triton/vcpkg.json +++ b/ports/triton/vcpkg.json @@ -4,6 +4,7 @@ "description": "Triton is a Dynamic Binary Analysis (DBA) framework. It provides internal components like a Dynamic Symbolic Execution (DSE) engine, a dynamic taint engine, AST representations of the x86, x86-64, ARM32 and AArch64 Instructions Set Architecture (ISA), SMT simplification passes, an SMT solver interface and, the last but not least, Python bindings.", "homepage": "https://github.com/JonathanSalwan/Triton", "license": "Apache-2.0", + "supports": "!arm", "dependencies": [ "boost-math", "boost-multiprecision", From 025ce377642b59f2f9b69f3ebe91c4506b1e42ca Mon Sep 17 00:00:00 2001 From: JackBoosY Date: Sun, 20 Feb 2022 22:27:15 -0800 Subject: [PATCH 10/17] Update to the fix commit --- ports/triton/fix-build.patch | 21 --------------------- ports/triton/fix-dependencies.patch | 12 ++++-------- ports/triton/fix-usage.patch | 21 ++++++--------------- ports/triton/portfile.cmake | 5 ++--- 4 files changed, 12 insertions(+), 47 deletions(-) delete mode 100644 ports/triton/fix-build.patch diff --git a/ports/triton/fix-build.patch b/ports/triton/fix-build.patch deleted file mode 100644 index 8e71f251ce881a..00000000000000 --- a/ports/triton/fix-build.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff --git a/src/libtriton/CMakeLists.txt b/src/libtriton/CMakeLists.txt -index 7a62a92..778d801 100644 ---- a/src/libtriton/CMakeLists.txt -+++ b/src/libtriton/CMakeLists.txt -@@ -275,7 +275,7 @@ if(MSVC AND MSVC_STATIC) - endif() - - if(WIN32 AND BUILD_SHARED_LIBS) -- target_compile_definitions(triton PUBLIC TRITON_BUILDING_DLL) -+ target_compile_definitions(triton PRIVATE BUILDING_DLL) - endif() - - # Install tritonTargets.cmake -@@ -289,6 +289,7 @@ install( - install( - TARGETS triton - EXPORT tritonTargets -+ RUNTIME DESTINATION bin - PUBLIC_HEADER DESTINATION include/triton - INCLUDES DESTINATION include - ARCHIVE DESTINATION lib diff --git a/ports/triton/fix-dependencies.patch b/ports/triton/fix-dependencies.patch index 9d12f8be681e40..0d55d583acd0b8 100644 --- a/ports/triton/fix-dependencies.patch +++ b/ports/triton/fix-dependencies.patch @@ -1,8 +1,8 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index d62306d..e9b90cf 100644 +index a8bbe47..966ded8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -97,9 +97,9 @@ list(APPEND CMAKE_MODULE_PATH "${TRITON_ROOT}/CMakeModules/") +@@ -99,9 +99,9 @@ list(APPEND CMAKE_MODULE_PATH "${TRITON_ROOT}/CMakeModules/") # Find Z3 if(Z3_INTERFACE) message(STATUS "Compiling with Z3 SMT solver") @@ -15,20 +15,16 @@ index d62306d..e9b90cf 100644 # Find bitwuzla diff --git a/CMakeModules/FindCAPSTONE.cmake b/CMakeModules/FindCAPSTONE.cmake -index 46d7f4a..25abae0 100644 +index ff2c63f..4dcf9af 100644 --- a/CMakeModules/FindCAPSTONE.cmake +++ b/CMakeModules/FindCAPSTONE.cmake -@@ -26,13 +26,15 @@ if(NOT CAPSTONE_INCLUDE_DIRS AND NOT CAPSTONE_LIBRARIES) +@@ -26,9 +26,11 @@ if(NOT CAPSTONE_INCLUDE_DIRS AND NOT CAPSTONE_LIBRARIES) NAMES capstone/capstone.h PATHS ${CAPSTONE_PKGCONF_INCLUDE_DIRS} ) + + string(APPEND CAPSTONE_INCLUDE_DIR "/capstone") - if(NOT BUILD_SHARED_LIBS) - SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a") - endif() - find_library(CAPSTONE_LIBRARY - NAMES capstone + NAMES capstone capstone_dll diff --git a/ports/triton/fix-usage.patch b/ports/triton/fix-usage.patch index f5a5133e134e8a..931ce2239797c6 100644 --- a/ports/triton/fix-usage.patch +++ b/ports/triton/fix-usage.patch @@ -1,23 +1,14 @@ diff --git a/src/libtriton/Config.cmake.in b/src/libtriton/Config.cmake.in -index 0464166..35549dd 100644 +index 683b5f2..94c58bc 100644 --- a/src/libtriton/Config.cmake.in +++ b/src/libtriton/Config.cmake.in -@@ -1,5 +1,12 @@ - @PACKAGE_INIT@ +@@ -19,6 +19,9 @@ message(STATUS "Found Triton: ${CMAKE_CURRENT_LIST_DIR}/tritonConfig.cmake (foun -+include(CMakeFindDependencyMacro) -+find_dependency(CAPSTONE) -+find_dependency(Boost) + include(CMakeFindDependencyMacro) + find_dependency(Boost) +if (@Z3_INTERFACE@) + find_dependency(Z3 CONFIG) +endif() -+ - include("${CMAKE_CURRENT_LIST_DIR}/tritonTargets.cmake") - set(TRITON_ARCHIVE "@CMAKE_INSTALL_PREFIX@/lib/@CMAKE_STATIC_LIBRARY_PREFIX@triton@CMAKE_STATIC_LIBRARY_SUFFIX@") -@@ -16,5 +23,3 @@ set(TRITON_Z3_INTERFACE @Z3_INTERFACE@) - - message(STATUS "Found Triton: ${CMAKE_CURRENT_LIST_DIR}/tritonConfig.cmake (found version ${TRITON_VERSION})") - --include(CMakeFindDependencyMacro) --find_dependency(Boost) + # Triton include + include_directories("@CMAKE_INSTALL_PREFIX@/include") diff --git a/ports/triton/portfile.cmake b/ports/triton/portfile.cmake index 3de99111b3c409..1fb918656f0e48 100644 --- a/ports/triton/portfile.cmake +++ b/ports/triton/portfile.cmake @@ -1,12 +1,11 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO JonathanSalwan/Triton - REF v0.9 - SHA512 f34cc9787837dc826e21997a86c32087b29ed9662bc8e0ac8ddb934978a64bdfd54c3d1303689be2a9dff4a0f3c9128219e04881e6c98f5e21a27ecd57489586 + REF 64a2b9b0490c82e41b37e623b1d0da14e2382e7a + SHA512 ff99a270813043df2bc0da765e04aae4b9d5a911d20c6e5ffca1472eae8d6e1fcfff3cd56da023d6a77a647644839430bf72902acd84ec521a0e098f185d275c PATCHES fix-dependencies.patch fix-usage.patch - fix-build.patch ) file(REMOVE "${SOURCE_PATH}/CMakeModules/FindZ3.cmake") From 0b5b19a032919bbab87527035523d05be10d09df Mon Sep 17 00:00:00 2001 From: JackBoosY Date: Sun, 20 Feb 2022 22:35:51 -0800 Subject: [PATCH 11/17] Disable examples and tests --- ports/triton/portfile.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/triton/portfile.cmake b/ports/triton/portfile.cmake index 1fb918656f0e48..cf92fc287ca87b 100644 --- a/ports/triton/portfile.cmake +++ b/ports/triton/portfile.cmake @@ -33,6 +33,8 @@ vcpkg_cmake_configure( -DZ3_INTERFACE=ON -DBUILD_SHARED_LIBS=${STATICLIB} -DMSVC_STATIC=${STATICCRT} + -DBUILD_EXAMPLES=OFF + -DENABLE_TEST=OFF -DCAPSTONE_PKGCONF_INCLUDE_DIRS="${CURRENT_INSTALLED_DIR}/include" ${ADDITIONAL_OPTIONS} OPTIONS_DEBUG From 0239994849e2e62a4d71da5f7366b9ce90539e39 Mon Sep 17 00:00:00 2001 From: JackBoosY Date: Sun, 20 Feb 2022 22:40:31 -0800 Subject: [PATCH 12/17] version --- versions/baseline.json | 2 +- versions/t-/triton.json | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/versions/baseline.json b/versions/baseline.json index d35fd12d62c3cc..ad90c70512a791 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -7009,7 +7009,7 @@ "port-version": 2 }, "triton": { - "baseline": "v0.9", + "baseline": "0.9", "port-version": 0 }, "trompeloeil": { diff --git a/versions/t-/triton.json b/versions/t-/triton.json index a327bbe1c87764..f20567f8a09c44 100644 --- a/versions/t-/triton.json +++ b/versions/t-/triton.json @@ -1,13 +1,8 @@ { "versions": [ { - "git-tree": "3644b66aeb7fa748fc71da5949f104dcdc1f8951", - "version-string": "v0.9", - "port-version": 3 - }, - { - "git-tree": "4a5375cb3821109f648393170e4a062c52cb7b8e", - "version-string": "v0.9", + "git-tree": "0233733eb99df99fc20df6f1d85790c6f03db749", + "version": "0.9", "port-version": 0 } ] From 6a333d00001a62c61615b3148ce16ea1cd042e31 Mon Sep 17 00:00:00 2001 From: JackBoosY Date: Sun, 20 Feb 2022 23:37:04 -0800 Subject: [PATCH 13/17] fix feature python --- ports/triton/fix-python.patch | 27 +++++++++++++++++++++++++++ ports/triton/portfile.cmake | 5 +++-- 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 ports/triton/fix-python.patch diff --git a/ports/triton/fix-python.patch b/ports/triton/fix-python.patch new file mode 100644 index 00000000000000..19c0604f500965 --- /dev/null +++ b/ports/triton/fix-python.patch @@ -0,0 +1,27 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 966ded8..baf0ec3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -52,7 +52,6 @@ if(PYTHON_BINDINGS) + find_package(PythonInterp ${PYTHON_VERSION} REQUIRED) + find_package(PythonLibs ${PYTHON_VERSION} REQUIRED) + include_directories(${PYTHON_INCLUDE_DIRS}) +- add_definitions("-DPYTHON_LIBRARIES=\"${PYTHON_LIBRARIES}\"") + add_custom_target(test-python + COMMAND ${PYTHONPATH_CMD} ${PYTHON_EXECUTABLE} -m unittest discover ${TRITON_ROOT}/src/testers/unittests + DEPENDS python-triton +diff --git a/src/libtriton/CMakeLists.txt b/src/libtriton/CMakeLists.txt +index 6770b08..701d55b 100644 +--- a/src/libtriton/CMakeLists.txt ++++ b/src/libtriton/CMakeLists.txt +@@ -326,8 +326,8 @@ if(PYTHON_BINDINGS) + ) + execute_process (COMMAND ${PYTHON_EXECUTABLE} -c "from sysconfig import get_path; print(get_path('platlib'))" OUTPUT_VARIABLE PYTHON_SITE_PACKAGES OUTPUT_STRIP_TRAILING_WHITESPACE) + if(${CMAKE_SYSTEM_NAME} MATCHES "Windows" AND NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "GNU") +- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/\${CMAKE_INSTALL_CONFIG_NAME}/triton${PYTHON_SUFFIX} DESTINATION ${PYTHON_SITE_PACKAGES}) ++ install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_CONFIG_NAME}/triton${PYTHON_SUFFIX} DESTINATION share/triton) + else() +- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/triton${PYTHON_SUFFIX} DESTINATION ${PYTHON_SITE_PACKAGES}) ++ install (FILES ${CMAKE_CURRENT_BINARY_DIR}/triton${PYTHON_SUFFIX} DESTINATION share/triton) + endif() + endif() diff --git a/ports/triton/portfile.cmake b/ports/triton/portfile.cmake index cf92fc287ca87b..90e25594fd71a5 100644 --- a/ports/triton/portfile.cmake +++ b/ports/triton/portfile.cmake @@ -6,6 +6,7 @@ vcpkg_from_github( PATCHES fix-dependencies.patch fix-usage.patch + fix-python.patch ) file(REMOVE "${SOURCE_PATH}/CMakeModules/FindZ3.cmake") @@ -19,10 +20,10 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS ) set(ADDITIONAL_OPTIONS ) -if("python" IN_LIST FEATURES) +if(PYTHON_BINDINGS) vcpkg_find_acquire_program(PYTHON3) list(APPEND ADDITIONAL_OPTIONS - -DPYTHON_BINDINGS=ON + -DPYTHON_EXECUTABLE=${PYTHON3} ) endif() From 07d8ebb326176dbac48c1b2fdbff6976de5b0702 Mon Sep 17 00:00:00 2001 From: JackBoosY Date: Sun, 20 Feb 2022 23:37:23 -0800 Subject: [PATCH 14/17] version --- versions/t-/triton.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/t-/triton.json b/versions/t-/triton.json index f20567f8a09c44..294b39108eab06 100644 --- a/versions/t-/triton.json +++ b/versions/t-/triton.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "0233733eb99df99fc20df6f1d85790c6f03db749", + "git-tree": "7bb96cd4335af94137d15e10afd60be62a8f6e6d", "version": "0.9", "port-version": 0 } From 369f44840a9d678394986d486e5590b86fc488db Mon Sep 17 00:00:00 2001 From: Alberto Garcia Illera Date: Mon, 21 Feb 2022 21:43:41 +1100 Subject: [PATCH 15/17] require specifig features of capstone to build Triton --- ports/triton/vcpkg.json | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ports/triton/vcpkg.json b/ports/triton/vcpkg.json index 28327bb9f8b986..925f912f01feae 100644 --- a/ports/triton/vcpkg.json +++ b/ports/triton/vcpkg.json @@ -9,7 +9,16 @@ "boost-math", "boost-multiprecision", "boost-numeric-conversion", - "capstone", + { + "name": "capstone", + "default-features": false, + "features": [ + "arm", + "arm64", + "static-crt", + "x86" + ] + }, { "name": "vcpkg-cmake", "host": true From b9fb1ce07bd4393271475d3469b81c374371ce39 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Illera Date: Mon, 21 Feb 2022 23:26:31 +1100 Subject: [PATCH 16/17] remove static-crt feature from capstone --- ports/triton/vcpkg.json | 1 - 1 file changed, 1 deletion(-) diff --git a/ports/triton/vcpkg.json b/ports/triton/vcpkg.json index 925f912f01feae..1b138346442119 100644 --- a/ports/triton/vcpkg.json +++ b/ports/triton/vcpkg.json @@ -15,7 +15,6 @@ "features": [ "arm", "arm64", - "static-crt", "x86" ] }, From b538e4f6c7cf06764911b6f6e77121bca1f3d513 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Illera Date: Mon, 21 Feb 2022 23:29:00 +1100 Subject: [PATCH 17/17] add versioning --- versions/t-/triton.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/t-/triton.json b/versions/t-/triton.json index 294b39108eab06..d81bb00f79ebcf 100644 --- a/versions/t-/triton.json +++ b/versions/t-/triton.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "7bb96cd4335af94137d15e10afd60be62a8f6e6d", + "git-tree": "168cc90ef1373fadb8b05ad53430eb37a022dd50", "version": "0.9", "port-version": 0 }