Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ports/triton/CONTROL
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Source: triton
Version: dev-v0.9
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the version uses a unstable one. I noticed that there are also released versions. Why do you not use the latest release here?

Also, please follow the new policy to rename this field in vcpkg.json.

https://github.com/microsoft/vcpkg/blob/master/docs/users/versioning.md
https://github.com/microsoft/vcpkg/blob/master/docs/users/versioning.reference.md

Homepage: https://github.com/JonathanSalwan/Triton
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.
Build-Depends: z3, capstone, boost-multiprecision, boost-numeric-conversion, boost-math
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

67 changes: 67 additions & 0 deletions ports/triton/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@

set(VERSION dev-v0.9)
vcpkg_download_distfile(ARCHIVE
URLS "https://api.github.com/repos/JonathanSalwan/Triton/tarball/${VERSION}"
FILENAME "triton-${VERSION}.tar.gz"
SHA512 7d33f2654cae4868fbbcb3a3ec709c8f5f2e692c6d989cd2c9c95886b9623731d399ae23c7b4189be239c388c07b89bdd415bbf215bffed629ce50d8785079b4
)

vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
REF ${VERSION}
)

set(STATICLIB OFF)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(STATICLIB 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})


vcpkg_configure_cmake(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also prefer to use the new functions in a new port. Since the current functions have deprecated. Please see
https://github.com/microsoft/vcpkg/blob/master/docs/maintainers/vcpkg_configure_cmake.md

Other functions like vcpkg_install_cmake() also needs to be updated.

If we use new functions, vcpkg-cmake is required to be added as a dependency like this:

{
 "name": "vcpkg-cmake",
 "host": true
}

SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DZ3_INTERFACE=${Z3_INTERFACE}
-DPYTHON_BINDINGS=${PYTHON_BINDINGS}
-DPYTHON36=${PYTHON36}
-DSTATICLIB=${STATICLIB}
-DZ3_LIBRARY=${Z3_LIBRARY}
-DCAPSTONE_LIBRARY=${CAPSTONE_LIBRARY}
-DCAPSTONE_INCLUDE_DIR=${CAPSTONE_INCLUDE_DIR}
-DPYTHON_INCLUDE_DIR="${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/include"
-DPYTHON_LIBRARY=${PYTHON_LIBRARY}
)

vcpkg_install_cmake()
vcpkg_copy_pdbs()

configure_file("${CURRENT_BUILDTREES_DIR}/src/dev-v0.9-fd0ccd4864.clean/LICENSE.txt" "${CURRENT_PACKAGES_DIR}/share/triton/copyright" COPYONLY)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
configure_file("${CURRENT_BUILDTREES_DIR}/src/dev-v0.9-fd0ccd4864.clean/LICENSE.txt" "${CURRENT_PACKAGES_DIR}/share/triton/copyright" COPYONLY)
configure_file("${CURRENT_BUILDTREES_DIR}/src/dev-v0.9-fd0ccd4864.clean/LICENSE.txt" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" COPYONLY)


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

if(EXISTS ${CURRENT_PACKAGES_DIR}/lib/triton.dll)
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin)
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/triton.dll ${CURRENT_PACKAGES_DIR}/bin/triton.dll)
endif()
if(EXISTS ${CURRENT_PACKAGES_DIR}/debug/lib/triton.dll)
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/triton.dll ${CURRENT_PACKAGES_DIR}/debug/bin/triton.dll)
endif()