-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lief] add new port LIEF-0.16.0 #42374
Draft
luadebug
wants to merge
84
commits into
microsoft:master
Choose a base branch
from
luadebug:lief-0.16.0
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+379
−0
Draft
Changes from all commits
Commits
Show all changes
84 commits
Select commit
Hold shift + click to select a range
bb08d3e
init
luadebug 5f08f62
ver
luadebug 3ea5f30
enforce c++17
luadebug 2cd7cf1
ver
luadebug c3a499f
push include <algorithm> into src/OAT/utils.cpp
luadebug f391c67
ver
luadebug fde8501
downgrade to 14 C++ std
luadebug 991a888
ver
luadebug 2dfaeba
downgrade to 11 C++ std
luadebug 6ae9a57
ver
luadebug bea8260
push #include <map> instead & c++14
luadebug d94531a
ver
luadebug 8dd31d3
enforce frozen
luadebug 7f4b3a9
ver
luadebug ad8799d
test android
luadebug 73a7bfa
ver
luadebug 3017791
simplify test
luadebug f85f0d1
ver
luadebug 61f58eb
checking uwp
luadebug 7cf39fc
ver
luadebug b7f5b46
clean
luadebug 23aedc7
ver
luadebug 243ac62
test linux
luadebug 8315f34
ver
luadebug 7552ead
fix
luadebug a9206d8
ver
luadebug 36819c5
test2 linux
luadebug 2a81ceb
ver
luadebug c4a2a64
clean
luadebug e543654
ver
luadebug 667b350
ver
luadebug b7fd1d1
clean
luadebug 2353914
ver
luadebug df580df
ver
luadebug b29d770
test
luadebug ca48233
ver
luadebug 4bc73c3
fix2
luadebug d7f5c63
ver
luadebug 756a4fb
fix3
luadebug f58b4bd
ver
luadebug 0f043ae
fix4
luadebug 834178f
ver
luadebug d09196d
fix5
luadebug 3b311d6
ver
luadebug 084abeb
test
luadebug 32191c3
ver
luadebug 8116f9b
test
luadebug 5b0da05
ver
luadebug a57caea
release
luadebug e13c475
ver
luadebug 08938ed
test for linux
luadebug c4dfaa5
ver
luadebug 09db381
clean
luadebug ad62504
ver
luadebug 1e1ba2a
usage
luadebug 0261c79
ver
luadebug 4115000
fuzzing & sanitizer remove
luadebug 06e5138
ver
luadebug f066b24
optimize
luadebug 83f0c54
ver
luadebug 25bcf61
fmt
luadebug 5c03fbc
ver
luadebug 2787775
test
luadebug 8d55be8
test2
luadebug 7a65f59
ver
luadebug 1fde52a
test3
luadebug 4a1afed
ver
luadebug 5403ff9
testing
luadebug 8c8ddb2
ver
luadebug d796d9f
testing2
luadebug 43a9181
ver
luadebug 9f8aa76
testing3
luadebug 3e47dff
ver
luadebug 6056577
testing4
luadebug 09db302
ver
luadebug 643488e
testing5
luadebug 7466fde
ver
luadebug 68ddc98
features
luadebug 2727050
fixup
luadebug b7660e3
ver
luadebug 6eff159
fixup2
luadebug 3000897
ver
luadebug 8bc2940
one ver
luadebug e1c0361
test ci
luadebug File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,216 @@ | ||
vcpkg_from_github( | ||
OUT_SOURCE_PATH SOURCE_PATH | ||
REPO lief-project/LIEF | ||
REF ${VERSION} | ||
SHA512 7df75fab6c7023e37a6a4d27fac8dcb4200e0235625fc5952bb23cedb2e582a37fb67ee471c1ae953c0b205fd9cca5538a835f65ef80a771f72dc7ff68000ed9 | ||
HEAD_REF master | ||
) | ||
|
||
file(REMOVE_RECURSE "${SOURCE_PATH}/third-party") | ||
|
||
vcpkg_replace_string("${SOURCE_PATH}/CMakeLists.txt" | ||
"target_link_libraries(LIB_LIEF PRIVATE lief_spdlog)" | ||
"find_package(fmt CONFIG REQUIRED)\nfind_package(spdlog CONFIG REQUIRED)\ntarget_link_libraries(LIB_LIEF PRIVATE fmt::fmt spdlog::spdlog)" | ||
) | ||
|
||
vcpkg_replace_string("${SOURCE_PATH}/cmake/LIEFConfig.cmake.in" | ||
[[if("${lib_type}" STREQUAL "static")]] | ||
[[if(1)]] | ||
) | ||
|
||
vcpkg_replace_string("${SOURCE_PATH}/cmake/LIEFConfig.cmake.in" | ||
"include(CMakeFindDependencyMacro)" | ||
"include(CMakeFindDependencyMacro)\nfind_dependency(tl-expected)\nfind_dependency(fmt)" | ||
) | ||
|
||
vcpkg_replace_string("${SOURCE_PATH}/cmake/LIEFConfig.cmake.in" | ||
"if(DEFINED LIEF_INCLUDE_DIR)" | ||
"check_required_components(lief)\nif(DEFINED LIEF_INCLUDE_DIR)" | ||
) | ||
|
||
vcpkg_replace_string("${SOURCE_PATH}/CMakeLists.txt" | ||
"TARGETS LIB_LIEF lief_spdlog" | ||
"TARGETS LIB_LIEF" | ||
) | ||
|
||
vcpkg_replace_string("${SOURCE_PATH}/CMakeLists.txt" | ||
[[set(CMAKE_INSTALL_LIBDIR "lib")]] | ||
[[#set(CMAKE_INSTALL_LIBDIR "lib")]] | ||
) | ||
vcpkg_replace_string("${SOURCE_PATH}/CMakeLists.txt" | ||
"set(CMAKE_INSTALL_LIBDIR \"lib\")" | ||
"#[[set(CMAKE_INSTALL_LIBDIR \"lib\")" | ||
) | ||
|
||
vcpkg_replace_string("${SOURCE_PATH}/CMakeLists.txt" | ||
"set(CMAKE_INSTALL_DATAROOTDIR \"share\")" | ||
"set(CMAKE_INSTALL_DATAROOTDIR \"share\")]]\nset(CMAKE_INSTALL_INCLUDEDIR \"include\")" | ||
) | ||
|
||
vcpkg_replace_string("${SOURCE_PATH}/CMakeLists.txt" | ||
"COMPONENT libraries" | ||
" " | ||
) | ||
|
||
vcpkg_replace_string("${SOURCE_PATH}/CMakeLists.txt" | ||
[[ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}]] | ||
" " | ||
) | ||
|
||
vcpkg_replace_string("${SOURCE_PATH}/CMakeLists.txt" | ||
[[RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}]] | ||
" " | ||
) | ||
|
||
vcpkg_replace_string("${SOURCE_PATH}/src/BinaryStream/BinaryStream.cpp" | ||
[[#include "third-party/utfcpp.hpp"]] | ||
[[#include <utf8cpp/utf8.h>]] | ||
) | ||
|
||
vcpkg_replace_string("${SOURCE_PATH}/src/utils.cpp" | ||
[[#include "third-party/utfcpp.hpp"]] | ||
[[#include <utf8cpp/utf8.h>]] | ||
) | ||
|
||
vcpkg_replace_string("${SOURCE_PATH}/src/PE/Builder.cpp" | ||
[[#include "third-party/utfcpp.hpp"]] | ||
[[#include <utf8cpp/utf8.h>]] | ||
) | ||
|
||
vcpkg_replace_string("${SOURCE_PATH}/src/logging.cpp" | ||
[[#include "spdlog/fmt/bundled/args.h"]] | ||
"#include <fmt/args.h>" | ||
) | ||
|
||
vcpkg_replace_string("${SOURCE_PATH}/src/logging.hpp" | ||
"#include <spdlog/fmt/fmt.h>" | ||
"#include <spdlog/fmt/fmt.h>\n#include <spdlog/fmt/ranges.h>" | ||
) | ||
|
||
vcpkg_replace_string("${SOURCE_PATH}/src/utils.cpp" | ||
"#include <spdlog/fmt/fmt.h>" | ||
"#include <spdlog/fmt/fmt.h>\n#include <spdlog/fmt/ranges.h>" | ||
) | ||
|
||
vcpkg_replace_string("${SOURCE_PATH}/src/internal_utils.hpp" | ||
[[#include "spdlog/fmt/fmt.h"]] | ||
"#include <spdlog/fmt/fmt.h>\n#include <spdlog/fmt/ranges.h>" | ||
) | ||
|
||
vcpkg_replace_string("${SOURCE_PATH}/src/PE/Header.cpp" | ||
"#include <spdlog/fmt/fmt.h>" | ||
"#include <spdlog/fmt/fmt.h>\n#include <spdlog/fmt/ranges.h>" | ||
) | ||
|
||
vcpkg_replace_string("${SOURCE_PATH}/src/PE/OptionalHeader.cpp" | ||
"#include <spdlog/fmt/fmt.h>" | ||
"#include <spdlog/fmt/fmt.h>\n#include <spdlog/fmt/ranges.h>" | ||
) | ||
|
||
vcpkg_replace_string("${SOURCE_PATH}/src/PE/TLS.cpp" | ||
[[#include "spdlog/fmt/fmt.h"]] | ||
"#include <spdlog/fmt/fmt.h>\n#include <spdlog/fmt/ranges.h>" | ||
) | ||
|
||
vcpkg_replace_string("${SOURCE_PATH}/src/MachO/BuildVersion.cpp" | ||
"#include <spdlog/fmt/fmt.h>" | ||
"#include <spdlog/fmt/fmt.h>\n#include <spdlog/fmt/ranges.h>" | ||
) | ||
|
||
vcpkg_replace_string("${SOURCE_PATH}/src/MachO/SourceVersion.cpp" | ||
[[#include "spdlog/fmt/fmt.h"]] | ||
"#include <spdlog/fmt/fmt.h>\n#include <spdlog/fmt/ranges.h>" | ||
) | ||
|
||
vcpkg_replace_string("${SOURCE_PATH}/src/MachO/DylibCommand.cpp" | ||
[[#include "spdlog/fmt/fmt.h"]] | ||
"#include <spdlog/fmt/fmt.h>\n#include <spdlog/fmt/ranges.h>" | ||
) | ||
|
||
vcpkg_replace_string("${SOURCE_PATH}/src/MachO/VersionMin.cpp" | ||
[[#include "spdlog/fmt/fmt.h"]] | ||
"#include <spdlog/fmt/fmt.h>\n#include <spdlog/fmt/ranges.h>" | ||
) | ||
|
||
if (VCPKG_TARGET_IS_LINUX) | ||
vcpkg_replace_string("${SOURCE_PATH}/src/internal_utils.hpp" | ||
[[#include "LIEF/iterators.hpp"]] | ||
"#include <LIEF/iterators.hpp>\n#include <memory>" | ||
) | ||
endif() | ||
|
||
vcpkg_replace_string("${SOURCE_PATH}/include/LIEF/errors.hpp" | ||
[[#include <LIEF/third-party/expected.hpp>]] | ||
"#include <tl/expected.hpp>" | ||
) | ||
|
||
vcpkg_replace_string("${SOURCE_PATH}/include/LIEF/span.hpp" | ||
[[#include <LIEF/third-party/span.hpp>]] | ||
"#include <tcb/span.hpp>" | ||
) | ||
|
||
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 | ||
"examples" LIEF_EXAMPLES # Build LIEF C++ examples | ||
"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 | ||
|
||
"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 | ||
|
||
"debug" LIEF_DEBUG_INFO # Build LIEF with DWARF/PDB support | ||
"objc" LIEF_OBJC # Build LIEF with inspect Objective-C metadata support | ||
"dyld-shared-cache" LIEF_DYLD_SHARED_CACHE # Build LIEF with dyld shared cache support | ||
"asm" LIEF_ASM # Build LIEF with assembler/disassembler support | ||
) | ||
|
||
vcpkg_cmake_configure( | ||
SOURCE_PATH "${SOURCE_PATH}" | ||
OPTIONS | ||
${FEATURE_OPTIONS} | ||
|
||
# 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 | ||
) | ||
|
||
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() | ||
|
||
if("debug" IN_LIST FEATURES) | ||
vcpkg_copy_pdbs() | ||
endif() | ||
|
||
file(REMOVE_RECURSE | ||
"${CURRENT_PACKAGES_DIR}/debug/include" | ||
"${CURRENT_PACKAGES_DIR}/debug/share" | ||
) | ||
|
||
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") | ||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
lief provides CMake targets: | ||
|
||
find_package(LIEF CONFIG REQUIRED) | ||
target_link_libraries(main PRIVATE LIEF::LIEF) | ||
|
||
lief provides pkg-config modules: | ||
|
||
# Library to Instrument Executable Formats | ||
LIEF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
{ | ||
"name": "lief", | ||
"version-semver": "0.16.0", | ||
"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", | ||
"c-api", | ||
"dex", | ||
"elf", | ||
"enable-json", | ||
"logging", | ||
"macho", | ||
"oat", | ||
"pe", | ||
"vdex" | ||
], | ||
"features": { | ||
"art": { | ||
"description": "Build LIEF with ART module" | ||
}, | ||
"asm": { | ||
"description": "Build LIEF with assembler/disassembler support", | ||
"supports": "!(windows & !static)" | ||
}, | ||
"c-api": { | ||
"description": "C API" | ||
}, | ||
"debug": { | ||
"description": "Build LIEF with DWARF/PDB support", | ||
"supports": "!(windows & !static)" | ||
}, | ||
"dex": { | ||
"description": "Build LIEF with DEX module" | ||
}, | ||
"dyld-shared-cache": { | ||
"description": "Build LIEF with Dyld shared cache support", | ||
"supports": "!(windows & !static)" | ||
}, | ||
"elf": { | ||
"description": "Build LIEF with ELF module" | ||
}, | ||
"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" | ||
}, | ||
"logging": { | ||
"description": "Enable logging" | ||
}, | ||
"logging-debug": { | ||
"description": "Enable debug logging" | ||
}, | ||
"macho": { | ||
"description": "Build LIEF with MachO module" | ||
}, | ||
"oat": { | ||
"description": "Build LIEF with OAT module" | ||
}, | ||
"objc": { | ||
"description": "Build LIEF with ObjC metadata support", | ||
"supports": "!(windows & !static)" | ||
}, | ||
"pe": { | ||
"description": "Build LIEF with PE module" | ||
}, | ||
"use-ccache": { | ||
"description": "Use ccache to speed up compilation" | ||
}, | ||
"vdex": { | ||
"description": "Build LIEF with VDEX module" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
SET(VCPKG_POLICY_EMPTY_PACKAGE enabled) | ||
|
||
vcpkg_cmake_configure( | ||
SOURCE_PATH "${CURRENT_PORT_DIR}/project" | ||
) | ||
|
||
vcpkg_cmake_build() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
cmake_minimum_required(VERSION 3.24) | ||
|
||
project(vcpkg-ci-lief LANGUAGES C CXX) | ||
|
||
set(CMAKE_CXX_STANDARD 14) | ||
|
||
find_package(LIEF CONFIG REQUIRED) | ||
|
||
add_executable(main main.cpp) | ||
|
||
target_link_libraries(main PRIVATE LIEF::LIEF) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <iostream> | ||
#include <LIEF/LIEF.hpp> | ||
#include <LIEF/version.h> | ||
using namespace std; | ||
using namespace LIEF; | ||
int main() | ||
{ | ||
std::cout << "access flags public = " << LIEF::DEX::to_string(LIEF::DEX::access_flags_list[1]) << std::endl; | ||
std::cout << "Version = " << LIEF_VERSION << std::endl; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "vcpkg-ci-lief", | ||
"version-string": "ci", | ||
"description": "Testing packages which provide lief", | ||
"license": null, | ||
"dependencies": [ | ||
"lief", | ||
{ | ||
"name": "vcpkg-cmake", | ||
"host": true | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"versions": [ | ||
{ | ||
"git-tree": "aff018b24b685b86596713f8819c4e3d13d1e6d4", | ||
"version-semver": "0.16.0", | ||
"port-version": 0 | ||
} | ||
] | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yet extended features wont work for Windows/UWP Shared
https://lief.re/doc/latest/extended/intro.html