소스 검색

quickjs-ng: remove limits (#6188)

* quickjs-ng: remove limits

* quickjs-ng: allow wasm & copy files to installdir & improve cross code

* remove changes to workflows

* quickjs-ng: add m link for linux arm64

* quickjs-ng: add arm64-v8a to is_arch

* quickjs-ng: simplify if statement for m library link

* quickjs-ng: copy all header files
Chi Huu Huynh 7 달 전
부모
커밋
1a996c990d
1개의 변경된 파일17개의 추가작업 그리고 7개의 파일을 삭제
  1. 17 7
      packages/q/quickjs-ng/xmake.lua

+ 17 - 7
packages/q/quickjs-ng/xmake.lua

@@ -13,7 +13,7 @@ package("quickjs-ng")
 
     add_configs("libc", {description = "Build standard library modules as part of the library", default = false, type = "boolean"})
 
-    if is_plat("linux", "bsd") then
+    if is_plat("linux", "bsd", "cross") then
         add_syslinks("m", "pthread")
     end
 
@@ -28,14 +28,9 @@ package("quickjs-ng")
                 assert(minor and minor >= 30, "package(quickjs-ng) require vs_toolset >= 14.3")
             end
         end)
-        on_check("wasm", "cross", function (package)
-            if package:version():eq("0.8.0") then
-                raise("package(quickjs-ng v0.8.0) unsupported platform")
-            end
-        end)
     end
 
-    on_install("!iphoneos and (!windows or windows|!x86)", function (package)
+    on_install(function (package)
         io.replace("CMakeLists.txt", "xcheck_add_c_compiler_flag(-Werror)", "", {plain = true})
         io.replace("CMakeLists.txt", "if(NOT WIN32 AND NOT EMSCRIPTEN)", "if(0)", {plain = true})
 
@@ -49,12 +44,27 @@ package("quickjs-ng")
         if package:config("shared") and package:is_plat("windows") then
             table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
         end
+        if package:is_plat("wasm") then
+            io.replace("quickjs-libc.c", " defined(__wasi__)", " (defined(__wasi__) || defined(EMSCRIPTEN))", {plain = true})
+            io.replace("quickjs-libc.c", " !defined(__wasi__)", " (!defined(__wasi__) && !defined(EMSCRIPTEN))", {plain = true})
+        end
+        if package:is_plat("linux", "bsd", "cross") then
+            io.replace("CMakeLists.txt", "M_LIBRARIES OR CMAKE_C_COMPILER_ID STREQUAL \"TinyCC\"", "1", {plain = true}) -- m library link
+        end
         import("package.tools.cmake").install(package, configs)
 
         if package:is_plat("windows") and package:is_debug() then
             local dir = package:installdir(package:config("shared") and "bin" or "lib")
             os.vcp(path.join(package:buildir(), "qjs.pdb"), dir)
         end
+
+        os.trycp("*.h", package:installdir("include"))
+        os.trycp(path.join(package:buildir(), "**.a"), package:installdir("lib"))
+        os.trycp(path.join(package:buildir(), "**.so"), package:installdir("lib"))
+        os.trycp(path.join(package:buildir(), "**.dylib"), package:installdir("lib"))
+        os.trycp(path.join(package:buildir(), "**.lib"), package:installdir("lib"))
+        os.trycp(path.join(package:buildir(), "**.dll"), package:installdir("bin"))
+        package:add("links", "qjs")
     end)
 
     on_test(function (package)