diff --git a/ports/lief/0001-Support-vcpkg.patch b/ports/lief/0001-Support-vcpkg.patch new file mode 100644 index 00000000000000..0bcabb70184205 --- /dev/null +++ b/ports/lief/0001-Support-vcpkg.patch @@ -0,0 +1,45 @@ +From 426d8167648fff0ad79832a701223b8171dad096 Mon Sep 17 00:00:00 2001 +From: Eric Kilmer +Date: Tue, 12 Apr 2022 10:42:27 -0400 +Subject: [PATCH] Support vcpkg + +Remove msvccrt choosing and fix install paths on Windows +--- + CMakeLists.txt | 7 ++----- + 1 file changed, 2 insertions(+), 5 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b89d0522..9ca50c35 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -11,9 +11,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows" AND CMAKE_CROSSCOMPILING) + endif() + + +-if(WIN32 OR ${IS_WIN_CROSS_COMPILE}) +- include(ChooseMSVCCRT) +-endif() + include(CheckCXXCompilerFlag) + include(CheckCCompilerFlag) + include(ExternalProject) +@@ -667,7 +664,7 @@ endif() + # Installation + # ====================== + +-if(UNIX) ++if(1) + include(GNUInstallDirs) + set(CMAKE_INSTALL_LIBDIR "lib") + else() +@@ -688,7 +685,7 @@ install( + EXPORT LIEFExport + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +- RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libraries + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + + install( +-- +2.35.1 + diff --git a/ports/lief/portfile.cmake b/ports/lief/portfile.cmake new file mode 100644 index 00000000000000..bd9e87e1f54138 --- /dev/null +++ b/ports/lief/portfile.cmake @@ -0,0 +1,87 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO lief-project/LIEF + REF 0.12.1 + SHA512 833a04ece5ff7365717aee3408a2d522756319e43cf4ff795047021c46b48d5d525c2a56cdafd04259ddfcf6888972d19655924f999460ce05f52a32ac7e8bca + HEAD_REF master + PATCHES + 0001-Support-vcpkg.patch +) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS +FEATURES + "tests" LIEF_TESTS # Enable tests + "c-api" LIEF_C_API # C API + "examples" LIEF_EXAMPLES # Build LIEF C++ examples + "force32" LIEF_FORCE32 # Force build LIEF 32 bits version + "coverage" LIEF_COVERAGE # Perform code coverage + "use-ccache" LIEF_USE_CCACHE # Use ccache to speed up compilation + "extra-warnings" LIEF_EXTRA_WARNINGS # Enable extra warning from the compiler + "logging" LIEF_LOGGING # Enable logging + "logging-debug" LIEF_LOGGING_DEBUG # Enable debug logging + "enable-json" LIEF_ENABLE_JSON # Enable JSON-related APIs + + "elf" LIEF_ELF # Build LIEF with ELF module + "pe" LIEF_PE # Build LIEF with PE module + "macho" LIEF_MACHO # Build LIEF with MachO module + + "oat" LIEF_OAT # Build LIEF with OAT module + "dex" LIEF_DEX # Build LIEF with DEX module + "vdex" LIEF_VDEX # Build LIEF with VDEX module + "art" LIEF_ART # Build LIEF with ART module + + # Sanitizer + "asan" LIEF_ASAN # Enable Address sanitizer + "lsan" LIEF_LSAN # Enable Leak sanitizer + "tsan" LIEF_TSAN # Enable Thread sanitizer + "usan" LIEF_USAN # Enable undefined sanitizer + + # Fuzzer + "fuzzing" LIEF_FUZZING # Fuzz LIEF + + # Profiling + "profiling" LIEF_PROFILING # Enable performance profiling + +INVERTED_FEATURES + "enable-frozen" LIEF_DISABLE_FROZEN # Disable Frozen even if it is supported +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + + OPTIONS + ${FEATURE_OPTIONS} + + -DLIEF_PYTHON_API=OFF + -DLIEF_USE_CCACHE=OFF + + # Build with external vcpkg dependencies + -DLIEF_OPT_MBEDTLS_EXTERNAL=ON + -DLIEF_OPT_UTFCPP_EXTERNAL=ON + -DLIEF_EXTERNAL_SPDLOG=ON + -DLIEF_OPT_NLOHMANN_JSON_EXTERNAL=ON + -DLIEF_OPT_FROZEN_EXTERNAL=ON + -DLIEF_OPT_EXTERNAL_LEAF=ON + "-DLIEF_EXTERNAL_LEAF_DIR=${CURRENT_INSTALLED_DIR}/include" + -DLIEF_OPT_EXTERNAL_SPAN=ON +) + +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup(CONFIG_PATH share/LIEF/cmake) + +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + +# Check if all-caps directory is empty (it won't be on case-insensitive filesystems). +# These files could have been moved during vcpkg_cmake_config_fixup +file(GLOB dir_files "${CURRENT_PACKAGES_DIR}/share/LIEF/*") +list(LENGTH dir_files dir_files_len) +if(dir_files_len EQUAL 0) + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/LIEF") +endif() + +# Handle copyright +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/lief/vcpkg.json b/ports/lief/vcpkg.json new file mode 100644 index 00000000000000..c13aafeff1ffd9 --- /dev/null +++ b/ports/lief/vcpkg.json @@ -0,0 +1,116 @@ +{ + "name": "lief", + "version-semver": "0.12.1", + "description": "LIEF - Library to Instrument Executable Formats", + "homepage": "https://lief.quarkslab.com", + "license": "Apache-2.0", + "supports": "!uwp", + "dependencies": [ + "boost-leaf", + "mbedtls", + "spdlog", + "tcb-span", + "utfcpp", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "default-features": [ + "art", + "c-api", + "dex", + "elf", + "enable-frozen", + "enable-json", + "logging", + "macho", + "oat", + "pe", + "vdex" + ], + "features": { + "art": { + "description": "Build LIEF with ART module" + }, + "asan": { + "description": "Enable Address sanitizer" + }, + "c-api": { + "description": "C API" + }, + "coverage": { + "description": "Perform code coverage" + }, + "dex": { + "description": "Build LIEF with DEX module" + }, + "elf": { + "description": "Build LIEF with ELF module" + }, + "enable-frozen": { + "description": "Enable Frozen", + "dependencies": [ + "frozen" + ] + }, + "enable-json": { + "description": "Enable JSON-related APIs", + "dependencies": [ + "nlohmann-json" + ] + }, + "examples": { + "description": "Build LIEF C++ examples" + }, + "extra-warnings": { + "description": "Enable extra warning from the compiler" + }, + "force32": { + "description": "Force build LIEF 32 bits version" + }, + "fuzzing": { + "description": "Fuzz LIEF" + }, + "logging": { + "description": "Enable logging" + }, + "logging-debug": { + "description": "Enable debug logging" + }, + "lsan": { + "description": "Enable Leak sanitizer" + }, + "macho": { + "description": "Build LIEF with MachO module" + }, + "oat": { + "description": "Build LIEF with OAT module" + }, + "pe": { + "description": "Build LIEF with PE module" + }, + "profiling": { + "description": "Enable performance profiling" + }, + "tests": { + "description": "Enable tests" + }, + "tsan": { + "description": "Enable Thread sanitizer" + }, + "usan": { + "description": "Enable undefined sanitizer" + }, + "use-ccache": { + "description": "Use ccache to speed up compilation" + }, + "vdex": { + "description": "Build LIEF with VDEX module" + } + } +} diff --git a/ports/mbedtls/enable-pthread.patch b/ports/mbedtls/enable-pthread.patch index 6353103769c327..ce97c797c0596b 100755 --- a/ports/mbedtls/enable-pthread.patch +++ b/ports/mbedtls/enable-pthread.patch @@ -1,27 +1,26 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 8833246..f68ab02 100644 +index 6debe35..64e0674 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -28,6 +28,7 @@ set(MBEDTLS_DIR ${CMAKE_CURRENT_SOURCE_DIR}) - - option(USE_PKCS11_HELPER_LIBRARY "Build mbed TLS with the pkcs11-helper library." OFF) - option(ENABLE_ZLIB_SUPPORT "Build mbed TLS with zlib library." OFF) +@@ -51,6 +51,7 @@ if(WIN32) + else() + option(GEN_FILES "Generate the auto-generated files as needed" ON) + endif() +option(ENABLE_PTHREAD "Build mbed TLS with pthread" OFF) - option(ENABLE_PROGRAMS "Build mbed TLS programs." ON) - -@@ -231,6 +232,8 @@ else() + string(REGEX MATCH "Clang" CMAKE_COMPILER_IS_CLANG "${CMAKE_C_COMPILER_ID}") + string(REGEX MATCH "GNU" CMAKE_COMPILER_IS_GNU "${CMAKE_C_COMPILER_ID}") +@@ -243,12 +244,26 @@ else() set(LIB_INSTALL_DIR lib) endif() -+include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/) ++#include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/) + - if(ENABLE_ZLIB_SUPPORT) - find_package(ZLIB) + add_subdirectory(include) -@@ -239,6 +242,17 @@ if(ENABLE_ZLIB_SUPPORT) - endif(ZLIB_FOUND) - endif(ENABLE_ZLIB_SUPPORT) + add_subdirectory(3rdparty) + + add_subdirectory(library) +if(ENABLE_PTHREAD) + if(WIN32) @@ -34,61 +33,54 @@ index 8833246..f68ab02 100644 + set(LINK_WITH_PTHREAD ON) +endif() + - add_subdirectory(include) - - add_subdirectory(3rdparty) ++ + # + # The C files in tests/src directory contain test code shared among test suites + # and programs. This shared test code is compiled and linked to test suites and diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt -index 62c0f62..7923202 100644 +index e693bc1..7f5216a 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt -@@ -1,10 +1,14 @@ +@@ -1,9 +1,13 @@ option(INSTALL_MBEDTLS_HEADERS "Install mbed TLS headers." ON) -+configure_file(mbedtls/config_threading.h.in mbedtls/config_threading.h) ++#configure_file(mbedtls/config_threading.h.in mbedtls/config_threading.h) + if(INSTALL_MBEDTLS_HEADERS) file(GLOB headers "mbedtls/*.h") file(GLOB psa_headers "psa/*.h") -- -+ -+ set(headers ${headers} ${CMAKE_CURRENT_BINARY_DIR}/mbedtls/config_threading.h) + ++ #set(headers ${headers} ${CMAKE_CURRENT_BINARY_DIR}/mbedtls/config_threading.h) + install(FILES ${headers} DESTINATION include/mbedtls - PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) -diff --git a/include/mbedtls/config.h b/include/mbedtls/config.h -index 1e6e052..51c20da 100644 ---- a/include/mbedtls/config.h -+++ b/include/mbedtls/config.h -@@ -24,6 +24,8 @@ +diff --git a/include/mbedtls/mbedtls_config.h b/include/mbedtls/mbedtls_config.h +index 0558ee0..d2fd425 100644 +--- a/include/mbedtls/mbedtls_config.h ++++ b/include/mbedtls/mbedtls_config.h +@@ -24,6 +24,15 @@ * limitations under the License. */ -+#include "mbedtls/config_threading.h" + - #ifndef MBEDTLS_CONFIG_H - #define MBEDTLS_CONFIG_H - -diff --git a/include/mbedtls/config_threading.h.in b/include/mbedtls/config_threading.h.in -new file mode 100644 -index 0000000..9d5d42e ---- /dev/null -+++ b/include/mbedtls/config_threading.h.in -@@ -0,0 +1,6 @@ -+#cmakedefine ENABLE_PTHREAD ++ ++ + +#ifdef ENABLE_PTHREAD +#define MBEDTLS_THREADING_C +#define MBEDTLS_THREADING_PTHREAD +#endif -\ No newline at end of file ++ + /** + * This is an optional version symbol that enables comatibility handling of + * config files. diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt -index 33e2cfc..4b99331 100644 +index 07599f5..27e426d 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt -@@ -137,7 +137,11 @@ if(ENABLE_ZLIB_SUPPORT) - endif(ENABLE_ZLIB_SUPPORT) +@@ -189,7 +189,11 @@ if(HAIKU) + endif(HAIKU) if(LINK_WITH_PTHREAD) - set(libs ${libs} pthread) diff --git a/ports/mbedtls/portfile.cmake b/ports/mbedtls/portfile.cmake index 1f65fff5ba4eb0..968fb9fc72d26e 100644 --- a/ports/mbedtls/portfile.cmake +++ b/ports/mbedtls/portfile.cmake @@ -1,11 +1,9 @@ -set(VCPKG_LIBRARY_LINKAGE static) - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO ARMmbed/mbedtls - REF 8b3f26a5ac38d4fdccbc5c5366229f3e01dafcc0 # mbedtls-2.28.0 - SHA512 a5d2694ae87347be7ebf5c32b86d7bb809cc696b549947efb3d12d41d5f726d4f7caed3cc6ee3f3c9b9e46b3c42c4ce8a5f9741b1b0a3c644b6ae615d2f4c55a - HEAD_REF mbedtls-2.28 + REF d65aeb37349ad1a50e0f6c9b694d4b5290d60e49 #v3.1.0 + SHA512 a3fde5e6e206d0ab43282502fec45da14f1ccb24974db7a9348a18870d3c07b10fe72419ebf5130cec1b9e819ef804608b0f7b48670f619e328f5b798a8d9eb1 + HEAD_REF master PATCHES enable-pthread.patch ) @@ -16,8 +14,10 @@ vcpkg_check_features( pthreads ENABLE_PTHREAD ) +vcpkg_find_acquire_program(PYTHON3) + vcpkg_cmake_configure( - SOURCE_PATH ${SOURCE_PATH} + SOURCE_PATH "${SOURCE_PATH}" OPTIONS ${FEATURE_OPTIONS} -DENABLE_TESTING=OFF @@ -27,12 +27,10 @@ vcpkg_cmake_configure( vcpkg_cmake_install() -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +vcpkg_cmake_config_fixup(CONFIG_PATH "cmake") -file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) +vcpkg_copy_pdbs() -if (VCPKG_TARGET_IS_WINDOWS AND pthreads IN_LIST FEATURES) - file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) -endif () +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") -vcpkg_copy_pdbs() +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/mbedtls/vcpkg-cmake-wrapper.cmake b/ports/mbedtls/vcpkg-cmake-wrapper.cmake deleted file mode 100644 index 40a0bccb4dfbae..00000000000000 --- a/ports/mbedtls/vcpkg-cmake-wrapper.cmake +++ /dev/null @@ -1,29 +0,0 @@ -include(FindPackageHandleStandardArgs) - -find_path(MBEDTLS_INCLUDE_DIR mbedtls/ssl.h) - -find_library(MBEDTLS_CRYPTO_LIBRARY mbedcrypto) -find_package(pthreads_windows QUIET) -set(MBEDTLS_CRYPTO_LIBRARY ${MBEDTLS_CRYPTO_LIBRARY} ${PThreads4W_LIBRARY}) -find_library(MBEDTLS_X509_LIBRARY mbedx509) -find_library(MBEDTLS_TLS_LIBRARY mbedtls) -set(MBEDTLS_LIBRARIES ${MBEDTLS_CRYPTO_LIBRARY} ${MBEDTLS_X509_LIBRARY} ${MBEDTLS_TLS_LIBRARY}) - -if (MBEDTLS_INCLUDE_DIR AND EXISTS "${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h") - file( - STRINGS ${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h _MBEDTLS_VERLINE - REGEX "^#define[ \t]+MBEDTLS_VERSION_STRING[\t ].*" - ) - string(REGEX REPLACE ".*MBEDTLS_VERSION_STRING[\t ]+\"(.*)\"" "\\1" MBEDTLS_VERSION ${_MBEDTLS_VERLINE}) -endif() - -find_package_handle_standard_args( - mbedTLS - REQUIRED_VARS - MBEDTLS_INCLUDE_DIR - MBEDTLS_CRYPTO_LIBRARY - MBEDTLS_X509_LIBRARY - MBEDTLS_TLS_LIBRARY - PThreads4W_FOUND - VERSION_VAR MBEDTLS_VERSION -) diff --git a/ports/mbedtls/vcpkg.json b/ports/mbedtls/vcpkg.json index 93c0e9b222b4fa..e193eea13e3253 100644 --- a/ports/mbedtls/vcpkg.json +++ b/ports/mbedtls/vcpkg.json @@ -1,6 +1,6 @@ { "name": "mbedtls", - "version": "2.28.0", + "version": "3.1.0", "description": "An open source, portable, easy to use, readable and flexible SSL library", "homepage": "https://github.com/ARMmbed/mbedtls", "license": "Apache-2.0", diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index c0c581ebf44874..45f9f5098a2bef 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -671,6 +671,7 @@ libwandio:arm64-windows=fail libwandio:arm-uwp=fail licensepp:arm-uwp=fail licensepp:x64-uwp=fail +lief:arm64-windows=fail linenoise-ng:arm-uwp=fail linenoise-ng:x64-uwp=fail live555:arm-uwp=fail diff --git a/versions/baseline.json b/versions/baseline.json index e76999ffe9b9c8..1242f7be44caa8 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4220,6 +4220,10 @@ "baseline": "2020-05-19", "port-version": 3 }, + "lief": { + "baseline": "0.12.1", + "port-version": 0 + }, "lilv": { "baseline": "0.24.10", "port-version": 1 @@ -4421,7 +4425,7 @@ "port-version": 0 }, "mbedtls": { - "baseline": "2.28.0", + "baseline": "3.1.0", "port-version": 0 }, "mcpp": { diff --git a/versions/l-/lief.json b/versions/l-/lief.json new file mode 100644 index 00000000000000..8939d6a470c273 --- /dev/null +++ b/versions/l-/lief.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "0254c0f0d69dc63cfa589ae705d39ecc4bd9bd00", + "version-semver": "0.12.1", + "port-version": 0 + } + ] +} diff --git a/versions/m-/mbedtls.json b/versions/m-/mbedtls.json index 440fc362ea25de..02174a303cf421 100644 --- a/versions/m-/mbedtls.json +++ b/versions/m-/mbedtls.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "f96d53eaca85a20bcb9da745af33ab1b96406f54", + "version": "3.1.0", + "port-version": 0 + }, { "git-tree": "50e6870207f6a1f0b1e2197978b4403de775eac2", "version": "2.28.0",