-
-
Notifications
You must be signed in to change notification settings - Fork 416
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
add keystone #5459
Merged
add keystone #5459
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1231ee2
add keystone
waruqi 7bda983
fix mingw and windows
waruqi c0aa110
add python deps
waruqi 9cbd44a
fix python deps
waruqi 5f0247c
fix kstool
waruqi baefc11
support for ndk r27
waruqi ef50efc
improve build libs only
waruqi 3ae0b48
improve ndk build
waruqi 632f5ba
fix ndk
waruqi 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,51 @@ | ||
package("keystone") | ||
set_homepage("http://www.keystone-engine.org") | ||
set_description("Keystone assembler framework: Core (Arm, Arm64, Hexagon, Mips, PowerPC, Sparc, SystemZ & X86) + bindings") | ||
set_license("GPL-2.0") | ||
|
||
add_urls("https://github.com/keystone-engine/keystone/archive/refs/tags/$(version).tar.gz", | ||
"https://github.com/keystone-engine/keystone.git") | ||
|
||
add_versions("0.9.2", "c9b3a343ed3e05ee168d29daf89820aff9effb2c74c6803c2d9e21d55b5b7c24") | ||
|
||
add_deps("cmake") | ||
add_deps("python 3.x", {kind = "binary"}) | ||
|
||
if is_plat("windows", "mingw") then | ||
add_syslinks("shell32", "ole32", "uuid") | ||
end | ||
|
||
on_load(function (package) | ||
if package:is_cross() or package:is_plat("mingw") or (package:is_plat("windows") and package:config("shared")) then | ||
package:data_set("build_libs_only", true) | ||
end | ||
if not package:data("build_libs_only") then | ||
package:addenv("PATH", "bin") | ||
end | ||
end) | ||
|
||
on_install(function (package) | ||
local configs = {} | ||
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")) | ||
if package:data("build_libs_only") then | ||
table.insert(configs, "-DBUILD_LIBS_ONLY=ON") | ||
end | ||
if package:is_plat("windows") then | ||
table.insert(configs, "-DKEYSTONE_BUILD_STATIC_RUNTIME=" .. (package:has_runtime("MT", "MTd") and "ON" or "OFF")) | ||
elseif package:is_plat("android") then | ||
-- support for ndk >= r27 | ||
-- https://github.com/android/ndk/issues/2032 | ||
table.insert(configs, "-DCMAKE_POLICY_DEFAULT_CMP0057=NEW") | ||
end | ||
io.replace("CMakeLists.txt", "add_subdirectory(suite/fuzz)", "", {plain = true}) | ||
import("package.tools.cmake").install(package, configs) | ||
os.cp("include", package:installdir()) | ||
end) | ||
|
||
on_test(function (package) | ||
if not package:data("build_libs_only") then | ||
os.vrun('kstool -b x64 "mov rax, 1; ret"') | ||
end | ||
assert(package:has_cfuncs("ks_version", {includes = "keystone/keystone.h"})) | ||
end) |
Oops, something went wrong.
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.
Github CI ignored it for some reason?
https://github.com/search?q=repo%3Axmake-io%2Fxmake-repo%20MAKE_POLICY_DEFAULT_CMP0057&type=code
cmake_policy(SET CMP0057 NEW)
android-NDK-r37.patch
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.
😟
Patching?
https://github.com/luadebug/xmake-repo/blob/keystone/packages/k/keystone/xmake.lua
https://github.com/luadebug/xmake-repo/blob/keystone/packages/k/keystone/patches/0.9.2/android-NDK-r37.patch
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.
Well it did not work out.
https://github.com/xmake-io/xmake-repo/actions/runs/11276235247/job/31359534078?pr=5459
We could rely over cmake.flags file like this:
https://android-review.googlesource.com/c/platform/ndk/+/3211647/1/build/cmake/flags.cmake
according to:
android/ndk#2032 (comment)
Please note it there old versions are being used:
https://github.com/search?q=repo%3Akeystone-engine%2Fkeystone%20cmake_minimum_required&type=code
Reference: https://cmake.org/cmake/help/latest/policy/CMP0057.html