Selaa lähdekoodia

improve uuid to support android on windows (#1890)

* improve libuuid

* update url
ruki 2 vuotta sitten
vanhempi
commit
4b802f5760
1 muutettua tiedostoa jossa 21 lisäystä ja 9 poistoa
  1. 21 9
      packages/l/libuuid/xmake.lua

+ 21 - 9
packages/l/libuuid/xmake.lua

@@ -4,21 +4,33 @@ package("libuuid")
     set_license("BSD-3-Clause")
 
     set_urls("https://sourceforge.net/projects/libuuid/files/libuuid-$(version).tar.gz",
+             "https://github.com/xmake-mirror/libuuid/releases/download/$(version)/libuuid-$(version).tar.gz",
              "https://git.code.sf.net/p/libuuid/code.git")
 
     add_versions("1.0.3", "46af3275291091009ad7f1b899de3d0cea0252737550e7919d17237997db5644")
 
-    on_install("linux", "macosx", "android", "iphoneos", "wasm", function(package)
+    on_install("linux", "macosx", "bsd", "android", "iphoneos", "wasm", "cross", function(package)
+        io.writefile("xmake.lua", [[
+            includes("check_cfuncs.lua")
+            add_rules("mode.debug", "mode.release")
+            target("uuid")
+                set_kind("$(kind)")
+                add_files("*.c|test_*.c")
+                add_headerfiles("*.h", {prefixdir = "uuid"})
+                add_rules("utils.install.pkgconfig_importfiles", {filename = "uuid.pc"})
+                check_cfuncs("HAVE_USLEEP", "usleep", {includes = "unistd.h"})
+                check_cfuncs("HAVE_FTRUNCATE", "ftruncate", {includes = "unistd.h"})
+                check_cfuncs("HAVE_GETTIMEOFDAY", "gettimeofday", {includes = "sys/time.h"})
+                check_cfuncs("HAVE_MEMSET", "memset", {includes = "string.h"})
+                check_cfuncs("HAVE_SOCKET", "socket", {includes = "sys/socket.h"})
+                check_cfuncs("HAVE_STRTOUL", "strtoul", {includes = "stdlib.h"})
+                check_cfuncs("HAVE_SRANDOM", "srandom", {includes = "stdlib.h"})
+        ]])
         local configs = {}
-        table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
-        table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
-        if package:debug() then
-            table.insert(configs, "--enable-debug")
+        if package:config("shared") then
+            configs.kind = "shared"
         end
-        if package:config("pic") ~= false then
-            table.insert(configs, "--with-pic")
-        end
-        import("package.tools.autoconf").install(package, configs)
+        import("package.tools.xmake").install(package, configs)
     end)
 
     on_test(function(package)