Ver código fonte

add luajit gc64 option (#510)

* add luajit gc64 option

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

Co-authored-by: ruki <[email protected]>
Pavel Siberx 4 anos atrás
pai
commit
9abd312f07
2 arquivos alterados com 16 adições e 6 exclusões
  1. 15 6
      packages/l/luajit/port/xmake.lua
  2. 1 0
      packages/l/luajit/xmake.lua

+ 15 - 6
packages/l/luajit/port/xmake.lua

@@ -17,6 +17,10 @@ option("fpu")
     set_showmenu(true)
     add_defines("LJ_ARCH_HASFPU=1", "LJ_ABI_SOFTFP=0")
 
+option("gc64")
+    set_default(false)
+    set_showmenu(true)
+
 rule("dasc")
     set_extensions(".dasc")
     before_build_file(function(target, sourcefile)
@@ -133,10 +137,13 @@ target("buildvm")
         add_files("src/vm_x86.dasc")
         add_defines("LUAJIT_TARGET=LUAJIT_ARCH_X86", {public = true})
     elseif is_arch("x64", "x86_64") then
-        --FIXME will crash
-        --add_files("src/vm_x64.dasc")
+        if has_config("gc64") then
+            add_files("src/vm_x64.dasc")
+            add_defines("LUAJIT_ENABLE_GC64", {public = true})
+        else
+            add_files("src/vm_x86.dasc")
+        end
         add_defines("LUAJIT_TARGET=LUAJIT_ARCH_X64", {public = true})
-        add_files("src/vm_x86.dasc")
     elseif is_arch("arm64", "arm64-v8a") then
         add_files("src/vm_arm64.dasc")
         add_defines("LUAJIT_TARGET=LUAJIT_ARCH_ARM64", {public = true})
@@ -159,6 +166,8 @@ target("buildvm")
         add_defines("LUAJIT_OS=LUAJIT_OS_WINDOWS", {public = true})
     elseif is_plat("linux", "android") then
         add_defines("LUAJIT_OS=LUAJIT_OS_LINUX", {public = true})
+    elseif is_plat("bsd") then
+        add_defines("LUAJIT_OS=LUAJIT_OS_BSD", {public = true})
     else
         add_defines("LUAJIT_OS=LUAJIT_OS_OTHER", {public = true})
     end
@@ -205,19 +214,19 @@ target("luajit_bin")
     add_files("src/luajit.c")
     add_options("nojit", "fpu")
     if is_plat("windows") then
-        add_links("advapi32", "shell32")
+        add_syslinks("advapi32", "shell32")
         if is_arch("x86") then
             add_ldflags("/subsystem:console,5.01")
         else
             add_ldflags("/subsystem:console,5.02")
         end
     elseif is_plat("android") then
-        add_links("m", "c")
+        add_syslinks("m", "c")
     elseif is_plat("macosx") then
         add_ldflags("-all_load", "-pagezero_size 10000", "-image_base 100000000")
     elseif is_plat("mingw") then
         add_ldflags("-static-libgcc", {force = true})
     else
-        add_links("pthread", "dl", "m", "c")
+        add_syslinks("pthread", "dl", "m", "c")
     end
 

+ 1 - 0
packages/l/luajit/xmake.lua

@@ -11,6 +11,7 @@ package("luajit")
 
     add_configs("nojit", { description = "Disable JIT.", default = false, type = "boolean"})
     add_configs("fpu",   { description = "Enable FPU.", default = true, type = "boolean"})
+    add_configs("gc64",  { description = "Enable GC64.", default = false, type = "boolean"})
 
     add_includedirs("include/luajit")
     if not is_plat("windows") then