update some crypto libraries (#980)

* update some crypto libraries

* update libcurl

* update cpr

* fix build

* fix on apple platforms
pull/981/head
Hoildkv 3 years ago committed by GitHub
parent 213331f704
commit 590fde966f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      packages/c/cpr/xmake.lua
  2. 1
      packages/l/libcurl/versions.lua
  3. 108
      packages/l/libcurl/xmake.lua
  4. 7
      packages/l/libgcrypt/xmake.lua
  5. 12
      packages/l/libgpg-error/xmake.lua
  6. 47
      packages/l/libssh2/xmake.lua

@ -1,21 +1,22 @@
package("cpr")
set_homepage("https://whoshuu.github.io/cpr/")
set_homepage("https://docs.libcpr.org/")
set_description("C++ Requests is a simple wrapper around libcurl inspired by the excellent Python Requests project.")
set_license("MIT")
set_urls("https://github.com/whoshuu/cpr/archive/refs/tags/$(version).tar.gz",
"https://github.com/whoshuu/cpr.git")
set_urls("https://github.com/libcpr/cpr/archive/refs/tags/$(version).tar.gz",
"https://github.com/libcpr/cpr.git")
add_versions("1.6.2", "c45f9c55797380c6ba44060f0c73713fbd7989eeb1147aedb8723aa14f3afaa3")
add_versions("1.7.2", "aa38a414fe2ffc49af13a08b6ab34df825fdd2e7a1213d032d835a779e14176f")
add_deps("cmake", "libcurl")
on_install("linux", "macosx", "windows", function (package)
local configs = {"-DCPR_BUILD_TESTS=OFF", "-DCPR_FORCE_USE_SYSTEM_CURL=ON"}
local configs = {"-DCPR_BUILD_TESTS=OFF", "-DCPR_ENABLE_SSL=ON", "-DCPR_FORCE_USE_SYSTEM_CURL=ON"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
local shflags
if package:config("shared") and package:is_plat("macosx") then
shflags = {"-framework", "Security"}
shflags = {"-framework", "CoreFoundation", "-framework", "Security", "-framework", "SystemConfiguration"}
end
import("package.tools.cmake").install(package, configs, {shflags = shflags})
end)

@ -1,4 +1,5 @@
function add_versions_list()
add_versions("7.81.0", "1e7a38d7018ec060f1f16df839854f0889e94e122c4cfa5d3a37c2dc56f1e258")
add_versions("7.80.0", "dd0d150e49cd950aff35e16b628edf04927f0289df42883750cf952bb858189c")
add_versions("7.78.0", "98530b317dc95ccb324bbe4f834f07bb642fbc393b794ddf3434f246a71ea44a")
add_versions("7.77.0", "6c0c28868cb82593859fc43b9c8fdb769314c855c05cf1b56b023acf855df8ea")

@ -12,23 +12,25 @@ package("libcurl")
{version = function (version) return (version:gsub("%.", "_")) .. "/curl-" .. version end})
add_versions_list()
if is_plat("linux") then
add_deps("openssl")
elseif is_plat("windows") then
add_deps("cmake")
end
if is_plat("macosx") then
if is_plat("macosx", "iphoneos") then
add_frameworks("Security", "CoreFoundation", "SystemConfiguration")
elseif is_plat("linux") then
add_syslinks("pthread")
elseif is_plat("windows", "mingw") then
add_syslinks("advapi32", "crypt32", "winmm", "ws2_32")
add_deps("cmake")
add_syslinks("advapi32", "crypt32", "wldap32", "winmm", "ws2_32")
end
add_configs("zlib", {description = "Enable zlib compression library.", default = false, type = "boolean"})
add_configs("zstd", {description = "Enable zstd compression library.", default = false, type = "boolean"})
add_configs("openssl", {description = "Enable openssl library.", default = false, type = "boolean"})
add_configs("cares", {description = "Enable c-ares support.", default = false, type = "boolean"})
add_configs("openssl", {description = "Enable OpenSSL for SSL/TLS.", default = is_plat("linux", "cross"), type = "boolean"})
add_configs("mbedtls", {description = "Enable mbedTLS for SSL/TLS.", default = false, type = "boolean"})
add_configs("nghttp2", {description = "Use Nghttp2 library.", default = false, type = "boolean"})
add_configs("openldap", {description = "Use OpenLDAP library.", default = false, type = "boolean"})
add_configs("libidn2", {description = "Use Libidn2 for IDN support.", default = false, type = "boolean"})
add_configs("zlib", {description = "Enable zlib support.", default = false, type = "boolean"})
add_configs("zstd", {description = "Enable zstd support.", default = false, type = "boolean"})
add_configs("brotli", {description = "Enable brotli support.", default = false, type = "boolean"})
add_configs("libssh2", {description = "Use libSSH2 library.", default = false, type = "boolean"})
on_load(function (package)
if package:is_plat("windows", "mingw") then
@ -36,9 +38,16 @@ package("libcurl")
package:add("defines", "CURL_STATICLIB")
end
end
local configdeps = {zlib = "zlib",
openssl = "openssl",
zstd = "zstd"}
local configdeps = {cares = "c-ares",
openssl = "openssl",
mbedtls = "mbedtls",
nghttp2 = "nghttp2",
openldap = "openldap",
libidn2 = "libidn2",
zlib = "zlib",
zstd = "zstd",
brotli = "brotli",
libssh2 = "libssh2"}
for name, dep in pairs(configdeps) do
if package:config(name) then
package:add("deps", dep)
@ -47,32 +56,40 @@ package("libcurl")
end)
on_install("windows", "mingw@windows", function (package)
local configs = {"-DBUILD_TESTING=OFF"}
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
local configs = {"-DBUILD_TESTING=OFF", "-DENABLE_MANUAL=OFF"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DCURL_DISABLE_LDAP=ON")
table.insert(configs, "-DCMAKE_USE_SCHANNEL=ON")
table.insert(configs, "-DCMAKE_USE_LIBSSH2=OFF")
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, (package:version():ge("7.80") and "-DCURL_USE_SCHANNEL=ON" or "-DCMAKE_USE_SCHANNEL=ON"))
local configopts = {cares = "ENABLE_ARES",
openssl = "CURL_USE_OPENSSL",
mbedtls = "CURL_USE_MBEDTLS",
nghttp2 = "USE_NGHTTP2",
openldap = "CURL_USE_OPENLDAP",
libidn2 = "USE_LIBIDN2",
zlib = "CURL_ZLIB",
zstd = "CURL_ZSTD",
brotli = "CURL_BROTLI",
libssh2 = "CURL_USE_LIBSSH2"}
for name, opt in pairs(configopts) do
table.insert(configs, "-D" .. opt .. "=" .. (package:config(name) and "ON" or "OFF"))
end
if is_plat("windows") then
table.insert(configs, "-DCURL_STATIC_CRT=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
end
for name, enabled in pairs(package:configs()) do
if not package:extraconf("configs", name, "builtin") then
if name == "openssl" then
table.insert(configs, "-DCMAKE_USE_" .. name:upper() .. (enabled and "=ON" or "=OFF"))
else
if name == "zlib" and not enabled then
io.replace("CMakeLists.txt", "if(ZLIB_FOUND)", "if(OFF)", {palin = true}) -- disable zlib now
end
table.insert(configs, "-DCURL_" .. name:upper() .. (enabled and "=ON" or "=OFF"))
end
end
end
import("package.tools.cmake").install(package, configs)
end)
on_install("macosx", "linux", "iphoneos", "mingw@macosx,linux", "cross", function (package)
local configs = {"--disable-silent-rules", "--disable-dependency-tracking"}
on_install("macosx", "linux", "iphoneos", "mingw@macosx", "cross", function (package)
local configs = {"--disable-silent-rules",
"--disable-dependency-tracking",
"--without-ca-bundle",
"--without-hyper",
"--without-libpsl",
"--without-libgsasl",
"--without-librtmp",
"--without-quiche",
"--without-ngtcp2",
"--without-nghttp3"}
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
@ -81,26 +98,17 @@ package("libcurl")
if package:config("pic") ~= false then
table.insert(configs, "--with-pic")
end
if is_plat("macosx") then
if is_plat("macosx", "iphoneos") then
table.insert(configs, (package:version():ge("7.77") and "--with-secure-transport" or "--with-darwinssl"))
end
table.insert(configs, "--without-libidn2")
table.insert(configs, "--without-nghttp2")
table.insert(configs, "--without-brotli")
table.insert(configs, "--without-ca-path")
table.insert(configs, "--without-librtmp")
table.insert(configs, "--without-libpsl")
table.insert(configs, "--disable-ares")
table.insert(configs, "--disable-ldap")
for name, enabled in pairs(package:configs()) do
if not package:extraconf("configs", name, "builtin") then
if enabled then
table.insert(configs, "--with-" .. name)
else
table.insert(configs, "--without-" .. name)
end
end
if is_plat("mingw") then
table.insert(configs, "--with-schannel")
end
for _, name in ipairs({"openssl", "mbedtls", "zlib", "brotli", "zstd", "libssh2", "libidn2", "nghttp2"}) do
table.insert(configs, package:config(name) and "--with-" .. name or "--without-" .. name)
end
table.insert(configs, package:config("cares") and "--enable-ares" or "--disable-ares")
table.insert(configs, package:config("openldap") and "--enable-ldap" or "--disable-ldap")
import("package.tools.autoconf").install(package, configs)
end)

@ -4,12 +4,13 @@ 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://github.com/gpg/libgcrypt/archive/refs/tags/libgcrypt-$(version).tar.gz")
add_versions("1.8.7", "c6e5bb1d29c0af709f67d1b748fd4eeada52a487bc2990366510b1b91e5204fb")
add_urls("https://www.gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-$(version).tar.gz")
add_versions("1.10.0", "624dc2f72aaadf6ef4e183589aba794cc060bfbf14d2f4f0995b4d636189c584")
add_deps("libgpg-error", "libxml2")
add_deps("libgpg-error")
on_install("linux", "macosx", function (package)
local configs = {"--disable-doc"}
table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
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

@ -4,13 +4,15 @@ 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://github.com/gpg/libgpg-error/archive/refs/tags/libgpg-error-$(version).tar.gz")
add_versions("1.39", "fff17f17928bc6efa2775b16d2ea986a9b82c128ab64dc877325cce468d9b4de")
add_deps("automake", "autoconf", "gettext")
add_urls("https://www.gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-$(version).tar.bz2")
add_versions("1.44", "8e3d2da7a8b9a104dd8e9212ebe8e0daf86aa838cc1314ba6bc4de8f2d8a1ff9")
if is_plat("macosx") then
add_deps("libintl")
end
on_install("linux", "macosx", function (package)
local configs = {"--disable-doc", "--disable-tests", "--with-pic"}
local configs = {"--disable-doc", "--disable-tests"}
table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
if package:config("pic") ~= false then
table.insert(configs, "--with-pic")

@ -9,27 +9,52 @@ package("libssh2")
"https://github.com/libssh2/libssh2.git")
add_versions("1.10.0", "2d64e90f3ded394b91d3a2e774ca203a4179f69aebee03003e5a6fa621e41d51")
add_deps("libgcrypt")
if is_plat("linux") then
add_deps("openssl")
add_configs("backend", {description = "Select crypto backend.", default = (is_plat("windows") and "wincng" or "openssl"), type = "string", values = {"openssl", "wincng", "mbedtls", "libgcrypt"}})
add_deps("zlib")
if is_plat("windows") then
add_deps("cmake")
add_syslinks("bcrypt", "crypt32", "ws2_32")
end
on_load(function (package)
if package:gitref() then
package:add("deps", "automake", "autoconf")
end
local backend = package:config("backend")
if backend ~= "wincng" then
package:add("deps", backend)
end
end)
on_install("windows", function (package)
local configs = {"-DBUILD_TESTING=OFF",
"-DBUILD_EXAMPLES=OFF",
"-DENABLE_ZLIB_COMPRESSION=ON"}
local backend_name = {wincng = "WinCNG",
openssl = "OpenSSL",
mbedtls = "mbedTLS",
libgcrypt = "Libgcrypt"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DCRYPTO_BACKEND=" .. backend_name[package:config("backend")])
import("package.tools.cmake").install(package, configs)
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())
local configs = {"--disable-silent-rules",
"--disable-examples-build",
"--with-libz"}
local lib_prefix = {openssl = "libssl",
mbedtls = "libmbedcrypto",
libgcrypt = "libgcrypt"}
local backend = package:config("backend")
table.insert(configs, "--with-crypto=" .. backend)
local dep = package:dep(backend)
if dep and not dep:is_system() then
table.insert(configs, "--with-" .. lib_prefix[backend] .. "-prefix=" .. dep:installdir())
end
table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
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")

Loading…
Cancel
Save