aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/distorm
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/distorm')
-rw-r--r--vcpkg/ports/distorm/CMakeLists.txt38
-rw-r--r--vcpkg/ports/distorm/fix-arm-builds.patch12
-rw-r--r--vcpkg/ports/distorm/portfile.cmake22
-rw-r--r--vcpkg/ports/distorm/vcpkg.json15
4 files changed, 87 insertions, 0 deletions
diff --git a/vcpkg/ports/distorm/CMakeLists.txt b/vcpkg/ports/distorm/CMakeLists.txt
new file mode 100644
index 0000000..80fc920
--- /dev/null
+++ b/vcpkg/ports/distorm/CMakeLists.txt
@@ -0,0 +1,38 @@
+cmake_minimum_required(VERSION 3.8.0)
+project(distorm C)
+
+set(CMAKE_C_STANDARD 99)
+
+if(MSVC)
+ add_compile_options(/W3 /wd4005 /wd4996 /wd4018 -D_CRT_SECURE_NO_WARNINGS -DNOMINMAX)
+endif()
+
+include_directories(include src)
+
+add_library(distorm
+ src/decoder.c
+ src/distorm.c
+ src/instructions.c
+ src/insts.c
+ src/mnemonics.c
+ src/operands.c
+ src/prefix.c
+ src/textdefs.c
+)
+
+if(BUILD_SHARED_LIBS)
+ target_compile_definitions(distorm PRIVATE -DDISTORM_DYNAMIC=1 -DSUPPORT_64BIT_OFFSET=1)
+else()
+ target_compile_definitions(distorm PRIVATE -DDISTORM_STATIC=1 -DSUPPORT_64BIT_OFFSET=1)
+endif()
+
+install(
+ TARGETS distorm
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)
+
+if(NOT DISABLE_INSTALL_HEADERS)
+ install(FILES include/distorm.h include/mnemonics.h DESTINATION include)
+endif()
diff --git a/vcpkg/ports/distorm/fix-arm-builds.patch b/vcpkg/ports/distorm/fix-arm-builds.patch
new file mode 100644
index 0000000..cf29212
--- /dev/null
+++ b/vcpkg/ports/distorm/fix-arm-builds.patch
@@ -0,0 +1,12 @@
+--- a/src/textdefs.c
++++ b/src/textdefs.c
+@@ -42,7 +42,8 @@
+ s->length = len * 2;
+ s->p[len * 2] = 0;
+ do {
+- RSHORT(&s->p[i]) = RSHORT(&TextBTable[(*buf) * 2]);
++ s->p[i] = TextBTable[(*buf) * 2];
++ s->p[i + 1] = TextBTable[(*buf) * 2 + 1];
+ buf++;
+ i += 2;
+ } while (i < len * 2);
diff --git a/vcpkg/ports/distorm/portfile.cmake b/vcpkg/ports/distorm/portfile.cmake
new file mode 100644
index 0000000..bcdcbad
--- /dev/null
+++ b/vcpkg/ports/distorm/portfile.cmake
@@ -0,0 +1,22 @@
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO gdabah/distorm
+ REF 3.5.2b
+ SHA512 8AAD0C51E8D9DFAEAA069A3D4FADE4BDF87CCE464C85898B6B4888FA51A9BB6EC1221FAF32ACF59EBD047CCEB9A535B2FF93D196FD14FA834D8ECE5685417A55
+ HEAD_REF master
+ PATCHES
+ fix-arm-builds.patch
+)
+
+file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS_DEBUG
+ -DDISABLE_INSTALL_HEADERS=ON
+)
+
+vcpkg_cmake_install()
+vcpkg_copy_pdbs()
+
+file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
diff --git a/vcpkg/ports/distorm/vcpkg.json b/vcpkg/ports/distorm/vcpkg.json
new file mode 100644
index 0000000..c4daddc
--- /dev/null
+++ b/vcpkg/ports/distorm/vcpkg.json
@@ -0,0 +1,15 @@
+{
+ "name": "distorm",
+ "version-string": "3.5.2b",
+ "description": "Powerful Disassembler Library For x86/AMD64",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ]
+}