Skip to content
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
merged 9 commits into from
Oct 10, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions packages/k/keystone/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
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")

if is_plat("windows") then
add_syslinks("shell32")
end

on_load(function (package)
if not package:is_cross() 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:is_cross() then
table.insert(configs, "-DBUILD_LIBS_ONLY=ON")
elseif package:is_plat("windows") then
table.insert(configs, "-DKEYSTONE_BUILD_STATIC_RUNTIME=" .. (package:has_runtime("MT", "MTd") and "ON" or "OFF"))
end
import("package.tools.cmake").install(package, configs)
os.cp("include", package:installdir())
end)

on_test(function (package)
if not package:is_cross() then
Copy link
Contributor

@luadebug luadebug Oct 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if not package:is_cross() and not is_mode("shared") then

We do not build it because of CMakeLists.txt (at least in case of windows?)
origin src:

# for Windows, do not build kstool if buiding DLL
# TODO: fix this

os.vrun('kstool -b x64 "mov rax, 1; ret"')
end
assert(package:has_cfuncs("ks_version", {includes = "keystone/keystone.h"}))
end)
Loading