xmake.lua 1.3 KB

123456789101112131415161718192021222324252627
  1. package("capstone")
  2. set_homepage("http://www.capstone-engine.org")
  3. set_description("Disassembly framework with the target of becoming the ultimate disasm engine for binary analysis and reversing in the security community.")
  4. add_urls("https://github.com/aquynh/capstone/archive/$(version).tar.gz")
  5. add_versions("4.0.2", "7c81d798022f81e7507f1a60d6817f63aa76e489aa4e7055255f21a22f5e526a")
  6. add_deps("cmake")
  7. on_load(function (package)
  8. package:addenv("PATH", "bin")
  9. end)
  10. on_install("windows", "linux", "macosx", "iphoneos", "mingw", "android", "msys", "bsd", function (package)
  11. local configs = {"-DCAPSTONE_BUILD_CSTOOL=ON", "-DCAPSTONE_BUILD_TESTS=OFF"}
  12. table.insert(configs, "-DCAPSTONE_BUILD_STATIC=" .. (package:config("shared") and "OFF" or "ON"))
  13. table.insert(configs, "-DCAPSTONE_BUILD_SHARED=" .. (package:config("shared") and "ON" or "OFF"))
  14. io.gsub("CMakeLists.txt", "CAPSTONE_BUILD_SHARED AND CAPSTONE_BUILD_CSTOOL", "CAPSTONE_BUILD_CSTOOL")
  15. import("package.tools.cmake").install(package, configs)
  16. os.cp("include", package:installdir())
  17. end)
  18. on_test(function (package)
  19. if package:is_plat(os.host()) then
  20. os.vrun("cstool -v")
  21. end
  22. assert(package:has_cfuncs("cs_version", {includes = "capstone/capstone.h"}))
  23. end)