Skip to content

Commit

Permalink
improve unicorn
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Feb 22, 2022
1 parent e0fa068 commit ee53d1f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
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
26 changes: 25 additions & 1 deletion packages/u/unicorn/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,39 @@ package("unicorn")
add_deps("cmake")
add_deps("glib")

add_links("unicorn", "unicorn-common", "aarch64-softmmu", "sparc-softmmu", "riscv64-softmmu", "arm-softmmu", "m68k-softmmu", "x86_64-softmmu", "s390x-softmmu", "mips64-softmmu", "sparc64-softmmu", "ppc-softmmu", "ppc64-softmmu", "mipsel-softmmu", "riscv32-softmmu", "mips-softmmu", "mips64el-softmmu")
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"))
Expand Down

0 comments on commit ee53d1f

Please sign in to comment.