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 unicorn #1012

Merged
merged 6 commits into from
Feb 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 6 additions & 1 deletion packages/p/python/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,12 @@ package("python")
os.cp("libs/*", package:installdir("lib"))
os.cp("*", package:installdir())
local python = path.join(package:installdir("bin"), "python.exe")
os.vrunv(python, {"-m", "pip", "install", "--upgrade", "--force-reinstall", "pip"})
if package:version():eq("3.9.10") then
-- https://github.com/xmake-io/xmake-repo/issues/1013
os.vrunv(python, {"-m", "pip", "install", "--upgrade", "--force-reinstall", "pip==21.3.1"})
else
os.vrunv(python, {"-m", "pip", "install", "--upgrade", "--force-reinstall", "pip"})
end
os.vrunv(python, {"-m", "pip", "install", "wheel"})
end)

Expand Down
53 changes: 53 additions & 0 deletions packages/u/unicorn/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package("unicorn")
set_homepage("http://www.unicorn-engine.org")
set_description("Unicorn CPU emulator framework (ARM, AArch64, M68K, Mips, Sparc, PowerPC, RiscV, S390x, X86)")

add_urls("https://github.com/unicorn-engine/unicorn.git")
add_versions("2022.02.13", "c10639fd4658a852049546162d116b123e2b1ec2")

add_deps("cmake")
add_deps("glib")

local archs = {"aarch64", "sparc", "sparc", "riscv64", "arm", "m68k",
"x86_64", "s390x", "mips64", "sparc64", "ppc", "ppc64",
"mipsel", "riscv32", "mips", "mips64el"}
add_configs("arch", {description = "Select unicorn architecture for softmmu.", default = "aarch64", values = archs})

on_load(function (package)
package:add("links", "unicorn")
package:add("links", package:config("arch") .. "-softmmu")
package:add("links", "unicorn-common")
end)

on_install("windows", "macosx", "linux", function (package)
local configs = {
"-DUNICORN_BUILD_TESTS=OFF",
"-DUNICORN_STATIC_MSVCRT=OFF"}
local arch = package:config("arch")
if arch == "x86_64" then
table.insert(configs, "-DUNICORN_ARCH=x86")
elseif arch:startswith("riscv") then
table.insert(configs, "-DUNICORN_ARCH=riscv")
elseif arch:startswith("mips") then
table.insert(configs, "-DUNICORN_ARCH=mips")
elseif arch:startswith("ppc") then
table.insert(configs, "-DUNICORN_ARCH=ppc")
else
table.insert(configs, "-DUNICORN_ARCH=" .. arch)
end
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
import("package.tools.cmake").install(package, configs, {buildir = "build"})
if package:is_plat("windows") then
os.cp("include", package:installdir())
end
os.trycp("build/*.a", package:installdir("lib"))
os.trycp("build/*.lib", package:installdir("lib"))
os.trycp("build/*.dylib", package:installdir("lib"))
os.trycp("build/*.so", package:installdir("lib"))
os.trycp("build/*.dll", package:installdir("bin"))
end)

on_test(function (package)
assert(package:has_cfuncs("uc_open", {includes = "unicorn/unicorn.h"}))
end)