diff --git a/ports/unicorn/fix-build.patch b/ports/unicorn/fix-build.patch index 6e1cafcd49..348e2bdb0e 100644 --- a/ports/unicorn/fix-build.patch +++ b/ports/unicorn/fix-build.patch @@ -1,17 +1,17 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 4110ae5..a86b207 100644 +index 3fcde11..1acc0b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -109,7 +109,7 @@ if(MSVC) - add_compile_options($<$:/wd4267>) - +@@ -128,7 +128,7 @@ if(MSVC) # handle msvcrt setting being passed in CMAKE_C_FLAGS -- if(DEFINED CMAKE_MSVC_RUNTIME_LIBRARY) -+ if(NOT CMAKE_MSVC_RUNTIME_LIBRARY) - # do not support other methods of setting this (it would be more conformant, tho) - message(FATAL_ERROR "please set msvcrt via CMAKE_C_FLAGS") - endif() -@@ -1431,7 +1431,7 @@ if(UNICORN_BUILD_TESTS) + if(CMAKE_C_FLAGS MATCHES "[/-]M[TD]d?") + # ensure CMAKE_MSVC_RUNTIME_LIBRARY is not already defined +- if(DEFINED CMAKE_MSVC_RUNTIME_LIBRARY) ++ if(NOT CMAKE_MSVC_RUNTIME_LIBRARY) + message(FATAL_ERROR "please set the runtime library via either CMAKE_C_FLAGS or CMAKE_MSVC_RUNTIME_LIBRARY, not both") + endif() + +@@ -1486,7 +1486,7 @@ if(UNICORN_BUILD_TESTS) endif() diff --git a/ports/unicorn/fix-msvc-shared.patch b/ports/unicorn/fix-msvc-shared.patch new file mode 100644 index 0000000000..46e54b93e3 --- /dev/null +++ b/ports/unicorn/fix-msvc-shared.patch @@ -0,0 +1,26 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1acc0b5..a4b70d4 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1427,9 +1427,8 @@ endif() + if (BUILD_SHARED_LIBS) + if (MSVC) + # Avoid the import lib built by MVSC clash with our archive. +- set_target_properties(unicorn PROPERTIES ARCHIVE_OUTPUT_NAME "unicorn-import") ++ set_target_properties(unicorn PROPERTIES ARCHIVE_OUTPUT_NAME "unicorn") + endif() +- bundle_static_library(unicorn_static unicorn_archive unicorn) + else() + # Rename the "static" lib to avoid filename clash. + set_target_properties(unicorn PROPERTIES OUTPUT_NAME "unicorn-static") +@@ -1496,7 +1495,9 @@ if(UNICORN_INSTALL) + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) + endif() +- install(FILES $ DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++ if(NOT(BUILD_SHARED_LIBS)) ++ install(FILES $ DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++ endif() + install(FILES ${UNICORN_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/unicorn) + if (ATOMIC_LINKAGE_FIX) + set(ATOMIC_LINK_PKG_CONFIG " -latomic") diff --git a/ports/unicorn/portfile.cmake b/ports/unicorn/portfile.cmake index 70f6b2180c..8be86475cf 100644 --- a/ports/unicorn/portfile.cmake +++ b/ports/unicorn/portfile.cmake @@ -1,32 +1,39 @@ -if(VCPKG_CRT_LINKAGE STREQUAL "dynamic" AND VCPKG_LIBRARY_LINKAGE STREQUAL "static") - message(FATAL_ERROR "unicorn can currently only be built with /MT or /MTd (static CRT linkage)") -endif() - -# Note: this is safe because unicorn is a C library and takes steps to avoid memory allocate/free across the DLL boundary. -set(VCPKG_CRT_LINKAGE "static") - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO unicorn-engine/unicorn - REF "${VERSION}.post1" - SHA512 8694d6bc92e3424a8ad050316413d53e56e0f55e7cad7517fb3e98e670a0f1768b060ead8f195da13607cec89a964364f05a8b9d0dc074f4ac5e51026f8343ad + REF "${VERSION}" + SHA512 d6184b87a0fb729397ec2ac2cb8bfd9d10c9d4276e49efa681c66c7c54d1a325305a920332a708e68989cc299d0d1a543a1ceeaf552a9b44ec93084f7bf85ef2 HEAD_REF master PATCHES fix-build.patch + fix-msvc-shared.patch ) +if(VCPKG_TARGET_IS_ANDROID) + vcpkg_replace_string("${SOURCE_PATH}/CMakeLists.txt" + "-lpthread" + " " + ) +endif() + +if(VCPKG_TARGET_IS_WINDOWS) + vcpkg_replace_string("${SOURCE_PATH}/CMakeLists.txt" + "-lpthread -lm" + " " + ) +endif() + vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS -DUNICORN_BUILD_TESTS=OFF - ) +) vcpkg_cmake_install() - vcpkg_fixup_pkgconfig() +vcpkg_copy_pdbs() file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") -# Handle copyright vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING") diff --git a/ports/unicorn/vcpkg.json b/ports/unicorn/vcpkg.json index 5ffa0d52b0..b108213cb4 100644 --- a/ports/unicorn/vcpkg.json +++ b/ports/unicorn/vcpkg.json @@ -1,10 +1,10 @@ { "name": "unicorn", - "version": "2.0.1", + "version": "2.1.1", "description": "Unicorn is a lightweight multi-platform, multi-architecture CPU emulator framework", "homepage": "https://github.com/unicorn-engine/unicorn", "license": "GPL-2.0-only", - "supports": "windows & !uwp & !arm", + "supports": "!(arm & windows)", "dependencies": [ { "name": "vcpkg-cmake", diff --git a/scripts/test_ports/vcpkg-ci-unicorn/portfile.cmake b/scripts/test_ports/vcpkg-ci-unicorn/portfile.cmake new file mode 100644 index 0000000000..6f0a1276f5 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-unicorn/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-unicorn/project/CMakeLists.txt b/scripts/test_ports/vcpkg-ci-unicorn/project/CMakeLists.txt new file mode 100644 index 0000000000..43652cefe0 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-unicorn/project/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.5) + +project(vcpkg-ci-unicorn C) + +set(CMAKE_C_STANDARD 11) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(unicorn REQUIRED IMPORTED_TARGET unicorn) + +add_executable(main main.c) + +target_link_libraries(main PRIVATE PkgConfig::unicorn) diff --git a/scripts/test_ports/vcpkg-ci-unicorn/project/main.c b/scripts/test_ports/vcpkg-ci-unicorn/project/main.c new file mode 100644 index 0000000000..9f7b3eda97 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-unicorn/project/main.c @@ -0,0 +1,8 @@ +#include + +int main() +{ + uc_engine* uc; + uc_open(UC_ARCH_X86, UC_MODE_32, &uc); + return 0; +} diff --git a/scripts/test_ports/vcpkg-ci-unicorn/vcpkg.json b/scripts/test_ports/vcpkg-ci-unicorn/vcpkg.json new file mode 100644 index 0000000000..71ef60db79 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-unicorn/vcpkg.json @@ -0,0 +1,13 @@ +{ + "name": "vcpkg-ci-unicorn", + "version-string": "ci", + "description": "Testing packages which provide unicorn", + "license": null, + "dependencies": [ + "unicorn", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} \ No newline at end of file diff --git a/versions/baseline.json b/versions/baseline.json index 255d777453..fcc4123b63 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -9217,7 +9217,7 @@ "port-version": 0 }, "unicorn": { - "baseline": "2.0.1", + "baseline": "2.1.1", "port-version": 0 }, "unicorn-lib": { diff --git a/versions/u-/unicorn.json b/versions/u-/unicorn.json index a3fd4f2743..cca0f40ec1 100644 --- a/versions/u-/unicorn.json +++ b/versions/u-/unicorn.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "0fcc1642b22d697846278397e4993b115a0514b6", + "version": "2.1.1", + "port-version": 0 + }, { "git-tree": "d1d99593115946401db9ccd090cd53dc8ae303ba", "version": "2.0.1",