@@ -8,15 +8,39 @@ package("unicorn")
8
8
add_deps (" cmake" )
9
9
add_deps (" glib" )
10
10
11
- 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" )
11
+ local archs = {" aarch64" , " sparc" , " sparc" , " riscv64" , " arm" , " m68k" ,
12
+ " x86_64" , " s390x" , " mips64" , " sparc64" , " ppc" , " ppc64" ,
13
+ " mipsel" , " riscv32" , " mips" , " mips64el" }
14
+ add_configs (" arch" , {description = " Select unicorn architecture for softmmu." , default = " aarch64" , values = archs })
15
+
16
+ on_load (function (package )
17
+ package :add (" links" , " unicorn" )
18
+ package :add (" links" , package :config (" arch" ) .. " -softmmu" )
19
+ package :add (" links" , " unicorn-common" )
20
+ end )
12
21
13
22
on_install (" windows" , " macosx" , " linux" , function (package )
14
23
local configs = {
15
24
" -DUNICORN_BUILD_TESTS=OFF" ,
16
25
" -DUNICORN_STATIC_MSVCRT=OFF" }
26
+ local arch = package :config (" arch" )
27
+ if arch == " x86_64" then
28
+ table.insert (configs , " -DUNICORN_ARCH=x86" )
29
+ elseif arch :startswith (" riscv" ) then
30
+ table.insert (configs , " -DUNICORN_ARCH=riscv" )
31
+ elseif arch :startswith (" mips" ) then
32
+ table.insert (configs , " -DUNICORN_ARCH=mips" )
33
+ elseif arch :startswith (" ppc" ) then
34
+ table.insert (configs , " -DUNICORN_ARCH=ppc" )
35
+ else
36
+ table.insert (configs , " -DUNICORN_ARCH=" .. arch )
37
+ end
17
38
table.insert (configs , " -DCMAKE_BUILD_TYPE=" .. (package :debug () and " Debug" or " Release" ))
18
39
table.insert (configs , " -DBUILD_SHARED_LIBS=" .. (package :config (" shared" ) and " ON" or " OFF" ))
19
40
import (" package.tools.cmake" ).install (package , configs , {buildir = " build" })
41
+ if package :is_plat (" windows" ) then
42
+ os .cp (" include" , package :installdir ())
43
+ end
20
44
os .trycp (" build/*.a" , package :installdir (" lib" ))
21
45
os .trycp (" build/*.lib" , package :installdir (" lib" ))
22
46
os .trycp (" build/*.dylib" , package :installdir (" lib" ))
0 commit comments