Kaynağa Gözat

Add libssh2 (#688)

* add libssh2

* improve libssh2

* remove windows

* improve libssh2

* improve gpg-error

* improve libssh2

* improve libssh2

* use autoconf
ruki 3 yıl önce
ebeveyn
işleme
43a494a984

+ 8 - 11
packages/l/libgcrypt/xmake.lua

@@ -4,20 +4,17 @@ package("libgcrypt")
     set_description("Libgcrypt is a general purpose cryptographic library originally based on code from GnuPG.")
     set_license("GPL-2.0")
 
-    add_urls("https://gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-$(version).tar.gz")
-    add_versions("1.8.7", "55d98db5e5c7e7bb1efabe1299040d501e5d55272e10f60b68de9f9118b53102")
+    add_urls("https://github.com/gpg/libgcrypt/archive/refs/tags/libgcrypt-$(version).tar.gz")
+    add_versions("1.8.7", "c6e5bb1d29c0af709f67d1b748fd4eeada52a487bc2990366510b1b91e5204fb")
 
     add_deps("libgpg-error", "libxml2")
-    on_install("linux", function (package)
-        local configs = {"--disable-doc", "--with-pic"}
-        if package:config("shared") then
-            table.insert(configs, "--enable-shared=yes")
-            table.insert(configs, "--enable-static=no")
-        else
-            table.insert(configs, "--enable-static=yes")
-            table.insert(configs, "--enable-shared=no")
-        end
+    on_install("linux", "macosx", function (package)
+        local configs = {"--disable-doc"}
+        table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
         table.insert(configs, "--with-libgpg-error-prefix=" .. package:dep("libgpg-error"):installdir())
+        if package:config("pic") ~= false then
+            table.insert(configs, "--with-pic")
+        end
         import("package.tools.autoconf").install(package, configs)
     end)
 

+ 8 - 9
packages/l/libgpg-error/xmake.lua

@@ -4,17 +4,16 @@ package("libgpg-error")
     set_description("Libgpg-error is a small library that originally defined common error values for all GnuPG components.")
     set_license("GPL-2.0")
 
-    add_urls("https://gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-$(version).tar.gz")
-    add_versions("1.39", "3d4dc56588d62ff01067af192e2d3de38ef4c060857ed8da77327365477569ca")
+    add_urls("https://github.com/gpg/libgpg-error/archive/refs/tags/libgpg-error-$(version).tar.gz")
+    add_versions("1.39", "fff17f17928bc6efa2775b16d2ea986a9b82c128ab64dc877325cce468d9b4de")
 
-    on_install("linux", function (package)
+    add_deps("automake", "autoconf", "gettext")
+
+    on_install("linux", "macosx", function (package)
         local configs = {"--disable-doc", "--disable-tests", "--with-pic"}
-        if package:config("shared") then
-            table.insert(configs, "--enable-shared=yes")
-            table.insert(configs, "--enable-static=no")
-        else
-            table.insert(configs, "--enable-static=yes")
-            table.insert(configs, "--enable-shared=no")
+        table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
+        if package:config("pic") ~= false then
+            table.insert(configs, "--with-pic")
         end
         import("package.tools.autoconf").install(package, configs)
     end)

+ 45 - 0
packages/l/libssh2/xmake.lua

@@ -0,0 +1,45 @@
+package("libssh2")
+
+    set_homepage("https://www.libssh2.org/")
+    set_description("C library implementing the SSH2 protocol")
+    set_license("BSD-3-Clause")
+
+    set_urls("https://github.com/libssh2/libssh2/releases/download/libssh2-$(version)/libssh2-$(version).tar.gz",
+             "https://www.libssh2.org/download/libssh2-$(version).tar.gz",
+             "https://github.com/libssh2/libssh2.git")
+    add_versions("1.10.0", "2d64e90f3ded394b91d3a2e774ca203a4179f69aebee03003e5a6fa621e41d51")
+
+    add_deps("libgcrypt")
+    if is_plat("linux") then
+        add_deps("openssl")
+    end
+
+    on_load(function (package)
+        if package:gitref() then
+            package:add("deps", "automake", "autoconf")
+        end
+    end)
+
+    on_install("macosx", "linux", function (package)
+        local configs = {
+        "--disable-silent-rules",
+        "--disable-examples-build",
+        "--with-openssl",
+        "--with-libz"}
+        local openssl = package:dep("openssl")
+        if openssl then
+            table.insert(configs, "--with-libssl-prefix=" .. openssl:installdir())
+        end
+        table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
+        if package:is_plat("linux") and package:config("pic") ~= false then
+            table.insert(configs, "--with-pic")
+        end
+        if package:gitref() then
+            os.vrunv("sh", {"./buildconf"})
+        end
+        import("package.tools.autoconf").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("libssh2_exit", {includes = "libssh2.h"}))
+    end)