lief: improve deps (#5279)

* lief: improve deps

* patch algorithm

* add check

* fix exceptions config
pull/5288/head
star9029 2 months ago committed by GitHub
parent 5197bdb8be
commit b0001567aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 7
      packages/f/frozen/xmake.lua
  2. 25
      packages/l/lief/patches/0.15.1/algorithm.patch
  3. 69
      packages/l/lief/xmake.lua
  4. 1
      packages/s/spdlog/xmake.lua
  5. 7
      packages/t/tl_expected/xmake.lua

@ -1,5 +1,4 @@
package("frozen")
set_kind("library", {headeronly = true})
set_homepage("https://github.com/serge-sans-paille/frozen")
set_description("A header-only, constexpr alternative to gperf for C++14 users")
@ -11,8 +10,12 @@ package("frozen")
add_versions("1.2.0", "ed8339c017d7c5fe019ac2c642477f435278f0dc643c1d69d3f3b1e95915e823")
add_versions("1.1.1", "f7c7075750e8fceeac081e9ef01944f221b36d9725beac8681cbd2838d26be45")
add_deps("cmake")
on_install(function (package)
os.cp("include/frozen", package:installdir("include"))
local configs = {"-DBUILD_TESTING=OFF"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
import("package.tools.cmake").install(package, configs)
end)
on_test(function (package)

@ -0,0 +1,25 @@
diff --git a/src/ELF/DynamicEntryArray.cpp b/src/ELF/DynamicEntryArray.cpp
index c6fa7130ed..4e1bec392f 100644
--- a/src/ELF/DynamicEntryArray.cpp
+++ b/src/ELF/DynamicEntryArray.cpp
@@ -18,6 +18,8 @@
#include "logging.hpp"
+#include <algorithm>
+
namespace LIEF {
namespace ELF {
diff --git a/src/ELF/DynamicEntryRunPath.cpp b/src/ELF/DynamicEntryRunPath.cpp
index e0838401bc..c6758fbd21 100644
--- a/src/ELF/DynamicEntryRunPath.cpp
+++ b/src/ELF/DynamicEntryRunPath.cpp
@@ -17,6 +17,7 @@
#include "LIEF/Visitor.hpp"
#include "logging.hpp"
+#include <algorithm>
#include <numeric>
#include <sstream>

@ -1,17 +1,18 @@
package("lief")
set_homepage("https://lief.quarkslab.com")
set_description("Library to Instrument Executable Formats.")
set_license("Apache-2.0")
set_urls("https://github.com/lief-project/LIEF/archive/$(version).tar.gz",
set_urls("https://github.com/lief-project/LIEF/archive/refs/tags/$(version).tar.gz",
"https://github.com/lief-project/LIEF.git")
add_versions("0.15.1", "28653b59afc8b8b255251f21a0f3cbfbdec05dd988fb3f473e22dde28f427ad8")
add_versions("0.10.1", "6f30c98a559f137e08b25bcbb376c0259914b33c307b8b901e01ca952241d00a")
add_versions("0.11.5", "6d6d57304a56850958e4ce54f3da2ea2b9eb856ccbab61c6cde9cba15d7c9da5")
add_versions("0.14.0", "400804e38cb5ce8d15fb52a4db6345f02da7b2e5cb773665712283001482b808")
add_versions("0.14.1", "92916dcb3178353d863aef4f409186889983c56e025b774741d5316a72ec3a7d")
add_deps("cmake")
add_patches("<=0.15.1", "patches/0.15.1/algorithm.patch", "3e110539c3db037b2b24cd32f97ad8cc6241b1f69d4a65dab9fd6c84e482bbd9")
add_configs("elf", {description = "Enable ELF module.", default = true, type = "boolean"})
add_configs("pe", {description = "Enable PE module.", default = true, type = "boolean"})
@ -22,14 +23,63 @@ package("lief")
add_configs("oat", {description = "Enable Oat module.", default = false, type = "boolean"})
add_configs("art", {description = "Enable Art module.", default = false, type = "boolean"})
add_configs("exceptions", {description = "Build with exception support.", default = true, type = "boolean"})
if is_plat("windows") then
add_syslinks("advapi32")
end
on_install("macosx", "linux", "windows", function (package)
local configs = {"-DLIEF_PYTHON_API=OFF", "-DLIEF_DOC=OFF", "-DLIEF_TESTS=OFF", "-DLIEF_EXAMPLES=OFF", "-DLIEF_INSTALL_PYTHON=OFF"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
add_deps("cmake")
add_deps("spdlog", {configs = {header_only = false, noexcept = true}})
add_deps("nlohmann_json", {configs = {cmake = true}})
add_deps("tl_expected", "utfcpp", "mbedtls <3.6.0", "tcb-span", "frozen")
if on_check then
on_check(function (package)
if package:is_plat("windows") then
local vs_toolset = package:toolchain("msvc"):config("vs_toolset")
if vs_toolset then
local vs_toolset_ver = import("core.base.semver").new(vs_toolset)
local minor = vs_toolset_ver:minor()
assert(minor and minor >= 30, "package(lief) require vs_toolset >= 14.3")
end
end
if package:is_arch("arm.*") then
raise("package(lief) dep(mbedtls <3.6.0) unsupported arm arch")
end
end)
end
on_install(function (package)
if package:config("shared") then
package:add("defines", "LIEF_IMPORT")
end
io.replace("CMakeLists.txt", "target_link_libraries(LIB_LIEF PRIVATE utf8cpp)", "target_link_libraries(LIB_LIEF PRIVATE utf8cpp::utf8cpp)", {plain = true})
local configs = {
"-DLIEF_C_API=ON",
"-DLIEF_PYTHON_API=OFF",
"-DLIEF_DOC=OFF",
"-DLIEF_TESTS=OFF",
"-DLIEF_EXAMPLES=OFF",
"-DLIEF_INSTALL_PYTHON=OFF",
"-DLIEF_EXTERNAL_SPDLOG=ON",
"-DLIEF_OPT_EXTERNAL_EXPECTED=ON",
"-DLIEF_OPT_UTFCPP_EXTERNAL=ON",
"-DLIEF_OPT_MBEDTLS_EXTERNAL=ON",
"-DLIEF_OPT_EXTERNAL_SPAN=ON",
"-DLIEF_ENABLE_JSON=ON",
"-DLIEF_OPT_NLOHMANN_JSON_EXTERNAL=ON",
"-DLIEF_OPT_FROZEN_EXTERNAL=ON",
"-DLIEF_DISABLE_FROZEN=OFF",
}
table.insert(configs, "-DLIEF_EXTERNAL_SPAN_DIR=" .. package:dep("tcb-span"):installdir("include"))
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DLIEF_ASAN=" .. (package:config("asan") and "ON" or "OFF"))
table.insert(configs, "-DLIEF_DISABLE_EXCEPTIONS=" .. (package:config("exceptions") and "OFF" or "ON"))
for name, enabled in pairs(package:configs()) do
if not package:extraconf("configs", name, "builtin") then
table.insert(configs, "-DLIEF_" .. name:upper() .. "=" .. (enabled and "ON" or "OFF"))
@ -48,11 +98,6 @@ package("lief")
parse_entry = "macho_parse"
end
if parse_entry then
assert(package:check_cxxsnippets({test = [[
#include <LIEF/LIEF.h>
void test() {
]] .. parse_entry .. [[("");
}
]]}, {configs = {languages = "c"}}))
assert(package:has_cfuncs(parse_entry, {includes = "LIEF/LIEF.h"}))
end
end)

@ -69,6 +69,7 @@ package("spdlog")
end
local configs = {"-DSPDLOG_BUILD_TESTS=OFF", "-DSPDLOG_BUILD_EXAMPLE=OFF"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
table.insert(configs, "-DSPDLOG_BUILD_SHARED=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DSPDLOG_USE_STD_FORMAT=" .. (package:config("std_format") and "ON" or "OFF"))
table.insert(configs, "-DSPDLOG_FMT_EXTERNAL=" .. (package:config("fmt_external") and "ON" or "OFF"))

@ -1,5 +1,4 @@
package("tl_expected")
set_kind("library", {headeronly = true})
set_homepage("https://github.com/TartanLlama/expected")
set_description("C++11/14/17 std::expected with functional-style extensions")
@ -11,8 +10,12 @@ package("tl_expected")
add_versions("v1.0.0", "c1733556cbd3b532a02b68e2fbc2091b5bc2cccc279e4f6c6bd83877aabd4b02")
add_versions("v1.1.0", "4b2a347cf5450e99f7624247f7d78f86f3adb5e6acd33ce307094e9507615b78")
add_deps("cmake")
on_install(function (package)
os.cp("include/tl", package:installdir("include"))
local configs = {"-DBUILD_TESTING=OFF"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
import("package.tools.cmake").install(package, configs)
end)
on_test(function (package)

Loading…
Cancel
Save