aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/lief
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/lief')
-rw-r--r--vcpkg/ports/lief/fix-cmakelists.patch29
-rw-r--r--vcpkg/ports/lief/fix-liefconfig-cmake-in.patch22
-rw-r--r--vcpkg/ports/lief/fix-vcpkg-includes.patch26
-rw-r--r--vcpkg/ports/lief/portfile.cmake72
-rw-r--r--vcpkg/ports/lief/vcpkg.json67
5 files changed, 216 insertions, 0 deletions
diff --git a/vcpkg/ports/lief/fix-cmakelists.patch b/vcpkg/ports/lief/fix-cmakelists.patch
new file mode 100644
index 0000000..7ab535a
--- /dev/null
+++ b/vcpkg/ports/lief/fix-cmakelists.patch
@@ -0,0 +1,29 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 1b9d3701..dc7557fd 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -313,7 +313,9 @@ else()
+ ${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/internal/span.hpp)
+ endif()
+
+-target_link_libraries(LIB_LIEF PRIVATE lief_spdlog)
++find_package(fmt CONFIG REQUIRED)
++find_package(spdlog CONFIG REQUIRED)
++target_link_libraries(LIB_LIEF PRIVATE fmt::fmt spdlog::spdlog)
+
+ if(ANDROID AND LIEF_LOGGING)
+ target_link_libraries(LIB_LIEF PUBLIC log)
+@@ -503,11 +505,11 @@ if(LIEF_INSTALL)
+ endif()
+
+ install(
+- TARGETS LIB_LIEF lief_spdlog
++ TARGETS LIB_LIEF
+ 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(
diff --git a/vcpkg/ports/lief/fix-liefconfig-cmake-in.patch b/vcpkg/ports/lief/fix-liefconfig-cmake-in.patch
new file mode 100644
index 0000000..b600ce4
--- /dev/null
+++ b/vcpkg/ports/lief/fix-liefconfig-cmake-in.patch
@@ -0,0 +1,22 @@
+diff --git a/cmake/LIEFConfig.cmake.in b/cmake/LIEFConfig.cmake.in
+index 562fda16..220208c7 100644
+--- a/cmake/LIEFConfig.cmake.in
++++ b/cmake/LIEFConfig.cmake.in
+@@ -76,7 +76,7 @@ macro(LIEF_load_targets lib_type)
+ return()
+ endif ()
+
+- if("${lib_type}" STREQUAL "static")
++ if(1)
+ # Need to find all dependencies even if they're private when LIEF is
+ # compiled statically
+ include(CMakeFindDependencyMacro)
+@@ -105,6 +105,8 @@ macro(LIEF_load_targets lib_type)
+ find_dependency(tl-expected)
+ endif()
+
++ find_dependency(fmt)
++ check_required_components(lief)
+ endif()
+
+ # Include the respective targets file
diff --git a/vcpkg/ports/lief/fix-vcpkg-includes.patch b/vcpkg/ports/lief/fix-vcpkg-includes.patch
new file mode 100644
index 0000000..6f04cdf
--- /dev/null
+++ b/vcpkg/ports/lief/fix-vcpkg-includes.patch
@@ -0,0 +1,26 @@
+diff --git a/src/BinaryStream/BinaryStream.cpp b/src/BinaryStream/BinaryStream.cpp
+index 655948f6..cea9ffcd 100644
+--- a/src/BinaryStream/BinaryStream.cpp
++++ b/src/BinaryStream/BinaryStream.cpp
+@@ -15,7 +15,7 @@
+ */
+ #include "LIEF/BinaryStream/BinaryStream.hpp"
+ #include "LIEF/DWARF/enums.hpp"
+-#include "third-party/utfcpp.hpp"
++#include <utf8cpp/utf8.h>
+
+ #include <mbedtls/x509.h>
+ #include <mbedtls/x509_crt.h>
+diff --git a/src/utils.cpp b/src/utils.cpp
+index dc3dda28..356d4ad3 100644
+--- a/src/utils.cpp
++++ b/src/utils.cpp
+@@ -23,7 +23,7 @@
+ #include "LIEF/errors.hpp"
+ #include "LIEF/version.h"
+
+-#include "third-party/utfcpp.hpp"
++#include <utf8cpp/utf8.h>
+
+ #include "LIEF/config.h"
+
diff --git a/vcpkg/ports/lief/portfile.cmake b/vcpkg/ports/lief/portfile.cmake
new file mode 100644
index 0000000..fe08be1
--- /dev/null
+++ b/vcpkg/ports/lief/portfile.cmake
@@ -0,0 +1,72 @@
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO lief-project/LIEF
+ REF ${VERSION}
+ SHA512 1e00dcb6d4fb06df5bc74c457d846f2d84cb3200679138cb0d87cbe38de27598207cbb159bc4090312d5f299d1541a8aa461b2fc70a6f725440fb9fbf4c35f45
+ HEAD_REF master
+ PATCHES
+ fix-cmakelists.patch
+ fix-liefconfig-cmake-in.patch
+ fix-vcpkg-includes.patch
+)
+
+file(REMOVE_RECURSE "${SOURCE_PATH}/third-party")
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ "c-api" LIEF_C_API # C API
+ "enable-json" LIEF_ENABLE_JSON # Enable JSON-related APIs
+ "extra-warnings" LIEF_EXTRA_WARNINGS # Enable extra warning from the compiler
+ "logging" LIEF_LOGGING # Enable logging
+ "logging-debug" LIEF_LOGGING_DEBUG # Enable debug logging
+
+ "use-ccache" LIEF_USE_CCACHE # Use ccache to speed up compilation
+
+ "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
+)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ ${FEATURE_OPTIONS}
+ -DLIEF_EXAMPLES=OFF
+
+ # Build with external vcpkg dependencies
+ -DLIEF_OPT_MBEDTLS_EXTERNAL=ON
+ -DLIEF_EXTERNAL_SPDLOG=ON
+ -DLIEF_OPT_NLOHMANN_JSON_EXTERNAL=ON
+ -DLIEF_OPT_FROZEN_EXTERNAL=ON
+ -DLIEF_OPT_EXTERNAL_SPAN=ON
+ -DLIEF_OPT_UTFCPP_EXTERNAL=ON
+ -DLIEF_OPT_EXTERNAL_EXPECTED=ON
+ -DLIEF_DISABLE_FROZEN=OFF
+ -DLIEF_DISABLE_EXCEPTIONS=OFF
+
+ # https://github.com/lief-project/LIEF/blob/0.16.6/src/paging.cpp requires ELF/PE/MACHO in any case
+ -DLIEF_ELF=ON
+ -DLIEF_PE=ON
+ -DLIEF_MACHO=ON
+
+ "-DLIEF_EXTERNAL_SPAN_DIR=${_VCPKG_INSTALLED_DIR}/${TARGET_TRIPLET}/include/tcb"
+)
+
+vcpkg_cmake_install()
+
+vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/LIEF")
+
+vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/lief/LIEFConfig.cmake"
+ [[include("${LIEF_${lib_type}_export}")]]
+ [[include("${CMAKE_CURRENT_LIST_DIR}/LIEFExport-${lib_type}.cmake")]]
+)
+
+vcpkg_fixup_pkgconfig()
+
+file(REMOVE_RECURSE
+ "${CURRENT_PACKAGES_DIR}/debug/include"
+ "${CURRENT_PACKAGES_DIR}/debug/share"
+)
+
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
diff --git a/vcpkg/ports/lief/vcpkg.json b/vcpkg/ports/lief/vcpkg.json
new file mode 100644
index 0000000..3d70814
--- /dev/null
+++ b/vcpkg/ports/lief/vcpkg.json
@@ -0,0 +1,67 @@
+{
+ "name": "lief",
+ "version-semver": "0.17.1",
+ "description": "LIEF - Library to Instrument Executable Formats",
+ "homepage": "https://lief.quarkslab.com",
+ "license": "Apache-2.0",
+ "dependencies": [
+ "fmt",
+ "frozen",
+ "mbedtls",
+ "spdlog",
+ "tcb-span",
+ "tl-expected",
+ "utfcpp",
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ],
+ "default-features": [
+ "art",
+ "dex",
+ "enable-json",
+ "logging",
+ "oat",
+ "vdex"
+ ],
+ "features": {
+ "art": {
+ "description": "Build LIEF with ART module"
+ },
+ "c-api": {
+ "description": "C API"
+ },
+ "dex": {
+ "description": "Build LIEF with DEX module"
+ },
+ "enable-json": {
+ "description": "Enable JSON-related APIs",
+ "dependencies": [
+ "nlohmann-json"
+ ]
+ },
+ "extra-warnings": {
+ "description": "Enable extra warning from the compiler"
+ },
+ "logging": {
+ "description": "Enable logging"
+ },
+ "logging-debug": {
+ "description": "Enable debug logging"
+ },
+ "oat": {
+ "description": "Build LIEF with OAT module"
+ },
+ "use-ccache": {
+ "description": "Use ccache to speed up compilation"
+ },
+ "vdex": {
+ "description": "Build LIEF with VDEX module"
+ }
+ }
+}