Procházet zdrojové kódy

Auto-update blake3 to 1.5.2 (#4659)

* Update blake3 to 1.5.2

* fix x86 dll export

* add check

---------

Co-authored-by: star9029 <[email protected]>
ruki před 1 rokem
rodič
revize
2989c39b82
2 změnil soubory, kde provedl 38 přidání a 37 odebrání
  1. 29 0
      packages/b/blake3/port/xmake.lua
  2. 9 37
      packages/b/blake3/xmake.lua

+ 29 - 0
packages/b/blake3/port/xmake.lua

@@ -0,0 +1,29 @@
+add_rules("mode.release", "mode.debug")
+
+target("blake3")
+    set_kind("$(kind)")
+    add_files("c/blake3.c", "c/blake3_dispatch.c", "c/blake3_portable.c")
+    add_headerfiles("c/blake3.h")
+
+    if is_arch("x86_64", "x64") then
+        if is_subhost("msys", "cygwin") then
+            add_files("c/*x86-64_windows_gnu.S")
+        elseif is_plat("windows") then
+            add_files("c/*x86-64_windows_msvc.asm")
+        else
+            add_files("c/*x86-64_unix.S")
+        end
+    elseif is_arch("x86", "i386") then
+        add_files("c/blake3_portable.c")
+        add_files("c/blake3_sse2.c")
+        add_files("c/blake3_sse41.c")
+        add_files("c/blake3_avx2.c")
+        add_files("c/blake3_avx512.c")
+    elseif is_arch("arm64", "arm64-v8a") then
+        add_files("c/blake3_neon.c")
+        add_defines("BLAKE3_USE_NEON=1")
+    end
+
+    if is_plat("windows") and is_kind("shared") then
+        add_rules("utils.symbols.export_all")
+    end

+ 9 - 37
packages/b/blake3/xmake.lua

@@ -5,49 +5,21 @@ package("blake3")
 
     add_urls("https://github.com/BLAKE3-team/BLAKE3/archive/refs/tags/$(version).tar.gz",
              "https://github.com/BLAKE3-team/BLAKE3.git")
+
+    add_versions("1.5.2", "1bc38cd3cc501458054c3bb473e5e00338d6175121424040079025ea305ddef3")
     add_versions("1.5.1", "822cd37f70152e5985433d2c50c8f6b2ec83aaf11aa31be9fe71486a91744f37")
     add_versions("1.5.0", "f506140bc3af41d3432a4ce18b3b83b08eaa240e94ef161eb72b2e57cdc94c69")
     add_versions("1.3.3", "27d2bc4ee5945ba75434859521042c949463ee7514ff17aaef328e23ef83fec0")
     add_versions("1.3.1", "112becf0983b5c83efff07f20b458f2dbcdbd768fd46502e7ddd831b83550109")
 
-    on_install("windows|x64", "windows|x86", "linux", "macosx", "bsd", "mingw|x86_64", "android", "iphoneos", "cross", function (package)
-        local configs = {}
-
-        io.writefile("xmake.lua", [[
-            add_rules("mode.release", "mode.debug")
-            target("blake3")
-                set_kind("$(kind)")
-                add_files("c/blake3.c", "c/blake3_dispatch.c", "c/blake3_portable.c")
-                add_headerfiles("c/blake3.h")
-
-                if is_arch("x86_64", "x64") then
-                    if is_subhost("msys", "cygwin") then
-                        add_files("c/*x86-64_windows_gnu.S")
-                    elseif is_plat("windows") then
-                        add_files("c/*x86-64_windows_msvc.asm")
-
-                        if is_kind("shared") then
-                            add_rules("utils.symbols.export_all")
-                        end
-                    else
-                        add_files("c/*x86-64_unix.S")
-                    end
-                elseif is_arch("x86", "i386") then
-                    add_files("c/blake3_portable.c")
-                    add_files("c/blake3_sse2.c")
-                    add_files("c/blake3_sse41.c")
-                    add_files("c/blake3_avx2.c")
-                    add_files("c/blake3_avx512.c")
-                elseif is_arch("arm64", "arm64-v8a") then
-                    add_files("c/blake3_neon.c")
-                    add_defines("BLAKE3_USE_NEON=1")
-                end
-        ]])
-
-        if package:config("shared") then
-            configs.kind = "shared"
-        end
+    if on_check then
+        on_check("mingw", function (package)
+            assert(package:is_arch("x86_64"), "package(blake3/mingw): Only suport x86_64 arch")
+        end)
+    end
 
+    on_install(function (package)
+        os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
         import("package.tools.xmake").install(package, configs)
     end)