Browse Source

uuid_v4: fix package:version() (#6608)

* uuid_v4: fix package:version()

* add check
star9029 6 months ago
parent
commit
d724797e08
1 changed files with 12 additions and 4 deletions
  1. 12 4
      packages/u/uuid_v4/xmake.lua

+ 12 - 4
packages/u/uuid_v4/xmake.lua

@@ -5,18 +5,26 @@ package("uuid_v4")
     set_license("MIT")
 
     add_urls("https://github.com/crashoz/uuid_v4/archive/refs/tags/$(version).tar.gz",
-             "https://github.com/crashoz/uuid_v4.git")
+             "https://github.com/crashoz/uuid_v4.git", {submodules = false})
 
     add_versions("v1.0.0", "0d858bc8e7466be693332f4f16768b29f605ff386443f37a07b1f872db29ff2d")
 
+    if on_check then
+        on_check(function (package)
+            if not package:is_arch("x64", "x86", "x86_64") then
+                raise("package(uuid_v4) only support x86 arch")
+            end
+        end)
+    end
+
     on_load(function (package)
-        if package:version():gt("1.0.0") then
+        if package:gitref() or package:version():gt("1.0.0") then
             package:add("deps", "cmake")
         end
     end)
 
-    on_install("windows|x64", "windows|x86", "linux", "macosx", "bsd", "mingw", "msys", function (package)
-        if package:version():gt("1.0.0") then
+    on_install(function (package)
+        if package:gitref() or package:version():gt("1.0.0") then
             import("package.tools.cmake").install(package)
         else
             os.cp("uuid_v4.h", package:installdir("include"))