aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--repo/packages/l/libcurl/patches/8.7.1/android_armv7.patch38
-rw-r--r--repo/packages/l/libcurl/patches/8.9.0/fix-apple-sdk-bug.patch42
-rw-r--r--repo/packages/l/libcurl/versions.lua8
-rw-r--r--repo/packages/l/libcurl/versions.txt68
-rw-r--r--repo/packages/l/libcurl/xmake.lua195
-rw-r--r--repo/packages/o/openssl3/fetch.lua72
-rw-r--r--repo/packages/o/openssl3/patches/3.3.2/command-line-length.patch14
-rw-r--r--repo/packages/o/openssl3/xmake.lua267
-rw-r--r--repo/packages/s/sentry-native/patches/0.4.4/zlib_fix.patch12
-rw-r--r--repo/packages/s/sentry-native/xmake.lua114
-rw-r--r--src/zencore/crypto.cpp108
-rw-r--r--src/zencore/xmake.lua6
-rw-r--r--src/zenhttp/xmake.lua4
-rw-r--r--thirdparty/xmake.lua5
-rw-r--r--xmake.lua9
15 files changed, 881 insertions, 81 deletions
diff --git a/repo/packages/l/libcurl/patches/8.7.1/android_armv7.patch b/repo/packages/l/libcurl/patches/8.7.1/android_armv7.patch
new file mode 100644
index 000000000..312a5a3d0
--- /dev/null
+++ b/repo/packages/l/libcurl/patches/8.7.1/android_armv7.patch
@@ -0,0 +1,38 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 656aa7c74..4897369fa 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1228,7 +1228,6 @@ check_symbol_exists(getifaddrs "${CURL_INCLUDES};stdlib.h" HAVE_GETIFADDRS)
+ check_symbol_exists(freeaddrinfo "${CURL_INCLUDES}" HAVE_FREEADDRINFO)
+ check_symbol_exists(pipe "${CURL_INCLUDES}" HAVE_PIPE)
+ check_symbol_exists(ftruncate "${CURL_INCLUDES}" HAVE_FTRUNCATE)
+-check_symbol_exists(fseeko "${CURL_INCLUDES};stdio.h" HAVE_FSEEKO)
+ check_symbol_exists(_fseeki64 "${CURL_INCLUDES};stdio.h" HAVE__FSEEKI64)
+ check_symbol_exists(getpeername "${CURL_INCLUDES}" HAVE_GETPEERNAME)
+ check_symbol_exists(getsockname "${CURL_INCLUDES}" HAVE_GETSOCKNAME)
+@@ -1238,10 +1237,6 @@ check_symbol_exists(setlocale "${CURL_INCLUDES}" HAVE_SETLOCALE)
+ check_symbol_exists(setmode "${CURL_INCLUDES}" HAVE_SETMODE)
+ check_symbol_exists(setrlimit "${CURL_INCLUDES}" HAVE_SETRLIMIT)
+
+-if(HAVE_FSEEKO)
+- set(HAVE_DECL_FSEEKO 1)
+-endif()
+-
+ if(NOT MSVC OR (MSVC_VERSION GREATER_EQUAL 1900))
+ # earlier MSVC compilers had faulty snprintf implementations
+ check_symbol_exists(snprintf "stdio.h" HAVE_SNPRINTF)
+@@ -1304,6 +1299,14 @@ if(HAVE_FILE_OFFSET_BITS)
+ endif()
+ check_type_size("off_t" SIZEOF_OFF_T)
+
++# fseeko may not exist with _FILE_OFFSET_BITS=64 but can exist with _FILE_OFFSET_BITS unset or 32 (e.g. Android ARMv7 with NDK 26b and API level < 24)
++# so we need to test fseeko after testing for _FILE_OFFSEt_BITS
++check_symbol_exists(fseeko "${CURL_INCLUDES};stdio.h" HAVE_FSEEKO)
++
++if(HAVE_FSEEKO)
++ set(HAVE_DECL_FSEEKO 1)
++endif()
++
+ # include this header to get the type
+ set(CMAKE_REQUIRED_INCLUDES "${CURL_SOURCE_DIR}/include")
+ set(CMAKE_EXTRA_INCLUDE_FILES "curl/system.h")
diff --git a/repo/packages/l/libcurl/patches/8.9.0/fix-apple-sdk-bug.patch b/repo/packages/l/libcurl/patches/8.9.0/fix-apple-sdk-bug.patch
new file mode 100644
index 000000000..15e43d8dd
--- /dev/null
+++ b/repo/packages/l/libcurl/patches/8.9.0/fix-apple-sdk-bug.patch
@@ -0,0 +1,42 @@
+From 5f6b9244ceecbb1e1b9c08bda5c9292f23f4ea57 Mon Sep 17 00:00:00 2001
+From: Viktor Szakats <[email protected]>
+Date: Fri, 26 Jul 2024 00:10:21 +0200
+Subject: [PATCH] macos: fix Apple SDK bug workaround for non-macOS targets
+
+Turns out that MAC != OSX, despite what these names otherwise mean and
+what's suggested by source code comments. "MAC" in fact means Darwin
+(aka Apple), not macOS. "OSX" means macOS.
+
+GitHub bumped the macos-14 runner default to Xcode 15.4, hitting the
+llvm@15 incompatibility bug by default. Meaning the previous workaround
+for the SDK bug is necessary.
+
+This patch extend the workaround to not apply to mobile OS variants.
+
+Follow-up to ff784af461175584c73e7e2b65af00b1a5a6f67f #14159
+Reported-by: Sergey
+Confirmed-by: Marcel Raad
+Fixes #14269
+Closes #14275
+---
+ lib/curl_setup.h | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/lib/curl_setup.h b/lib/curl_setup.h
+index 1e5371ef8..c8dba5e2b 100644
+--- a/lib/curl_setup.h
++++ b/lib/curl_setup.h
+@@ -71,7 +71,9 @@
+ the necessary dynamic detection features, so the SDK falls back to
+ a codepath that sets both the old and new macro to 1. */
+ #if defined(TARGET_OS_MAC) && TARGET_OS_MAC && \
+- defined(TARGET_OS_OSX) && !TARGET_OS_OSX
++ defined(TARGET_OS_OSX) && !TARGET_OS_OSX && \
++ (!defined(TARGET_OS_IPHONE) || !TARGET_OS_IPHONE) && \
++ (!defined(TARGET_OS_SIMULATOR) || !TARGET_OS_SIMULATOR)
+ #undef TARGET_OS_OSX
+ #define TARGET_OS_OSX TARGET_OS_MAC
+ #endif
+--
+2.47.1
+
diff --git a/repo/packages/l/libcurl/versions.lua b/repo/packages/l/libcurl/versions.lua
index 62a44e8c4..26b5a8049 100644
--- a/repo/packages/l/libcurl/versions.lua
+++ b/repo/packages/l/libcurl/versions.lua
@@ -1,4 +1,10 @@
function add_versions_list()
+ add_versions("8.11.0", "c95d5a1368803729345a632ce42cceeefd5f09c3b4d9582f858f6779f4b8b254")
+ add_versions("8.10.1", "3763cd97aae41dcf41950d23e87ae23b2edb2ce3a5b0cf678af058c391b6ae31")
+ add_versions("8.10.0", "be30a51f7bbe8819adf5a8e8cc6991393ede31f782b8de7b46235cc1eb7beb9f")
+ add_versions("8.9.1", "b57285d9e18bf12a5f2309fc45244f6cf9cb14734e7454121099dd0a83d669a3")
+ add_versions("8.9.0", "1cb4c3657bd092b8c8e586afe87679c0aaa3d761af2aebabd6effd553e57936c")
+ add_versions("8.8.0", "40d3792d38cfa244d8f692974a567e9a5f3387c547579f1124e95ea2a1020d0d")
add_versions("8.7.1", "05bbd2b698e9cfbab477c33aa5e99b4975501835a41b7ca6ca71de03d8849e76")
add_versions("8.5.0", "ce4b6a6655431147624aaf582632a36fe1ade262d5fab385c60f78942dd8d87b")
add_versions("8.4.0", "e5250581a9c032b1b6ed3cf2f9c114c811fc41881069e9892d115cc73f9e88c6")
@@ -60,6 +66,4 @@ function add_versions_list()
add_versions("7.33.0", "0afde4cd949e2658eddc3cda675b19b165eea1af48ac5f3e1ec160792255d1b3")
add_versions("7.32.0", "8e3db42548e01407cb2f1407660c0f528b89ec7afda6264442fc2b229b95223b")
add_versions("7.31.0", "a73b118eececff5de25111f35d1d0aafe1e71afdbb83082a8e44d847267e3e08")
-
- add_patches("7.84.0", path.join(os.scriptdir(), "patches", "7.84.0", "sched.patch"), "e79f56f840cbc6996a153f19d9266bd46fe4154e6b494c8ee0478cb5b87662d3")
end
diff --git a/repo/packages/l/libcurl/versions.txt b/repo/packages/l/libcurl/versions.txt
new file mode 100644
index 000000000..52b5001b0
--- /dev/null
+++ b/repo/packages/l/libcurl/versions.txt
@@ -0,0 +1,68 @@
+8.11.0 c95d5a1368803729345a632ce42cceeefd5f09c3b4d9582f858f6779f4b8b254
+8.10.1 3763cd97aae41dcf41950d23e87ae23b2edb2ce3a5b0cf678af058c391b6ae31
+8.10.0 be30a51f7bbe8819adf5a8e8cc6991393ede31f782b8de7b46235cc1eb7beb9f
+8.9.1 b57285d9e18bf12a5f2309fc45244f6cf9cb14734e7454121099dd0a83d669a3
+8.9.0 1cb4c3657bd092b8c8e586afe87679c0aaa3d761af2aebabd6effd553e57936c
+8.8.0 40d3792d38cfa244d8f692974a567e9a5f3387c547579f1124e95ea2a1020d0d
+8.7.1 05bbd2b698e9cfbab477c33aa5e99b4975501835a41b7ca6ca71de03d8849e76
+8.6.0 b4785f2d8877fa92c0e45d7155cf8cc6750dbda961f4b1a45bcbec990cf2fa9b
+8.5.0 ce4b6a6655431147624aaf582632a36fe1ade262d5fab385c60f78942dd8d87b
+8.4.0 e5250581a9c032b1b6ed3cf2f9c114c811fc41881069e9892d115cc73f9e88c6
+8.0.1 9b6b1e96b748d04b968786b6bdf407aa5c75ab53a3d37c1c8c81cdb736555ccf
+7.87.0 5d6e128761b7110946d1276aff6f0f266f2b726f5e619f7e0a057a474155f307
+7.86.0 f5ca69db03eea17fa8705bdfb1a9f58d76a46c9010518109bb38f313137e0a28
+7.85.0 21a7e83628ee96164ac2b36ff6bf99d467c7b0b621c1f7e317d8f0d96011539c
+7.84.0 702fb26e73190a3bd77071aa146f507b9817cc4dfce218d2ab87f00cd3bc059d
+7.82.0 46d9a0400a33408fd992770b04a44a7434b3036f2e8089ac28b57573d59d371f
+7.81.0 1e7a38d7018ec060f1f16df839854f0889e94e122c4cfa5d3a37c2dc56f1e258
+7.80.0 dd0d150e49cd950aff35e16b628edf04927f0289df42883750cf952bb858189c
+7.78.0 98530b317dc95ccb324bbe4f834f07bb642fbc393b794ddf3434f246a71ea44a
+7.77.0 6c0c28868cb82593859fc43b9c8fdb769314c855c05cf1b56b023acf855df8ea
+7.76.1 7a8e184d7d31312c4ebf6a8cb59cd757e61b2b2833a9ed4f9bf708066e7695e9
+7.75.0 50552d4501c178e4cc68baaecc487f466a3d6d19bbf4e50a01869effb316d026
+7.74.0 0f4d63e6681636539dc88fa8e929f934cd3a840c46e0bf28c73be11e521b77a5
+7.73.0 cf34fe0b07b800f1c01a499a6e8b2af548f6d0e044dca4a29d88a4bee146d131
+7.72.0 ad91970864102a59765e20ce16216efc9d6ad381471f7accceceab7d905703ef
+7.71.1 9d52a4d80554f9b0d460ea2be5d7be99897a1a9f681ffafe739169afd6b4f224
+7.70.0 a50bfe62ad67a24f8b12dd7fd655ac43a0f0299f86ec45b11354f25fbb5829d0
+7.69.1 2ff5e5bd507adf6aa88ff4bbafd4c7af464867ffb688be93b9930717a56c4de8
+7.68.0 207f54917dd6a2dc733065ccf18d61bb5bebeaceb5df49cd9445483e8623eeb9
+7.67.0 dd5f6956821a548bf4b44f067a530ce9445cc8094fd3e7e3fc7854815858586c
+7.66.0 6618234e0235c420a21f4cb4c2dd0badde76e6139668739085a70c4e2fe7a141
+7.65.3 0a855e83be482d7bc9ea00e05bdb1551a44966076762f9650959179c89fce509
+7.64.1 4cc7c738b35250d0680f29e93e0820c4cb40035f43514ea3ec8d60322d41a45d
+7.64.0 d573ba1c2d1cf9d8533fadcce480d778417964e8d04ccddcc76e591d544cf2eb
+7.63.0 9bab7ed4ecff77020a312d84cc5fb7eb02d58419d218f267477a724a17fd8dd8
+7.62.0 7802c54076500be500b171fde786258579d60547a3a35b8c5a23d8c88e8f9620
+7.61.1 a308377dbc9a16b2e994abd55455e5f9edca4e31666f8f8fcfe7a1a4aea419b9
+7.61.0 5f6f336921cf5b84de56afbd08dfb70adeef2303751ffb3e570c936c6d656c9c
+7.60.0 897dfb2204bd99be328279f88f55b7c61592216b0542fcbe995c60aa92871e9b
+7.59.0 b5920ffd6a8c95585fb95070e0ced38322790cb335c39d0dab852d12e157b5a0
+7.58.0 1cb081f97807c01e3ed747b6e1c9fee7a01cb10048f1cd0b5f56cfe0209de731
+7.57.0 c92fe31a348eae079121b73884065e600c533493eb50f1f6cee9c48a3f454826
+7.56.1 2594670367875e7d87b0f129b5e4690150780884d90244ba0fe3e74a778b5f90
+7.55.1 e5b1a92ed3b0c11f149886458fa063419500819f1610c020d62f25b8e4b16cfb
+7.54.1 fdfc4df2d001ee0c44ec071186e770046249263c491fcae48df0e1a3ca8f25a0
+7.53.1 1c7207c06d75e9136a944a2e0528337ce76f15b9ec9ae4bb30d703b59bf530e8
+7.52.1 d16185a767cb2c1ba3d5b9096ec54e5ec198b213f45864a38b3bda4bbf87389b
+7.51.0 7f8240048907e5030f67be0a6129bc4b333783b9cca1391026d700835a788dde
+7.50.3 7b7347d976661d02c84a1f4d6daf40dee377efdc45b9e2c77dedb8acf140d8ec
+7.49.1 eb63cec4bef692eab9db459033f409533e6d10e20942f4b060b32819e81885f1
+7.48.0 864e7819210b586d42c674a1fdd577ce75a78b3dda64c63565abe5aefd72c753
+7.47.1 ddc643ab9382e24bbe4747d43df189a0a6ce38fcb33df041b9cb0b3cd47ae98f
+7.46.0 b7d726cdd8ed4b6db0fa1b474a3c59ebbbe4dcd4c61ac5e7ade0e0270d3195ad
+7.45.0 65154e66b9f8a442b57c436904639507b4ac37ec13d6f8a48248f1b4012b98ea
+7.44.0 1e2541bae6582bb697c0fbae49e1d3e6fad5d05d5aa80dbd6f072e0a44341814
+7.43.0 baa654a1122530483ccc1c58cc112fec3724a82c11c6a389f1e6a37dc8858df9
+7.42.1 e2905973391ec2dfd7743a8034ad10eeb58dab8b3a297e7892a41a7999cac887
+7.41.0 9f8b546bdc5c57d959151acae7ce6610fe929d82b8d0fc5b25a3a2296e5f8bea
+7.40.0 899109eb3900fa6b8a2f995df7f449964292776a04763e94fae640700f883fba
+7.39.0 b222566e7087cd9701b301dd6634b360ae118cc1cbc7697e534dc451102ea4e0
+7.38.0 035bd41e99aa1a4e64713f4cea5ccdf366ca8199e9be1b53d5a043d5165f9eba
+7.37.1 c3ef3cd148f3778ddbefb344117d7829db60656efe1031f9e3065fc0faa25136
+7.36.0 1fbe82b89bcd6b7ccda8cb0ff076edc60e911595030e27689f4abd5ef7f3cfcd
+7.35.0 d774d1701454f1b7d331c2075fc4f6dd972bddc2d171f43645ef3647c7fc0d83
+7.34.0 10beade56b48311499e444783df3413405b22f20a147ed4a1d8a8125f1cc829b
+7.33.0 0afde4cd949e2658eddc3cda675b19b165eea1af48ac5f3e1ec160792255d1b3
+7.32.0 8e3db42548e01407cb2f1407660c0f528b89ec7afda6264442fc2b229b95223b
+7.31.0 a73b118eececff5de25111f35d1d0aafe1e71afdbb83082a8e44d847267e3e08 \ No newline at end of file
diff --git a/repo/packages/l/libcurl/xmake.lua b/repo/packages/l/libcurl/xmake.lua
index f9f61aec9..31ef9a418 100644
--- a/repo/packages/l/libcurl/xmake.lua
+++ b/repo/packages/l/libcurl/xmake.lua
@@ -1,29 +1,27 @@
includes(path.join(os.scriptdir(), "versions.lua"))
package("libcurl")
-
set_homepage("https://curl.haxx.se/")
set_description("The multiprotocol file transfer library.")
set_license("MIT")
- set_urls("https://curl.haxx.se/download/curl-$(version).tar.bz2",
- "http://curl.mirror.anstey.ca/curl-$(version).tar.bz2")
+ set_urls("https://curl.haxx.se/download/curl-$(version).tar.bz2")
add_urls("https://github.com/curl/curl/releases/download/curl-$(version).tar.bz2",
{version = function (version) return (version:gsub("%.", "_")) .. "/curl-" .. version end})
- add_versions_list()
-
- 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_deps("cmake")
- add_syslinks("advapi32", "crypt32", "wldap32", "winmm", "ws2_32", "user32")
+ if add_versionfiles then
+ add_versionfiles("versions.txt")
+ else
+ add_versions_list()
end
+ add_patches("7.84.0", path.join(os.scriptdir(), "patches", "7.84.0", "sched.patch"), "e79f56f840cbc6996a153f19d9266bd46fe4154e6b494c8ee0478cb5b87662d3")
+ add_patches("8.7.1", path.join(os.scriptdir(), "patches", "8.7.1", "android_armv7.patch"), "b172fd25063fcf4bce987b47a3d95d9d79bcf80f45e7e45dbf4aba72c685fb24")
+ add_patches("8.9.0", path.join(os.scriptdir(), "patches", "8.9.0", "fix-apple-sdk-bug.patch"), "9503db07a76d828ab7d33565c6aa65c9df80626c11248a4b670aaf10b42e4de7")
+
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("openssl", {description = "Enable OpenSSL for SSL/TLS.", default = nil, type = "boolean"})
+ add_configs("openssl3", {description = "Enable OpenSSL-3 for SSL/TLS.", default = nil, type = "boolean"})
+ add_configs("mbedtls", {description = "Enable mbedTLS for SSL/TLS.", default = nil, 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"})
@@ -33,22 +31,58 @@ package("libcurl")
add_configs("libssh2", {description = "Use libSSH2 library.", default = false, type = "boolean"})
add_configs("libpsl", {description = "Use libpsl library.", default = false, type = "boolean"})
- if is_plat("mingw") and is_subhost("msys") then
- add_extsources("pacman::curl")
- elseif is_plat("linux") then
- add_extsources("pacman::curl", "apt::libcurl4-gnutls-dev", "apt::libcurl4-nss-dev", "apt::libcurl4-openssl-dev")
- elseif is_plat("macosx") then
- add_extsources("brew::curl")
+ if is_plat("android") and is_host("windows") then
+ add_deps("ninja")
+ set_policy("package.cmake_generator.ninja", true)
end
+ -- we init all configurations in on_load, because package("curl") need it.
on_load(function (package)
+ if package:is_plat("linux", "bsd", "android", "cross") then
+ -- if no TLS backend has been enabled nor disabled, prefer openssl3 on modern systems
+ if package:config("openssl") == nil and package:config("openssl3") == nil and package:config("mbedtls") == nil then
+ -- Default to OpenSSL 3.0+ on Linux systems (Ubuntu 22.04+, Fedora 36+, etc.)
+ -- This helps avoid conflicts with other packages like libgit2 that use OpenSSL 3.0+
+ if package:is_plat("linux") then
+ package:config_set("openssl3", true)
+ else
+ package:config_set("openssl", true)
+ end
+ end
+ end
+
+ assert(not (package:config("openssl") and package:config("openssl3")), "OpenSSL and OpenSSL-3 cannot be enabled at the same time.")
+
+ if package:config("libssh2") then
+ package:config_set("zlib", true)
+ end
+
+ if package:is_plat("macosx", "iphoneos") then
+ package:add("frameworks", "Security", "CoreFoundation", "SystemConfiguration")
+ elseif package:is_plat("linux", "bsd") then
+ package:add("syslinks", "pthread")
+ elseif package:is_plat("windows", "mingw") then
+ package:add("syslinks", "advapi32", "crypt32", "wldap32", "winmm", "ws2_32", "user32")
+ end
+
+ if package:is_plat("mingw") and is_subhost("msys") then
+ package:add("extsources", "pacman::curl")
+ elseif package:is_plat("linux", "bsd") then
+ package:add("extsources", "pacman::curl", "apt::libcurl4-gnutls-dev", "apt::libcurl4-nss-dev", "apt::libcurl4-openssl-dev")
+ elseif package:is_plat("macosx") then
+ package:add("extsources", "brew::curl")
+ end
+
if package:is_plat("windows", "mingw") then
if not package:config("shared") then
package:add("defines", "CURL_STATICLIB")
end
end
+
+ package:add("deps", "cmake")
local configdeps = {cares = "c-ares",
openssl = "openssl",
+ openssl3 = "openssl3",
mbedtls = "mbedtls",
nghttp2 = "nghttp2",
openldap = "openldap",
@@ -61,31 +95,29 @@ package("libcurl")
local has_deps = false
for name, dep in pairs(configdeps) do
if package:config(name) then
- package:add("deps", dep)
+ package:add("deps", dep, {host = package:is_binary()})
has_deps = true
end
end
- if has_deps and package:is_plat("linux", "macosx") then
+ if has_deps and package:is_plat("linux", "bsd", "macosx") then
package:add("deps", "pkg-config")
end
end)
- on_install("windows", "mingw", function (package)
- local configs = {"-DBUILD_TESTING=OFF", "-DENABLE_MANUAL=OFF"}
+ on_install("windows", "mingw", "linux", "bsd", "macosx", "iphoneos", "cross", "android", function (package)
+ local version = package:version()
+
+ local configs = {"-DBUILD_TESTING=OFF", "-DENABLE_MANUAL=OFF", "-DENABLE_CURL_MANUAL=OFF"}
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, (package:version():ge("7.80") and "-DCURL_USE_SCHANNEL=ON" or "-DCMAKE_USE_SCHANNEL=ON"))
- local version = package:version()
if (package:is_plat("mingw") and version:ge("7.85")) then
package:add("syslinks", "bcrypt")
end
local configopts = {cares = "ENABLE_ARES",
- openssl = (version:ge("7.81") and "CURL_USE_OPENSSL" or "CMAKE_USE_OPENSSL"),
mbedtls = (version:ge("7.81") and "CURL_USE_MBEDTLS" or "CMAKE_USE_MBEDTLS"),
nghttp2 = "USE_NGHTTP2",
- openldap = "CURL_USE_OPENLDAP",
libidn2 = "USE_LIBIDN2",
zlib = "CURL_ZLIB",
zstd = "CURL_ZSTD",
@@ -95,51 +127,90 @@ package("libcurl")
for name, opt in pairs(configopts) do
table.insert(configs, "-D" .. opt .. "=" .. (package:config(name) and "ON" or "OFF"))
end
+ table.insert(configs, "-D" .. (version:ge("7.81") and "CURL_USE_OPENSSL" or "CMAKE_USE_OPENSSL") .. "=" .. ((package:config("openssl") or package:config("openssl3")) and "ON" or "OFF"))
+
+ if not package:config("openldap") then
+ table.insert(configs, "-DCURL_DISABLE_LDAP=ON")
+ end
+ if package:is_plat("windows", "mingw") then
+ table.insert(configs, (version:ge("7.80") and "-DCURL_USE_SCHANNEL=ON" or "-DCMAKE_USE_SCHANNEL=ON"))
+ end
+ if package:is_plat("macosx", "iphoneos") then
+ table.insert(configs, (version:ge("7.65") and "-DCURL_USE_SECTRANSP=ON" or "-DCMAKE_USE_DARWINSSL=ON"))
+ end
if package:is_plat("windows") then
table.insert(configs, "-DCURL_STATIC_CRT=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
end
if package:is_plat("mingw") and version:le("7.85.0") then
io.replace("src/CMakeLists.txt", 'COMMAND ${CMAKE_COMMAND} -E echo "/* built-in manual is disabled, blank function */" > tool_hugehelp.c', "", {plain = true})
end
- import("package.tools.cmake").install(package, configs)
- end)
+ if package:is_plat("linux", "bsd", "cross") then
+ io.replace("CMakeLists.txt", "list(APPEND CURL_LIBS OpenSSL::SSL OpenSSL::Crypto)", "list(APPEND CURL_LIBS OpenSSL::SSL OpenSSL::Crypto dl)", {plain = true})
+ io.replace("CMakeLists.txt", "list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES})", "list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES} dl)", {plain = true})
+ end
+ local function handledependency(conf, depname, includeconfig, libconfig)
+ if package:config(conf) then
+ local dep = package:dep(depname)
+ if dep and not dep:is_system() then
+ local fetchinfo = dep:fetch({external = false})
+ if fetchinfo then
+ local includedirs = fetchinfo.includedirs or fetchinfo.sysincludedirs
+ if includedirs and #includedirs > 0 then
+ table.insert(configs, "-D" .. includeconfig .. "=" .. table.concat(includedirs, ";"):gsub("\\", "/"))
+ end
+ if type(libconfig) == "table" then
+ if fetchinfo.libfiles then
+ for _, libfile in ipairs(fetchinfo.libfiles) do
+ local libname = path.basename(libfile)
+ if libname:startswith("lib") then
+ libname = libname:sub(4)
+ end
+ for opt, suffix in pairs(libconfig) do
+ if libname:endswith(suffix) then
+ table.insert(configs, "-D" .. opt .. "=" .. libfile:gsub("\\", "/"))
+ end
+ end
+ end
+ end
+ else
+ if fetchinfo.libfiles then
+ table.insert(configs, "-D" .. libconfig .. "=" .. table.concat(fetchinfo.libfiles, ";"):gsub("\\", "/"))
+ end
+ end
+ end
+ end
+ end
+ end
+ handledependency("brotli", "brotli", "BROTLI_INCLUDE_DIR", {BROTLICOMMON_LIBRARY = "brotlicommon", BROTLIDEC_LIBRARY = "brotlidec"})
+ handledependency("openssl", "openssl", "OPENSSL_INCLUDE_DIR", {OPENSSL_CRYPTO_LIBRARY = "crypto", OPENSSL_SSL_LIBRARY = "ssl"})
+ handledependency("openssl3", "openssl3", "OPENSSL_INCLUDE_DIR", {OPENSSL_CRYPTO_LIBRARY = "crypto", OPENSSL_SSL_LIBRARY = "ssl"})
+ handledependency("mbedtls", "mbedtls", "MBEDTLS_INCLUDE_DIRS", {MBEDTLS_LIBRARY = "mbedtls", MBEDX509_LIBRARY = "mbedx509", MBEDCRYPTO_LIBRARY = "mbedcrypto"})
+ handledependency("zlib", "zlib", "ZLIB_INCLUDE_DIR", "ZLIB_LIBRARY")
+ handledependency("zstd", "zstd", "Zstd_INCLUDE_DIR", "Zstd_LIBRARY")
- on_install("macosx", "linux", "cross", function (package)
- local configs = {"--disable-silent-rules",
- "--disable-dependency-tracking",
- "--without-hyper",
- "--without-libgsasl",
- "--without-librtmp",
- "--without-quiche",
- "--without-ngtcp2",
- "--without-nghttp3"}
+ local libssh2 = package:dep("libssh2")
+ if libssh2 then
+ local libssh2_deps = {"ZLIB::ZLIB"}
+ local backend = libssh2:config("backend")
+ if backend == "openssl" or backend == "openssl3" then
+ table.join2(libssh2_deps, {"OpenSSL::SSL", "OpenSSL::Crypto"})
+ elseif backend == "mbedtls" then
+ table.join2(libssh2_deps, {"${MBEDTLS_LIBRARIES}"})
+ end
- local version = package:version()
- if (package:is_plat("mingw") and version:ge("7.85")) then
- package:add("syslinks", "Bcrypt")
+ if package:is_plat("windows", "mingw") then
+ table.join2(libssh2_deps, {"ws2_32", "user32", "crypt32", "advapi32"})
+ end
+ io.replace("CMakeLists.txt",
+ "list(APPEND CURL_LIBS ${LIBSSH2_LIBRARIES})",
+ format("list(APPEND CURL_LIBS ${LIBSSH2_LIBRARIES} %s)", table.concat(libssh2_deps, " ")), {plain = true})
end
- 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")
- end
- if package:is_plat("macosx", "iphoneos") then
- table.insert(configs, (package:version():ge("7.77") and "--with-secure-transport" or "--with-darwinssl"))
- end
- for _, name in ipairs({"openssl", "mbedtls", "zlib", "brotli", "zstd", "libssh2", "libidn2", "libpsl", "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")
- if package:is_plat("macosx") then
- local cares = package:dep("c-ares")
- if cares and not cares:config("shared") then
- -- we need fix missing `-lresolv` when checking c-ares
- io.replace("./configure", "PKGCONFIG --libs-only-l libcares", "PKGCONFIG --libs-only-l --static libcares", {plain = true})
- end
+ local openssl = package:dep("openssl") or package:dep("openssl3")
+ if openssl and not openssl:is_system() then
+ table.insert(configs, "-DOPENSSL_ROOT_DIR=" .. openssl:installdir())
end
- import("package.tools.autoconf").install(package, configs)
+ import("package.tools.cmake").install(package, configs, {buildir = "build"})
end)
on_test(function (package)
diff --git a/repo/packages/o/openssl3/fetch.lua b/repo/packages/o/openssl3/fetch.lua
new file mode 100644
index 000000000..1c136713c
--- /dev/null
+++ b/repo/packages/o/openssl3/fetch.lua
@@ -0,0 +1,72 @@
+import("lib.detect.find_path")
+import("lib.detect.find_file")
+import("lib.detect.find_library")
+import("core.base.semver")
+
+-- http://www.slproweb.com/products/Win32OpenSSL.html
+function _find_package_on_windows(package, opt)
+ local bits = package:is_plat("x86") and "32" or "64"
+ local paths = {"$(reg HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL %(" .. bits .. "-bit%)_is1;Inno Setup: App Path)",
+ "$(env PROGRAMFILES)/OpenSSL",
+ "$(env PROGRAMFILES)/OpenSSL-Win" .. bits,
+ "C:/OpenSSL",
+ "C:/OpenSSL-Win" .. bits}
+
+ local result = {links = {}, linkdirs = {}}
+ local suffix = package:config("shared") and "" or "_static"
+ for _, name in ipairs({"libssl" .. suffix, "libcrypto" .. suffix, "libssl", "libcrypto"}) do
+ local linkinfo = find_library(name, paths, {suffixes = "lib"})
+ if linkinfo then
+ table.insert(result.links, linkinfo.link)
+ table.insert(result.linkdirs, linkinfo.linkdir)
+ end
+ end
+ if #result.links == 0 then
+ -- find light package
+ local arch = package:arch()
+ for _, name in ipairs({"libssl-3-" .. arch, "libcrypto-3-" .. arch}) do
+ local linkinfo = find_library(name, paths, {suffixes = "lib"})
+ if linkinfo then
+ table.insert(result.links, linkinfo.link)
+ table.insert(result.linkdirs, linkinfo.linkdir)
+ end
+ end
+ end
+ if #result.links ~= 2 then
+ return
+ end
+ if result.linkdirs then
+ result.linkdirs = table.unique(result.linkdirs)
+ end
+ local includedir = find_path(path.translate("openssl/ssl.h"), paths, {suffixes = "include"})
+ if includedir then
+ result.includedirs = result.includedirs or {}
+ table.insert(result.includedirs, includedir)
+ end
+ local openssl = find_file("openssl.exe", paths, {suffixes = "bin"})
+ if openssl then
+ result.bindirs = path.directory(openssl)
+ package:addenv("PATH", result.bindirs)
+ local version = try {function () return os.iorunv(openssl, {"version"}) end}
+ if version then
+ version = semver.match(version)
+ if version then
+ result.version = version:rawstr()
+ end
+ end
+ end
+ return result
+end
+
+function main(package, opt)
+ if opt.system and package.find_package then
+ local result
+ if package:is_plat("windows", "mingw", "msys") and is_host("windows") then
+ result = _find_package_on_windows(package, opt)
+ else
+ result = package:find_package("openssl", opt)
+ end
+ return result or false
+ end
+end
+
diff --git a/repo/packages/o/openssl3/patches/3.3.2/command-line-length.patch b/repo/packages/o/openssl3/patches/3.3.2/command-line-length.patch
new file mode 100644
index 000000000..c45c21302
--- /dev/null
+++ b/repo/packages/o/openssl3/patches/3.3.2/command-line-length.patch
@@ -0,0 +1,14 @@
+diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
+index 8ddb128..52b9ad6 100644
+--- a/Configurations/unix-Makefile.tmpl
++++ b/Configurations/unix-Makefile.tmpl
+@@ -1961,7 +1961,7 @@ EOF
+ my @objs = map { platform->obj($_) } @{$args{objs}};
+ my $deps = join(" \\\n" . ' ' x (length($lib) + 2),
+ fill_lines(' ', $COLUMNS - length($lib) - 2, @objs));
+- my $max_per_call = 500;
++ my $max_per_call = ($^O eq 'msys') ? 80 : 500;
+ my @objs_grouped;
+ push @objs_grouped, join(" ", splice @objs, 0, $max_per_call) while @objs;
+ my $fill_lib =
+ \ No newline at end of file
diff --git a/repo/packages/o/openssl3/xmake.lua b/repo/packages/o/openssl3/xmake.lua
new file mode 100644
index 000000000..165162493
--- /dev/null
+++ b/repo/packages/o/openssl3/xmake.lua
@@ -0,0 +1,267 @@
+package("openssl3")
+ set_homepage("https://www.openssl.org/")
+ set_description("A robust, commercial-grade, and full-featured toolkit for TLS and SSL.")
+ set_license("Apache-2.0")
+
+ add_urls("https://github.com/openssl/openssl/archive/refs/tags/openssl-$(version).zip")
+
+ add_versions("3.5.1", "9a1472b5e2a019f69da7527f381b873e3287348f3ad91783f83fff4e091ea4a8")
+ add_versions("3.4.2", "d313ac2ee07ad0d9c6e9203c56a485b3ecacac61c18fe450fe3c1d4db540ad71")
+ add_versions("3.3.4", "88c892a670df8924889f3bfd2f2dde822e1573a23dc4176556cb5170b40693ea")
+ add_versions("3.3.2", "4cda357946f9dd5541b565dba35348d614288e88aeb499045018970c789c9d61")
+ add_versions("3.3.1", "307284f39bfb7061229c57e263e707655aa80aa9950bf6def28ed63fec91a726")
+ add_versions("3.2.5", "08a3fe150bd69a83ac64e222bdccf0698c493a94e161e4d080c82d1f308dc4e1")
+ add_versions("3.1.8", "bbd5cbd8cc8ea852d31c001a9b767eadef0548b098e132b580a1f0c80d1778b7")
+ add_versions("3.0.17", "1129500758754ce4ff7eba7e46403dd56d5aa0a4e517a8fff7dac6fe120d0461")
+ add_versions("3.0.14", "9590b9ae18c4de183be74dfc9da5be1f1e8f85dd631a78bc74c0ebc3d7e27a93")
+ add_versions("3.0.7", "fcb37203c6bf7376cfd3aeb0be057937b7611e998b6c0d664abde928c8af3eb7")
+ add_versions("3.0.6", "9b45be41df0d6e9cf9e340a64525177662f22808ac69aee6bfb29c511284dae4")
+ add_versions("3.0.5", "4313c91fb0412e6a600493eb7c59bd555c4ff2ea7caa247a98c8456ad6f9fc74")
+ add_versions("3.0.4", "5b690a5c00e639f3817e2ee15c23c36874a1f91fa8c3a83bda3276d3d6345b76")
+ add_versions("3.0.3", "9bc56fd035f980cf74605264b04d84497df657c4f7ca68bfa77512e745f6c1a6")
+ add_versions("3.0.2", "ce3cbb41411731852e52bf96c06f097405c81ebf60ba81e0b9ca05d41dc92681")
+ add_versions("3.0.1", "53d8121af1c33c62a05a5370e9ba40fcc237717b79a7d99009b0c00c79bd7d78")
+ add_versions("3.0.0", "1bdb33f131af75330de94475563c62d6908ac1c18586f7f4aa209b96b0bfc2f9")
+
+ -- https://github.com/microsoft/vcpkg/blob/11faa3f168ec2a2f77510b92a42fb5c8a7e28bd8/ports/openssl/command-line-length.patch
+ add_patches("3.3.2", path.join(os.scriptdir(), "patches/3.3.2/command-line-length.patch"), "e969153046f22d6abbdedce19191361f20edf3814b3ee47fb79a306967e03d81")
+
+ on_fetch("fetch")
+
+ -- https://security.stackexchange.com/questions/173425/how-do-i-calculate-md2-hash-with-openssl
+ add_configs("md2", {description = "Enable MD2 on OpenSSl3 or not", default = false, type = "boolean"})
+ if is_plat("cross", "android", "iphoneos", "wasm") then
+ add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
+ end
+
+ -- @see https://github.com/xmake-io/xmake-repo/pull/7797#issuecomment-3153471643
+ if is_plat("windows") then
+ add_configs("jom", {description = "Try using jom to compile in parallel.", default = true, type = "boolean"})
+ end
+
+ on_load(function (package)
+ if not package:is_precompiled() then
+ if package:is_plat("windows") then
+ package:add("deps", "nasm")
+ -- the perl executable found in GitForWindows will fail to build OpenSSL
+ -- see https://github.com/openssl/openssl/blob/master/NOTES-PERL.md#perl-on-windows
+ package:add("deps", "strawberry-perl", {system = false})
+ if package:config("jom") then
+ -- check xmake tool jom
+ import("package.tools.jom", {try = true})
+ if jom then
+ package:add("deps", "jom", {private = true})
+ end
+ end
+ elseif package:is_plat("android", "wasm") and is_subhost("windows") and os.arch() == "x64" then
+ -- when building for android on windows, use msys2 perl instead of strawberry-perl to avoid configure issue
+ package:add("deps", "msys2", {configs = {msystem = "MINGW64", base_devel = true}, private = true})
+ end
+ end
+
+ -- @note we must use package:is_plat() instead of is_plat in description for supporting add_deps("openssl", {host = true}) in python
+ if package:is_plat("windows") then
+ package:add("links", "libssl", "libcrypto")
+ else
+ package:add("links", "ssl", "crypto")
+ end
+ if package:is_plat("windows", "mingw", "msys") then
+ package:add("syslinks", "ws2_32", "user32", "crypt32", "advapi32")
+ elseif package:is_plat("linux", "bsd", "cross") then
+ package:add("syslinks", "pthread", "dl")
+ end
+ if package:is_plat("linux", "mingw", "msys") and package:is_arch("x86_64") then
+ package:add("linkdirs", "lib64")
+ end
+ if package:is_plat("linux") then
+ package:add("extsources", "apt::libssl-dev")
+ end
+ end)
+
+ on_install("windows", function (package)
+ import("package.tools.jom", {try = true})
+ import("package.tools.nmake")
+ local configs = {"Configure", "no-tests"}
+ local target
+ if package:is_arch("x86", "i386") then
+ target = "VC-WIN32"
+ elseif package:is_arch("arm64") then
+ target = "VC-WIN64-ARM"
+ elseif package:is_arch("arm.*") then
+ target = "VC-WIN32-ARM"
+ else
+ target = "VC-WIN64A"
+ end
+ table.insert(configs, target)
+ table.insert(configs, package:config("shared") and "shared" or "no-shared")
+ table.insert(configs, "--prefix=" .. package:installdir())
+ table.insert(configs, "--openssldir=" .. package:installdir())
+
+ if package:config("md2") then
+ table.insert(configs, "enable-md2")
+ end
+
+ if package:config("jom") and jom then
+ table.insert(configs, "no-makedepend")
+ end
+
+ if package:is_debug() then
+ table.insert(configs, "/FS")
+ else
+ io.replace("Configurations/10-main.conf", "/debug", "", {plain = true})
+ io.replace("Configurations/10-main.conf", "/Zi", "", {plain = true})
+ io.replace("Configurations/50-masm.conf", "/Zi", "", {plain = true})
+ if package:version():gt("3.0.17") then
+ io.replace("Configurations/50-win-clang-cl.conf", "/Zi", "", {plain = true})
+ end
+ io.replace("util/copy.pl", "if (-d $dest)", "if (! -e $_) { next; }\n\tif (-d $dest)", {plain = true})
+ end
+
+ os.vrunv("perl", configs)
+
+ if package:config("jom") and jom then
+ jom.build(package)
+ jom.make(package, {"install_sw"})
+ else
+ nmake.build(package)
+ nmake.make(package, {"install_sw"})
+ end
+ end)
+
+ on_install("mingw", "msys", function (package)
+ local configs = {"Configure", "no-tests"}
+ table.insert(configs, package:is_arch("i386", "x86") and "mingw" or "mingw64")
+ table.insert(configs, package:config("shared") and "shared" or "no-shared")
+ local installdir = package:installdir()
+ -- Use MSYS2 paths instead of Windows paths
+ if is_subhost("msys") then
+ installdir = installdir:gsub("(%a):[/\\](.+)", "/%1/%2"):gsub("\\", "/")
+ end
+ table.insert(configs, "--prefix=" .. installdir)
+ table.insert(configs, "--openssldir=" .. installdir)
+
+ if package:config("md2") then
+ table.insert(configs, "enable-md2")
+ end
+
+ local buildenvs = import("package.tools.autoconf").buildenvs(package)
+ buildenvs.RC = package:build_getenv("mrc")
+ if is_subhost("msys") then
+ local rc = buildenvs.RC
+ if rc then
+ rc = rc:gsub("(%a):[/\\](.+)", "/%1/%2"):gsub("\\", "/")
+ buildenvs.RC = rc
+ end
+ end
+ -- fix 'cp: directory fuzz does not exist'
+ if package:config("shared") then
+ os.mkdir("fuzz")
+ end
+ os.vrunv("perl", configs, {envs = buildenvs})
+ import("package.tools.make").build(package)
+ import("package.tools.make").make(package, {"install_sw"})
+ if os.isdir(package:installdir("lib64")) and package:is_arch("x86_64") then
+ os.trycp(path.join(package:installdir("lib64"), "*"), package:installdir("lib"))
+ end
+ end)
+
+ on_install("linux", "macosx", "bsd", function (package)
+ -- https://wiki.openssl.org/index.php/Compilation_and_Installation#PREFIX_and_OPENSSLDIR
+ local buildenvs = import("package.tools.autoconf").buildenvs(package)
+ local configs = {"--openssldir=" .. package:installdir(),
+ "--prefix=" .. package:installdir()}
+ table.insert(configs, package:config("shared") and "shared" or "no-shared")
+ if package:debug() then
+ table.insert(configs, "--debug")
+ end
+
+ if package:config("md2") then
+ table.insert(configs, "enable-md2")
+ end
+
+ os.vrunv("./config", configs, {envs = buildenvs})
+ local makeconfigs = {CFLAGS = buildenvs.CFLAGS, ASFLAGS = buildenvs.ASFLAGS}
+ import("package.tools.make").build(package, makeconfigs)
+ import("package.tools.make").make(package, {"install_sw"})
+ if package:config("shared") then
+ os.tryrm(path.join(package:installdir("lib"), "*.a"), path.join(package:installdir("lib64"), "*.a"))
+ end
+ if package:is_plat("linux") and os.isdir(package:installdir("lib64")) and package:is_arch("x86_64") then
+ os.trycp(path.join(package:installdir("lib64"), "*"), package:installdir("lib"))
+ end
+ end)
+
+ on_install("cross", "android", "iphoneos", "wasm", function (package)
+ local target_arch = "generic32"
+ if package:is_arch("x86_64") then
+ target_arch = "x86_64"
+ elseif package:is_arch("i386", "x86") then
+ target_arch = "x86"
+ elseif package:is_arch("arm64", "arm64-v8a") then
+ target_arch = "aarch64"
+ elseif package:is_arch("arm.*") then
+ target_arch = "armv4"
+ elseif package:is_arch(".*64") then
+ target_arch = "generic64"
+ end
+
+ local target_plat = "linux"
+ if package:is_plat("macosx") then
+ target_plat = "darwin64"
+ target_arch = "x86_64-cc"
+ elseif package:is_plat("iphoneos") then
+ local xcode = package:toolchain("xcode")
+ local simulator = xcode and xcode:config("appledev") == "simulator"
+ if simulator then
+ target_plat = "iossimulator"
+ target_arch = "xcrun"
+ else
+ if package:is_arch("arm64", "x86_64") then
+ target_plat = "ios64"
+ else
+ target_plat = "ios"
+ end
+ target_arch = "cross"
+ end
+ end
+
+ local target = target_plat .. "-" .. target_arch
+ local configs = {target,
+ "-DOPENSSL_NO_HEARTBEATS",
+ "no-shared",
+ "no-threads",
+ "--openssldir=" .. package:installdir():gsub("\\", "/"),
+ "--prefix=" .. package:installdir():gsub("\\", "/")}
+
+ if package:config("md2") then
+ table.insert(configs, "enable-md2")
+ end
+ if package:is_plat("wasm") then
+ -- @see https://github.com/openssl/openssl/issues/12174
+ table.insert(configs, "no-afalgeng")
+ end
+
+ local buildenvs = import("package.tools.autoconf").buildenvs(package)
+ if (package:is_cross() and package:is_plat("android") and is_subhost("windows")) or
+ package:is_plat("wasm") then
+
+ buildenvs.CFLAGS = buildenvs.CFLAGS:gsub("\\", "/")
+ buildenvs.CXXFLAGS = buildenvs.CXXFLAGS:gsub("\\", "/")
+ buildenvs.CPPFLAGS = buildenvs.CPPFLAGS:gsub("\\", "/")
+ buildenvs.ASFLAGS = buildenvs.ASFLAGS:gsub("\\", "/")
+ os.vrunv("perl", table.join("./Configure", configs), {envs = buildenvs})
+ else
+ os.vrunv("./Configure", configs, {envs = buildenvs})
+ end
+
+ if is_host("windows") and package:is_plat("wasm") then
+ io.replace("Makefile", "bat.exe", "bat", {plain = true})
+ end
+ local makeconfigs = {CFLAGS = buildenvs.CFLAGS, ASFLAGS = buildenvs.ASFLAGS}
+ import("package.tools.make").build(package, makeconfigs)
+ import("package.tools.make").make(package, {"install_sw"})
+ end)
+
+ on_test(function (package)
+ assert(package:has_cfuncs("SSL_new", {includes = "openssl/ssl.h"}))
+ end)
diff --git a/repo/packages/s/sentry-native/patches/0.4.4/zlib_fix.patch b/repo/packages/s/sentry-native/patches/0.4.4/zlib_fix.patch
new file mode 100644
index 000000000..854ce88b5
--- /dev/null
+++ b/repo/packages/s/sentry-native/patches/0.4.4/zlib_fix.patch
@@ -0,0 +1,12 @@
+diff --git a/external/crashpad/third_party/zlib/CMakeLists.txt b/external/crashpad/third_party/zlib/CMakeLists.txt
+index 7ed2f58..4514331 100644
+--- a/external/crashpad/third_party/zlib/CMakeLists.txt
++++ b/external/crashpad/third_party/zlib/CMakeLists.txt
+@@ -73,6 +73,7 @@ else()
+ "/wd4267" # conversion from 'size_t' to 't', possible loss of data
+ "/wd4324" # structure was padded due to alignment specifier
+ "/wd4702" # unreachable code
++ "/wd5105" # see https://github.com/getsentry/sentry-native/issues/415
+ )
+ endif()
+ endif()
diff --git a/repo/packages/s/sentry-native/xmake.lua b/repo/packages/s/sentry-native/xmake.lua
new file mode 100644
index 000000000..950261092
--- /dev/null
+++ b/repo/packages/s/sentry-native/xmake.lua
@@ -0,0 +1,114 @@
+package("sentry-native")
+ set_homepage("https://sentry.io")
+ set_description("Sentry SDK for C, C++ and native applications.")
+
+ set_urls("https://github.com/getsentry/sentry-native/releases/download/$(version)/sentry-native.zip",
+ "https://github.com/getsentry/sentry-native.git")
+
+ add_versions("0.7.15", "9880614984c75fc6ed1967b7aa29aebbea2f0c88f2d7c707b18391b5632091c0")
+ add_versions("0.7.12", "03c99ef84992fddd37f79c63ae78a69ec49b1b1d7598c7a7c5d8e6742b97ea0a")
+ add_versions("0.7.11", "7fb41a8e5270168958d867504f503beb014035f382edaa07132be65348df27e0")
+ add_versions("0.7.10", "b7f7b5002cf7a4c614736ac294351da499db4f7fe155a452d527e69badc672bc")
+ add_versions("0.7.9", "d01f66125e1fb80c02668d2ea6b908987323d3f477d69332ef21506a62606d40")
+ add_versions("0.7.6", "42180ad933a3a2bd86a1649ed0f1a41df20e783ce17c5cb1f86775f7caf06bc1")
+ add_versions("0.7.5", "d9f1b44753fae3e9462aa1e6fd3021cb0ff2f51c1a1fa02b34510e3bc311f429")
+ add_versions("0.7.2", "afb44d5cc4e0ec5f2e8068132c68256959188f6bf015e1837e7cc687014b9c70")
+ add_versions("0.7.1", "c450a064b0dbb1883a355455db2b6469abef59c04686a53719384bbc7ff507d3")
+ add_versions("0.7.0", "4dfccc879a81771b9da1c335947ffc9e5987ca3d16b3035efa2c66a06f727543")
+ add_versions("0.6.7", "37d7880f837c85d0b19cac106b631c7b4524ff13f11cd31e8337da10842ea779")
+ add_versions("0.6.6", "7a98467c0b2571380a3afc5e681cb13aa406a709529be12d74610b0015ccde0c")
+ add_versions("0.6.5", "5f74a5c5c3abc6e1e7825d3306be9e3b3fd4e0f586f3cf7e86607d6f56a71995")
+ add_versions("0.6.4", "e00278bf9a4821bb4008985a5a552a84aba6ebb06d3f9e828082fcbf06b04a38")
+ add_versions("0.6.3", "6b515c17a9b860ea47c6a5fd7abdfdc89b4b8cbc654c23a8bb42a39bfcb87ad9")
+ add_versions("0.5.4", "890604a8d805364b747381ee4370dcab2b8d8594169452e9d303f57da178fb57")
+ add_versions("0.5.0", "87e67ad783a7ec4476b0eb4742bd40fe5a1e2435")
+ add_versions("0.4.15", "ae3ac4efa76d431d8734d7b0b1bf9bbedaf2cbdb18dfc5c95e2411a67808cf29")
+ add_versions("0.4.4", "fe6c711d42861e66e53bfd7ee0b2b226027c64446857f0d1bbb239ca824a3d8d")
+ add_patches("0.4.4", path.join(os.scriptdir(), "patches", "0.4.4", "zlib_fix.patch"), "1a6ac711b7824112a9062ec1716a316facce5055498d1f87090d2cad031b865b")
+
+ add_deps("cmake")
+
+ add_configs("backend", {description = "Set the backend of sentry to use", type = "string"})
+
+ if is_plat("windows") then
+ add_syslinks("dbghelp", "winhttp", "shlwapi", "advapi32", "version")
+ elseif is_plat("linux") then
+ add_deps("libcurl")
+ add_syslinks("dl", "pthread", "rt")
+ elseif is_plat("android") then
+ add_syslinks("dl", "log")
+ elseif is_plat("macosx") then
+ add_deps("libcurl")
+ add_frameworks("CoreText", "CoreGraphics", "SystemConfiguration", "CoreFoundation", "Foundation")
+ add_syslinks("bsm")
+ end
+
+ --[==[
+ on_check(function (package)
+ assert(package:check_cxxsnippets({test = [[
+ #include <ranges>
+ template<typename T>
+ concept CR = std::ranges::contiguous_range<T>;
+ void test() {}
+ ]]}, {configs = {languages = "c++20"}}), "package(sentry-native) Require at least C++20.")
+ end)
+ --]==]
+
+ on_load("windows", "linux", "macosx", function (package)
+ if not package:config("shared") then
+ package:add("defines", "SENTRY_BUILD_STATIC")
+ end
+
+ local backend
+ if package:is_plat("linux") then -- linux defaults to breakpad before 0.7 and then defaults to crashpad
+ backend = package:version() and package:version():ge("0.7") and "crashpad" or "breakpad"
+ end
+ if package:config("backend") == "crashpad" then
+ backend = "crashpad"
+ elseif package:config("backend") == "breakpad" then
+ backend = "breakpad"
+ end
+
+ if backend == "crashpad" then
+ package:add("links", "sentry", "crashpad_client", "crashpad_util", "crashpad_minidump", "crashpad_handler_lib", "mini_chromium", "crashpad_tools", "crashpad_compat", "crashpad_snapshot")
+ package:add("deps", "zlib")
+ elseif backend == "breadpad" then
+ package:add("links", "sentry", "breakpad_client")
+ end
+ end)
+
+ on_install("windows|x86", "windows|x64", "linux", "macosx", function (package) -- TODO: to enable android you will need to figure out the order of libs
+ local opt = {}
+ local configs = {}
+ table.insert(configs, "-DSENTRY_BUILD_EXAMPLES=OFF")
+ table.insert(configs, "-DSENTRY_BUILD_TESTS=OFF")
+ table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+ if package:config("shared") then
+ table.insert(configs, "-DBUILD_SHARED_LIBS=ON")
+ table.insert(configs, "-DSENTRY_BUILD_SHARED_LIBS=ON")
+ else
+ table.insert(configs, "-DBUILD_SHARED_LIBS=OFF")
+ table.insert(configs, "-DSENTRY_BUILD_SHARED_LIBS=OFF")
+ end
+ if package:config("backend") then
+ table.insert(configs, "-DSENTRY_BACKEND=" .. package:config("backend"))
+ end
+ if package:is_plat("windows") then
+ opt.cxflags = { "/experimental:preprocessor-" } -- fixes <Windows SDK>\um\oaidl.h(487): error C2059: syntax error: '/'
+ local vs_runtime = package:config("vs_runtime")
+ table.insert(configs, "-DSENTRY_BUILD_RUNTIMESTATIC=" .. ((vs_runtime == "MT" or vs_runtime == "MTd") and "ON" or "OFF"))
+ elseif package:is_plat("macosx") then
+ opt.shflags = {"-framework", "SystemConfiguration"}
+ end
+ import("package.tools.cmake").install(package, configs, opt)
+ end)
+
+ on_test(function (package)
+ assert(package:check_cxxsnippets({test = [[
+ void test(int args, char** argv) {
+ sentry_options_t* options = sentry_options_new();
+ sentry_init(options);
+ sentry_shutdown();
+ }
+ ]]}, {includes = {"sentry.h"}}))
+ end)
diff --git a/src/zencore/crypto.cpp b/src/zencore/crypto.cpp
index 78bea0c17..baf8a3a35 100644
--- a/src/zencore/crypto.cpp
+++ b/src/zencore/crypto.cpp
@@ -12,8 +12,10 @@
#ifndef ZEN_USE_OPENSSL
# if ZEN_PLATFORM_WINDOWS
# define ZEN_USE_OPENSSL 0
+# define ZEN_USE_MBEDTLS 0
# else
-# define ZEN_USE_OPENSSL 1
+# define ZEN_USE_OPENSSL 0
+# define ZEN_USE_MBEDTLS 1
# endif
#endif
@@ -24,6 +26,8 @@ ZEN_THIRD_PARTY_INCLUDES_START
# include <openssl/conf.h>
# include <openssl/err.h>
# include <openssl/evp.h>
+#elif ZEN_USE_MBEDTLS
+ #include <mbedtls/cipher.h>
#else
# include <zencore/windows.h>
# include <bcrypt.h>
@@ -43,8 +47,108 @@ namespace crypto {
Encrypt
};
-#if ZEN_USE_OPENSSL
+#if ZEN_USE_MBEDTLS
+
+ class MbedCipherCtx
+ {
+ public:
+ MbedCipherCtx() { mbedtls_cipher_init(&m_Ctx); }
+ ~MbedCipherCtx() { mbedtls_cipher_free(&m_Ctx); }
+
+ mbedtls_cipher_context_t* operator&() { return &m_Ctx; }
+ mbedtls_cipher_context_t* get() { return &m_Ctx; }
+
+ private:
+ mbedtls_cipher_context_t m_Ctx;
+ };
+
+ MemoryView Transform(TransformMode Mode,
+ MemoryView Key,
+ MemoryView IV,
+ MemoryView In,
+ MutableMemoryView Out,
+ std::optional<std::string>& Reason)
+ {
+ const mbedtls_cipher_info_t* CipherInfo = mbedtls_cipher_info_from_type(MBEDTLS_CIPHER_AES_256_CBC);
+ if (CipherInfo == nullptr)
+ {
+ Reason = "failed to get mbedTLS cipher info"sv;
+ return MemoryView();
+ }
+
+ MbedCipherCtx Ctx;
+ int ret = mbedtls_cipher_setup(Ctx.get(), CipherInfo);
+ if (ret != 0)
+ {
+ Reason = fmt::format("mbedTLS cipher setup failed, ret={}", ret);
+ return MemoryView();
+ }
+
+ // key length in bits
+ ret = mbedtls_cipher_setkey(Ctx.get(),
+ reinterpret_cast<const unsigned char*>(Key.GetData()),
+ static_cast<int>(Key.GetSize() * 8),
+ (Mode == TransformMode::Encrypt) ? MBEDTLS_ENCRYPT : MBEDTLS_DECRYPT);
+ if (ret != 0)
+ {
+ Reason = fmt::format("mbedTLS setkey failed, ret={}", ret);
+ return MemoryView();
+ }
+
+ ret = mbedtls_cipher_set_iv(Ctx.get(),
+ reinterpret_cast<const unsigned char*>(IV.GetData()),
+ static_cast<size_t>(IV.GetSize()));
+ if (ret != 0)
+ {
+ Reason = fmt::format("mbedTLS set_iv failed, ret={}", ret);
+ return MemoryView();
+ }
+ ret = mbedtls_cipher_reset(Ctx.get());
+ if (ret != 0)
+ {
+ Reason = fmt::format("mbedTLS reset failed, ret={}", ret);
+ return MemoryView();
+ }
+
+ // Ensure output buffer is large enough: worst case = input + block size
+ const size_t BlockSize = 16;
+ if (Out.GetSize() < In.GetSize() + BlockSize)
+ {
+ Reason = "invalid output buffer size"sv;
+ return MemoryView();
+ }
+
+ size_t olen = 0;
+ size_t total = 0;
+
+ ret = mbedtls_cipher_update(Ctx.get(),
+ reinterpret_cast<const unsigned char*>(In.GetData()),
+ static_cast<size_t>(In.GetSize()),
+ reinterpret_cast<unsigned char*>(Out.GetData()),
+ &olen);
+ if (ret != 0)
+ {
+ Reason = fmt::format("mbedTLS update failed, ret={}", ret);
+ return MemoryView();
+ }
+
+ total = olen;
+
+ ret = mbedtls_cipher_finish(Ctx.get(),
+ reinterpret_cast<unsigned char*>(Out.GetData()) + total,
+ &olen);
+ if (ret != 0)
+ {
+ Reason = fmt::format("mbedTLS finish failed, ret={}", ret);
+ return MemoryView();
+ }
+
+ total += olen;
+
+ return Out.Left(static_cast<size_t>(total));
+ }
+#elif ZEN_USE_OPENSSL
class EvpContext
{
public:
diff --git a/src/zencore/xmake.lua b/src/zencore/xmake.lua
index 84f749352..26a6f0bdf 100644
--- a/src/zencore/xmake.lua
+++ b/src/zencore/xmake.lua
@@ -37,9 +37,7 @@ target('zencore')
add_deps("ryml")
add_deps("gsl-lite")
- add_packages(
- "vcpkg::openssl" -- required for crypto
- )
+ add_packages("mbedtls") -- required for crypto
add_packages(
"eastl",
@@ -49,7 +47,7 @@ target('zencore')
)
if has_config("zensentry") then
- add_packages("vcpkg::sentry-native")
+ add_packages("sentry-native")
if is_os("windows") then
add_cxxflags("/wd4996")
diff --git a/src/zenhttp/xmake.lua b/src/zenhttp/xmake.lua
index 0f757921c..434330501 100644
--- a/src/zenhttp/xmake.lua
+++ b/src/zenhttp/xmake.lua
@@ -10,9 +10,7 @@ target('zenhttp')
add_deps("zencore", "zentelemetry", "transport-sdk", "asio", "cpr")
add_deps("gsl-lite")
add_packages(
- "vcpkg::curl", -- required by cpr
- "vcpkg::openssl", -- required by curl
- "zlib", -- required by curl
+ "curl", -- required by cpr
"http_parser"
)
add_options("httpsys")
diff --git a/thirdparty/xmake.lua b/thirdparty/xmake.lua
index 131f207be..d7df0f623 100644
--- a/thirdparty/xmake.lua
+++ b/thirdparty/xmake.lua
@@ -68,10 +68,7 @@ target('cpr')
else
add_cxxflags("-Wno-undef")
end
- add_packages("vcpkg::curl",
- "vcpkg::openssl", -- required by curl
- "zlib" -- required by curl
- )
+ add_packages("curl")
target('asio')
set_kind('headeronly')
diff --git a/xmake.lua b/xmake.lua
index 4b2c7b0d5..709e9a3c3 100644
--- a/xmake.lua
+++ b/xmake.lua
@@ -11,7 +11,7 @@ add_requires("http_parser", {system = false})
add_requires("mimalloc", {system = false})
add_requires("eastl", {system = false})
add_requires("zlib", {system = false})
-add_requires("vcpkg::curl")
+add_requires("libcurl", {alias="curl", system = false, configs = {mbedtls = true}})
add_defines("EASTL_STD_ITERATOR_CATEGORY_ENABLED", "EASTL_DEPRECATIONS_FOR_2024_APRIL=EA_DISABLED")
@@ -20,7 +20,8 @@ set_policy("build.ccache", false)
if is_plat("windows") then
add_defines("ZEN_USE_OPENSSL=0")
else
- add_requires("vcpkg::openssl")
+ add_requires("mbedtls", {system = false})
+ add_defines("ZEN_USE_MBEDTLS=1")
end
if is_plat("windows") then
@@ -40,9 +41,9 @@ end
if has_config("zensentry") then
if is_plat("linux") then
- add_requires("vcpkg::sentry-native 0.5.4")
+ add_requires("sentry-native 0.5.4")
else
- add_requires("vcpkg::sentry-native")
+ add_requires("sentry-native 0.7.6") -- matches vcpkg version (2024-06-15)
end
end