-
-
Notifications
You must be signed in to change notification settings - Fork 424
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add keystone * fix mingw and windows * add python deps * fix python deps * fix kstool * support for ndk r27 * improve build libs only * improve ndk build * fix ndk
- Loading branch information
Showing
1 changed file
with
51 additions
and
0 deletions.
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) |