From a2e9a0735cb4d214bd61bd9cfa135dbdb7d76965 Mon Sep 17 00:00:00 2001 From: Altina Orion <139891033+Altina-oz@users.noreply.github.com> Date: Tue, 17 Dec 2024 13:40:35 +0800 Subject: [PATCH 01/24] Create fix-NAN-on-Win11.patch --- .../grpc/patches/1.68.2/fix-NAN-on-Win11.patch | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 packages/g/grpc/patches/1.68.2/fix-NAN-on-Win11.patch diff --git a/packages/g/grpc/patches/1.68.2/fix-NAN-on-Win11.patch b/packages/g/grpc/patches/1.68.2/fix-NAN-on-Win11.patch new file mode 100644 index 00000000000..7f91c23f9e1 --- /dev/null +++ b/packages/g/grpc/patches/1.68.2/fix-NAN-on-Win11.patch @@ -0,0 +1,17 @@ +diff --git a/upb/message/message.c b/upb/message/message.c +index 265d30d..afc6e51 100644 +--- a/upb/message/message.c ++++ b/upb/message/message.c +@@ -15,9 +15,9 @@ + // Must be last. + #include "upb/port/def.inc" + +-const float kUpb_FltInfinity = INFINITY; +-const double kUpb_Infinity = INFINITY; +-const double kUpb_NaN = NAN; ++const float kUpb_FltInfinity = (float)(1.0 / 0.0); ++const double kUpb_Infinity = 1.0 / 0.0; ++const double kUpb_NaN = 0.0 / 0.0; + + static const size_t overhead = sizeof(upb_Message_InternalData); + From d1ce9657fddb85b736ea7d6d2162d834249ecae2 Mon Sep 17 00:00:00 2001 From: Altina Orion <139891033+Altina-oz@users.noreply.github.com> Date: Tue, 17 Dec 2024 13:45:57 +0800 Subject: [PATCH 02/24] Update xmake.lua --- packages/g/grpc/xmake.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/g/grpc/xmake.lua b/packages/g/grpc/xmake.lua index c05a1b1455f..7c8963f135a 100644 --- a/packages/g/grpc/xmake.lua +++ b/packages/g/grpc/xmake.lua @@ -7,10 +7,11 @@ package("grpc") "https://github.com/grpc/grpc.git") add_versions("v1.51.3", "17720fd0a690e904a468b4b3dae6fa5ec40b0d1f4d418e2ca092e2f92f06fce0") add_versions("v1.62.1", "f672a3a3b370f2853869745110dabfb6c13af93e17ffad4676a0b95b5ec204af") + add_versions("v1.68.2", "2a17adb0d23768413ca85990dbf800a600863d272fcc37a9f67f3b5e34ae9174") add_patches("1.51.3", path.join(os.scriptdir(), "patches", "1.51.3", "disable-download-archive.patch"), "90fdd6e4a51cbc9756d1fcdd0f65e665d4b78cfd91fdbeb0228cc4e9c4ba1b73") add_patches("1.51.3", path.join(os.scriptdir(), "patches", "1.51.3", "static-linking-in-linux.patch"), "176474919883f93be0c5056098eccad408038663c6c7361f2e049cdf7247a19c") - + add_patches("1.51.3", path.join(os.scriptdir(), "patches", "1.68.2", "fix-NAN-on-Win11.patch"), "3b5c90855adbee29cda36a1d140167a20c96e81c9b39692bb7c77b32da73fb71") add_deps("cmake") if is_plat("linux") then add_deps("autoconf", "libtool", "pkg-config") From 5ea9553ce9fbcdc4ad8f10c5de760e9eb17ec9a0 Mon Sep 17 00:00:00 2001 From: Altina Orion <139891033+Altina-oz@users.noreply.github.com> Date: Tue, 17 Dec 2024 13:47:57 +0800 Subject: [PATCH 03/24] Update xmake.lua --- packages/g/grpc/xmake.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/g/grpc/xmake.lua b/packages/g/grpc/xmake.lua index 7c8963f135a..9d3ee3be4aa 100644 --- a/packages/g/grpc/xmake.lua +++ b/packages/g/grpc/xmake.lua @@ -11,7 +11,7 @@ package("grpc") add_patches("1.51.3", path.join(os.scriptdir(), "patches", "1.51.3", "disable-download-archive.patch"), "90fdd6e4a51cbc9756d1fcdd0f65e665d4b78cfd91fdbeb0228cc4e9c4ba1b73") add_patches("1.51.3", path.join(os.scriptdir(), "patches", "1.51.3", "static-linking-in-linux.patch"), "176474919883f93be0c5056098eccad408038663c6c7361f2e049cdf7247a19c") - add_patches("1.51.3", path.join(os.scriptdir(), "patches", "1.68.2", "fix-NAN-on-Win11.patch"), "3b5c90855adbee29cda36a1d140167a20c96e81c9b39692bb7c77b32da73fb71") + add_patches("1.68.2", path.join(os.scriptdir(), "patches", "1.68.2", "fix-NAN-on-Win11.patch"), "3b5c90855adbee29cda36a1d140167a20c96e81c9b39692bb7c77b32da73fb71") add_deps("cmake") if is_plat("linux") then add_deps("autoconf", "libtool", "pkg-config") From 0f795e0501275755953447c4abe64207d32cd874 Mon Sep 17 00:00:00 2001 From: Altina Orion <139891033+Altina-oz@users.noreply.github.com> Date: Tue, 17 Dec 2024 13:49:56 +0800 Subject: [PATCH 04/24] Rename fix-NAN-on-Win11.patch to fix-nan-on-win11.patch --- .../1.68.2/{fix-NAN-on-Win11.patch => fix-nan-on-win11.patch} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename packages/g/grpc/patches/1.68.2/{fix-NAN-on-Win11.patch => fix-nan-on-win11.patch} (100%) diff --git a/packages/g/grpc/patches/1.68.2/fix-NAN-on-Win11.patch b/packages/g/grpc/patches/1.68.2/fix-nan-on-win11.patch similarity index 100% rename from packages/g/grpc/patches/1.68.2/fix-NAN-on-Win11.patch rename to packages/g/grpc/patches/1.68.2/fix-nan-on-win11.patch From c12c1974bdbbe93c4222b26e90c0d45f4e9cbe7d Mon Sep 17 00:00:00 2001 From: Altina Orion <139891033+Altina-oz@users.noreply.github.com> Date: Tue, 17 Dec 2024 13:50:13 +0800 Subject: [PATCH 05/24] Update xmake.lua --- packages/g/grpc/xmake.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/g/grpc/xmake.lua b/packages/g/grpc/xmake.lua index 9d3ee3be4aa..cab982a7b7e 100644 --- a/packages/g/grpc/xmake.lua +++ b/packages/g/grpc/xmake.lua @@ -11,7 +11,7 @@ package("grpc") add_patches("1.51.3", path.join(os.scriptdir(), "patches", "1.51.3", "disable-download-archive.patch"), "90fdd6e4a51cbc9756d1fcdd0f65e665d4b78cfd91fdbeb0228cc4e9c4ba1b73") add_patches("1.51.3", path.join(os.scriptdir(), "patches", "1.51.3", "static-linking-in-linux.patch"), "176474919883f93be0c5056098eccad408038663c6c7361f2e049cdf7247a19c") - add_patches("1.68.2", path.join(os.scriptdir(), "patches", "1.68.2", "fix-NAN-on-Win11.patch"), "3b5c90855adbee29cda36a1d140167a20c96e81c9b39692bb7c77b32da73fb71") + add_patches("1.68.2", path.join(os.scriptdir(), "patches", "1.68.2", "fix-nan-on-win11.patch"), "3b5c90855adbee29cda36a1d140167a20c96e81c9b39692bb7c77b32da73fb71") add_deps("cmake") if is_plat("linux") then add_deps("autoconf", "libtool", "pkg-config") From ebd4653e0821b327032d5c618a84b0d7650e9cff Mon Sep 17 00:00:00 2001 From: Altina Orion <139891033+Altina-oz@users.noreply.github.com> Date: Tue, 17 Dec 2024 14:07:56 +0800 Subject: [PATCH 06/24] Update fix-nan-on-win11.patch --- packages/g/grpc/patches/1.68.2/fix-nan-on-win11.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/g/grpc/patches/1.68.2/fix-nan-on-win11.patch b/packages/g/grpc/patches/1.68.2/fix-nan-on-win11.patch index 7f91c23f9e1..9e8ce4d9e3d 100644 --- a/packages/g/grpc/patches/1.68.2/fix-nan-on-win11.patch +++ b/packages/g/grpc/patches/1.68.2/fix-nan-on-win11.patch @@ -1,7 +1,7 @@ -diff --git a/upb/message/message.c b/upb/message/message.c +diff --git a/third_party/upb/message/internal/message.c b/third_party/upb/message/internal/message.c index 265d30d..afc6e51 100644 ---- a/upb/message/message.c -+++ b/upb/message/message.c +--- a/third_party/upb/message/internal/message.c ++++ b/third_party/upb/message/internal/message.c @@ -15,9 +15,9 @@ // Must be last. #include "upb/port/def.inc" From 812893dcbd002540b08f9fd878c65195be103103 Mon Sep 17 00:00:00 2001 From: Altina Orion <139891033+Altina-oz@users.noreply.github.com> Date: Tue, 17 Dec 2024 14:09:22 +0800 Subject: [PATCH 07/24] Update xmake.lua --- packages/g/grpc/xmake.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/g/grpc/xmake.lua b/packages/g/grpc/xmake.lua index cab982a7b7e..86aadbc9f64 100644 --- a/packages/g/grpc/xmake.lua +++ b/packages/g/grpc/xmake.lua @@ -11,7 +11,7 @@ package("grpc") add_patches("1.51.3", path.join(os.scriptdir(), "patches", "1.51.3", "disable-download-archive.patch"), "90fdd6e4a51cbc9756d1fcdd0f65e665d4b78cfd91fdbeb0228cc4e9c4ba1b73") add_patches("1.51.3", path.join(os.scriptdir(), "patches", "1.51.3", "static-linking-in-linux.patch"), "176474919883f93be0c5056098eccad408038663c6c7361f2e049cdf7247a19c") - add_patches("1.68.2", path.join(os.scriptdir(), "patches", "1.68.2", "fix-nan-on-win11.patch"), "3b5c90855adbee29cda36a1d140167a20c96e81c9b39692bb7c77b32da73fb71") + add_patches("1.68.2", path.join(os.scriptdir(), "patches", "1.68.2", "fix-nan-on-win11.patch"), "2795e5401f1a51b3dc40a2285f5b308e20e4de0a8ef6ca39a5bc7b55af153433") add_deps("cmake") if is_plat("linux") then add_deps("autoconf", "libtool", "pkg-config") From 0a87e0800b61f793ee533a9981c7ba69248e9386 Mon Sep 17 00:00:00 2001 From: Altina Orion <139891033+Altina-oz@users.noreply.github.com> Date: Tue, 17 Dec 2024 14:50:45 +0800 Subject: [PATCH 08/24] fix sha --- packages/g/grpc/xmake.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/g/grpc/xmake.lua b/packages/g/grpc/xmake.lua index 86aadbc9f64..0ddecd77bb4 100644 --- a/packages/g/grpc/xmake.lua +++ b/packages/g/grpc/xmake.lua @@ -11,7 +11,7 @@ package("grpc") add_patches("1.51.3", path.join(os.scriptdir(), "patches", "1.51.3", "disable-download-archive.patch"), "90fdd6e4a51cbc9756d1fcdd0f65e665d4b78cfd91fdbeb0228cc4e9c4ba1b73") add_patches("1.51.3", path.join(os.scriptdir(), "patches", "1.51.3", "static-linking-in-linux.patch"), "176474919883f93be0c5056098eccad408038663c6c7361f2e049cdf7247a19c") - add_patches("1.68.2", path.join(os.scriptdir(), "patches", "1.68.2", "fix-nan-on-win11.patch"), "2795e5401f1a51b3dc40a2285f5b308e20e4de0a8ef6ca39a5bc7b55af153433") + add_patches("1.68.2", path.join(os.scriptdir(), "patches", "1.68.2", "fix-nan-on-win11.patch"), "6757419886d10ad47aaaa825a109cf9cba57c306c9ec17f71cf0d33aabb67e6a") add_deps("cmake") if is_plat("linux") then add_deps("autoconf", "libtool", "pkg-config") From 886d638cecd6cc410ea89921c5f1676895f0555c Mon Sep 17 00:00:00 2001 From: Altina Orion <139891033+Altina-oz@users.noreply.github.com> Date: Tue, 17 Dec 2024 15:02:27 +0800 Subject: [PATCH 09/24] Update fix-nan-on-win11.patch --- packages/g/grpc/patches/1.68.2/fix-nan-on-win11.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/g/grpc/patches/1.68.2/fix-nan-on-win11.patch b/packages/g/grpc/patches/1.68.2/fix-nan-on-win11.patch index 9e8ce4d9e3d..166c5d71a5f 100644 --- a/packages/g/grpc/patches/1.68.2/fix-nan-on-win11.patch +++ b/packages/g/grpc/patches/1.68.2/fix-nan-on-win11.patch @@ -1,7 +1,7 @@ -diff --git a/third_party/upb/message/internal/message.c b/third_party/upb/message/internal/message.c +diff --git a/third_party/upb/upb/message/internal/message.c b/third_party/upb/upb/message/internal/message.c index 265d30d..afc6e51 100644 ---- a/third_party/upb/message/internal/message.c -+++ b/third_party/upb/message/internal/message.c +--- a/third_party/upb/upb/message/internal/message.c ++++ b/third_party/upb/upb/message/internal/message.c @@ -15,9 +15,9 @@ // Must be last. #include "upb/port/def.inc" From 1fceb40941a96c94024d7a56dfb6c0db4c7703cd Mon Sep 17 00:00:00 2001 From: Altina Orion <139891033+Altina-oz@users.noreply.github.com> Date: Tue, 17 Dec 2024 15:03:46 +0800 Subject: [PATCH 10/24] Update xmake.lua --- packages/g/grpc/xmake.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/g/grpc/xmake.lua b/packages/g/grpc/xmake.lua index 0ddecd77bb4..17f8664fa08 100644 --- a/packages/g/grpc/xmake.lua +++ b/packages/g/grpc/xmake.lua @@ -11,7 +11,7 @@ package("grpc") add_patches("1.51.3", path.join(os.scriptdir(), "patches", "1.51.3", "disable-download-archive.patch"), "90fdd6e4a51cbc9756d1fcdd0f65e665d4b78cfd91fdbeb0228cc4e9c4ba1b73") add_patches("1.51.3", path.join(os.scriptdir(), "patches", "1.51.3", "static-linking-in-linux.patch"), "176474919883f93be0c5056098eccad408038663c6c7361f2e049cdf7247a19c") - add_patches("1.68.2", path.join(os.scriptdir(), "patches", "1.68.2", "fix-nan-on-win11.patch"), "6757419886d10ad47aaaa825a109cf9cba57c306c9ec17f71cf0d33aabb67e6a") + add_patches("1.68.2", path.join(os.scriptdir(), "patches", "1.68.2", "fix-nan-on-win11.patch"), "3b31939101c87fd04a08e4d055fa0bd3f1f7356d7ad18b02cc92aba911e2d7d9") add_deps("cmake") if is_plat("linux") then add_deps("autoconf", "libtool", "pkg-config") From 2812995e2f5eae88619dbbe9f247f53ca6e7e6cd Mon Sep 17 00:00:00 2001 From: Altina Orion <139891033+Altina-oz@users.noreply.github.com> Date: Tue, 17 Dec 2024 15:23:42 +0800 Subject: [PATCH 11/24] Update fix-nan-on-win11.patch --- packages/g/grpc/patches/1.68.2/fix-nan-on-win11.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/g/grpc/patches/1.68.2/fix-nan-on-win11.patch b/packages/g/grpc/patches/1.68.2/fix-nan-on-win11.patch index 166c5d71a5f..a639d9a3c6e 100644 --- a/packages/g/grpc/patches/1.68.2/fix-nan-on-win11.patch +++ b/packages/g/grpc/patches/1.68.2/fix-nan-on-win11.patch @@ -2,7 +2,7 @@ diff --git a/third_party/upb/upb/message/internal/message.c b/third_party/upb/up index 265d30d..afc6e51 100644 --- a/third_party/upb/upb/message/internal/message.c +++ b/third_party/upb/upb/message/internal/message.c -@@ -15,9 +15,9 @@ +@@ -17,9 +17,9 @@ // Must be last. #include "upb/port/def.inc" From 2d7f874b1f926595109be082a178e2966832a7c7 Mon Sep 17 00:00:00 2001 From: Altina Orion <139891033+Altina-oz@users.noreply.github.com> Date: Tue, 17 Dec 2024 15:24:25 +0800 Subject: [PATCH 12/24] Update xmake.lua --- packages/g/grpc/xmake.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/g/grpc/xmake.lua b/packages/g/grpc/xmake.lua index 17f8664fa08..f22a8741494 100644 --- a/packages/g/grpc/xmake.lua +++ b/packages/g/grpc/xmake.lua @@ -11,7 +11,7 @@ package("grpc") add_patches("1.51.3", path.join(os.scriptdir(), "patches", "1.51.3", "disable-download-archive.patch"), "90fdd6e4a51cbc9756d1fcdd0f65e665d4b78cfd91fdbeb0228cc4e9c4ba1b73") add_patches("1.51.3", path.join(os.scriptdir(), "patches", "1.51.3", "static-linking-in-linux.patch"), "176474919883f93be0c5056098eccad408038663c6c7361f2e049cdf7247a19c") - add_patches("1.68.2", path.join(os.scriptdir(), "patches", "1.68.2", "fix-nan-on-win11.patch"), "3b31939101c87fd04a08e4d055fa0bd3f1f7356d7ad18b02cc92aba911e2d7d9") + add_patches("1.68.2", path.join(os.scriptdir(), "patches", "1.68.2", "fix-nan-on-win11.patch"), "4a47c42bdb22e9643930940e968cf41b8b7d7981882d84a56eb765cfa6253699") add_deps("cmake") if is_plat("linux") then add_deps("autoconf", "libtool", "pkg-config") From 52c28a1fa45d58122ab4b62f1086141ea39e230e Mon Sep 17 00:00:00 2001 From: Altina Orion <139891033+Altina-oz@users.noreply.github.com> Date: Tue, 17 Dec 2024 15:54:46 +0800 Subject: [PATCH 13/24] Update fix-nan-on-win11.patch --- packages/g/grpc/patches/1.68.2/fix-nan-on-win11.patch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/g/grpc/patches/1.68.2/fix-nan-on-win11.patch b/packages/g/grpc/patches/1.68.2/fix-nan-on-win11.patch index a639d9a3c6e..b4b1dab6a26 100644 --- a/packages/g/grpc/patches/1.68.2/fix-nan-on-win11.patch +++ b/packages/g/grpc/patches/1.68.2/fix-nan-on-win11.patch @@ -13,5 +13,6 @@ index 265d30d..afc6e51 100644 +const double kUpb_Infinity = 1.0 / 0.0; +const double kUpb_NaN = 0.0 / 0.0; - static const size_t overhead = sizeof(upb_Message_InternalData); + bool UPB_PRIVATE(_upb_Message_Realloc)(struct upb_Message* msg, size_t need, + upb_Arena* a) { From 05898ebb961e2b7146d086c6ac154a75a55befcd Mon Sep 17 00:00:00 2001 From: Altina Orion <139891033+Altina-oz@users.noreply.github.com> Date: Tue, 17 Dec 2024 15:58:03 +0800 Subject: [PATCH 14/24] Update xmake.lua --- packages/g/grpc/xmake.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/g/grpc/xmake.lua b/packages/g/grpc/xmake.lua index f22a8741494..b410acdd44a 100644 --- a/packages/g/grpc/xmake.lua +++ b/packages/g/grpc/xmake.lua @@ -11,7 +11,7 @@ package("grpc") add_patches("1.51.3", path.join(os.scriptdir(), "patches", "1.51.3", "disable-download-archive.patch"), "90fdd6e4a51cbc9756d1fcdd0f65e665d4b78cfd91fdbeb0228cc4e9c4ba1b73") add_patches("1.51.3", path.join(os.scriptdir(), "patches", "1.51.3", "static-linking-in-linux.patch"), "176474919883f93be0c5056098eccad408038663c6c7361f2e049cdf7247a19c") - add_patches("1.68.2", path.join(os.scriptdir(), "patches", "1.68.2", "fix-nan-on-win11.patch"), "4a47c42bdb22e9643930940e968cf41b8b7d7981882d84a56eb765cfa6253699") + add_patches("1.68.2", path.join(os.scriptdir(), "patches", "1.68.2", "fix-nan-on-win11.patch"), "ebb7cb2772528edd9de306820a4f811f4e8150fa4daa4471431315bfa30a2617") add_deps("cmake") if is_plat("linux") then add_deps("autoconf", "libtool", "pkg-config") From 74fcb2c9e6c13501798a91db2c3a7195f8158df0 Mon Sep 17 00:00:00 2001 From: Altina Orion <139891033+Altina-oz@users.noreply.github.com> Date: Tue, 17 Dec 2024 23:20:14 +0800 Subject: [PATCH 15/24] Add protocand see if we should patch cmake --- packages/g/grpc/xmake.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/g/grpc/xmake.lua b/packages/g/grpc/xmake.lua index b410acdd44a..27a665121b9 100644 --- a/packages/g/grpc/xmake.lua +++ b/packages/g/grpc/xmake.lua @@ -54,6 +54,9 @@ package("grpc") "-DgRPC_PROTOBUF_PACKAGE_TYPE=CONFIG"} 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")) + if package:is_cross() then + package:add("deps", "protoc") + end import("package.tools.cmake").install(package, configs, {packagedeps = {"abseil", "protobuf-cpp"}}) end) From fff15303cba049f6d8a92fa94df14a0fde7171ee Mon Sep 17 00:00:00 2001 From: Altina Orion <139891033+Altina-oz@users.noreply.github.com> Date: Tue, 17 Dec 2024 23:21:54 +0800 Subject: [PATCH 16/24] Update xmake.lua --- packages/g/grpc/xmake.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/g/grpc/xmake.lua b/packages/g/grpc/xmake.lua index 27a665121b9..73f61521a3f 100644 --- a/packages/g/grpc/xmake.lua +++ b/packages/g/grpc/xmake.lua @@ -36,6 +36,9 @@ package("grpc") on_load(function (package) package:addenv("PATH", "bin") + if package:is_cross() then + package:add("deps", "protoc") + end end) on_install("linux", "macosx", "windows", function (package) @@ -54,9 +57,7 @@ package("grpc") "-DgRPC_PROTOBUF_PACKAGE_TYPE=CONFIG"} 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")) - if package:is_cross() then - package:add("deps", "protoc") - end + import("package.tools.cmake").install(package, configs, {packagedeps = {"abseil", "protobuf-cpp"}}) end) From 04609de2e7f5fd6dee51eea370a6f3fee26fa4bf Mon Sep 17 00:00:00 2001 From: Altina Orion <139891033+Altina-oz@users.noreply.github.com> Date: Wed, 18 Dec 2024 00:41:43 +0800 Subject: [PATCH 17/24] Test if can pass protobuf-cpp root directly --- packages/g/grpc/xmake.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/g/grpc/xmake.lua b/packages/g/grpc/xmake.lua index 73f61521a3f..17f5a6e33ad 100644 --- a/packages/g/grpc/xmake.lua +++ b/packages/g/grpc/xmake.lua @@ -54,6 +54,7 @@ package("grpc") "-DgRPC_PROTOBUF_PROVIDER=package", "-DgRPC_UPB_PROVIDER=module", -- TODO "-DgRPC_BENCHMARK_PROVIDER=none", + "-DProtobuf_ROOT=" .. package:dep("protobuf-cpp"):installdir(), "-DgRPC_PROTOBUF_PACKAGE_TYPE=CONFIG"} 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")) From 92ceb4c5a74d43a76cb382ee1dd19745e2fb39cd Mon Sep 17 00:00:00 2001 From: Altina Orion <139891033+Altina-oz@users.noreply.github.com> Date: Wed, 18 Dec 2024 11:39:02 +0800 Subject: [PATCH 18/24] test link --- packages/g/grpc/xmake.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/g/grpc/xmake.lua b/packages/g/grpc/xmake.lua index 17f5a6e33ad..231762f1d71 100644 --- a/packages/g/grpc/xmake.lua +++ b/packages/g/grpc/xmake.lua @@ -39,6 +39,11 @@ package("grpc") if package:is_cross() then package:add("deps", "protoc") end + if package:is_plat("windows") then + package:add("links", "libprotoc", "libprotobuf", "utf8_range", "utf8_validity") + else + package:add("links", "protoc", "protobuf", "utf8_range", "utf8_validity") + end end) on_install("linux", "macosx", "windows", function (package) From 31760795358e7104a50dd96c36cff9f605f28c5e Mon Sep 17 00:00:00 2001 From: star9029 Date: Tue, 24 Dec 2024 02:00:03 +0800 Subject: [PATCH 19/24] Update xmake.lua --- packages/g/grpc/xmake.lua | 93 +++++++++++++++++++++++++-------------- 1 file changed, 61 insertions(+), 32 deletions(-) diff --git a/packages/g/grpc/xmake.lua b/packages/g/grpc/xmake.lua index 231762f1d71..40cb1bfcfe3 100644 --- a/packages/g/grpc/xmake.lua +++ b/packages/g/grpc/xmake.lua @@ -5,72 +5,101 @@ package("grpc") add_urls("https://github.com/grpc/grpc/archive/refs/tags/$(version).zip", "https://github.com/grpc/grpc.git") + add_versions("v1.51.3", "17720fd0a690e904a468b4b3dae6fa5ec40b0d1f4d418e2ca092e2f92f06fce0") add_versions("v1.62.1", "f672a3a3b370f2853869745110dabfb6c13af93e17ffad4676a0b95b5ec204af") add_versions("v1.68.2", "2a17adb0d23768413ca85990dbf800a600863d272fcc37a9f67f3b5e34ae9174") + add_patches("1.68.2", path.join(os.scriptdir(), "patches", "1.68.2", "fix-nan-on-win11.patch"), "ebb7cb2772528edd9de306820a4f811f4e8150fa4daa4471431315bfa30a2617") add_patches("1.51.3", path.join(os.scriptdir(), "patches", "1.51.3", "disable-download-archive.patch"), "90fdd6e4a51cbc9756d1fcdd0f65e665d4b78cfd91fdbeb0228cc4e9c4ba1b73") add_patches("1.51.3", path.join(os.scriptdir(), "patches", "1.51.3", "static-linking-in-linux.patch"), "176474919883f93be0c5056098eccad408038663c6c7361f2e049cdf7247a19c") - add_patches("1.68.2", path.join(os.scriptdir(), "patches", "1.68.2", "fix-nan-on-win11.patch"), "ebb7cb2772528edd9de306820a4f811f4e8150fa4daa4471431315bfa30a2617") - add_deps("cmake") - if is_plat("linux") then - add_deps("autoconf", "libtool", "pkg-config") - add_extsources("apt::build-essential") - elseif is_plat("macosx") then - add_deps("autoconf", "automake", "libtool") - add_extsources("brew::shtool") - elseif is_plat("windows") then - add_deps("nasm") + + if is_plat("windows") then add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true}) end - add_deps("c-ares", "re2", "protobuf-cpp", "openssl", "zlib", "abseil") + add_deps("cmake") + add_deps("c-ares", "re2", "protobuf-cpp", "openssl", "zlib") - if is_plat("linux") then + if is_plat("linux", "bsd") then add_syslinks("pthread", "dl", "m") + elseif is_plat("macosx", "iphoneos") then + add_frameworks("CoreFoundation") end - add_links("grpc++", "grpc++_unsecure", "grpc++_alts", "grpc++_reflection", "grpc++_error_details", "grpcpp_channelz") - add_links("grpc", "grpc_unsecure", "grpc_plugin_support", "gpr") - add_links("address_sorting", "upb") --TODO we should add seperate package deps + if on_check then + on_check(function (package) + if package:is_cross() then + raise("package(grpc) unsupported cross-compilation") + end + end) + end on_load(function (package) - package:addenv("PATH", "bin") - if package:is_cross() then - package:add("deps", "protoc") - end - if package:is_plat("windows") then - package:add("links", "libprotoc", "libprotobuf", "utf8_range", "utf8_validity") + package:add("links", "grpc++", "grpc++_unsecure", "grpc++_alts", "grpc++_reflection", "grpc++_error_details", "grpcpp_channelz") + package:add("links", "grpc", "grpc_unsecure", "grpc_plugin_support", "grpc_authorization_provider", "gpr") + package:add("links", "address_sorting") + if package:gitref() or package:version():ge("1.68.2") then + package:add("links", "upb_textformat_lib", "upb_json_lib", "upb_wire_lib", "upb_message_lib", "utf8_range_lib", "upb_mini_descriptor_lib", "upb_mem_lib", "upb_base_lib") else - package:add("links", "protoc", "protobuf", "utf8_range", "utf8_validity") + package:add("links", "upb") + end + + if not package:is_cross() then + package:addenv("PATH", "bin") end end) on_install("linux", "macosx", "windows", function (package) local configs = { - "-DCMAKE_CXX_STANDARD=17", -- abseil need c++17 + "-DgRPC_DOWNLOAD_ARCHIVES=OFF", + "-DCMAKE_CXX_STANDARD=" .. package:dep("abseil"):config("cxx_standard"), "-DCMAKE_CXX_STANDARD_REQUIRED=TRUE", "-DgRPC_BUILD_TESTS=OFF", + "-DgRPC_ZLIB_PROVIDER=package", "-DgRPC_ABSL_PROVIDER=package", "-DgRPC_CARES_PROVIDER=package", "-DgRPC_RE2_PROVIDER=package", "-DgRPC_SSL_PROVIDER=package", "-DgRPC_PROTOBUF_PROVIDER=package", - "-DgRPC_UPB_PROVIDER=module", -- TODO + "-DgRPC_PROTOBUF_PACKAGE_TYPE=CONFIG", + "-DgRPC_UPB_PROVIDER=module", "-DgRPC_BENCHMARK_PROVIDER=none", - "-DProtobuf_ROOT=" .. package:dep("protobuf-cpp"):installdir(), - "-DgRPC_PROTOBUF_PACKAGE_TYPE=CONFIG"} - table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) + "-DgRPC_USE_SYSTEMD=OFF", -- TODO: unbundle dep + + "-DgRPC_BUILD_GRPC_CSHARP_PLUGIN=OFF", + "-DgRPC_BUILD_GRPC_NODE_PLUGIN=OFF", + "-DgRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN=OFF", + "-DgRPC_BUILD_GRPC_PHP_PLUGIN=OFF", + "-DgRPC_BUILD_GRPC_PYTHON_PLUGIN=OFF", + "-DgRPC_BUILD_GRPC_RUBY_PLUGIN=OFF", + } + table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release")) table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) - - import("package.tools.cmake").install(package, configs, {packagedeps = {"abseil", "protobuf-cpp"}}) + + local opt = {} + if not (package:gitref() or package:version():ge("1.68.2")) then + opt.packagedeps = "protobuf-cpp" + end + import("package.tools.cmake").install(package, configs, opt) + + if package:is_cross() then + os.tryrm(package:installdir("bin/*.exe")) + end end) on_test(function (package) - if package:is_binary() then + if not package:is_cross() then assert(os.isfile(path.join(package:installdir(), "bin", "grpc_cpp_plugin"))) - else - assert(package:has_cxxincludes("grpcpp/grpcpp.h", {configs = {languages = "c++17"}})) + end + + local languages = "c++" .. package:dep("abseil"):config("cxx_standard") + if package:is_library() then + assert(package:check_cxxsnippets({test = [[ + void test() { + auto v = grpc::Version(); + } + ]]}, {configs = {languages = languages}, includes = "grpcpp/grpcpp.h"})) end end) From 3c4501fcacf8c1f88ea61f1459fadf104a591970 Mon Sep 17 00:00:00 2001 From: star9029 Date: Tue, 24 Dec 2024 09:18:53 +0800 Subject: [PATCH 20/24] Update xmake.lua --- packages/g/grpc/xmake.lua | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/packages/g/grpc/xmake.lua b/packages/g/grpc/xmake.lua index 40cb1bfcfe3..9e4f937850f 100644 --- a/packages/g/grpc/xmake.lua +++ b/packages/g/grpc/xmake.lua @@ -82,20 +82,29 @@ package("grpc") if not (package:gitref() or package:version():ge("1.68.2")) then opt.packagedeps = "protobuf-cpp" end - import("package.tools.cmake").install(package, configs, opt) + if package:is_binary() then + opt.target = "grpc_cpp_plugin" + import("package.tools.cmake").build(package, configs, opt) - if package:is_cross() then - os.tryrm(package:installdir("bin/*.exe")) + os.cp(path.join(package:buildir(), "grpc_cpp_plugin*"), package:installdir("bin")) + else + import("package.tools.cmake").install(package, configs, opt) + + if package:is_cross() then + os.tryrm(package:installdir("bin/*.exe")) + end end + end) on_test(function (package) if not package:is_cross() then - assert(os.isfile(path.join(package:installdir(), "bin", "grpc_cpp_plugin"))) + local grpc_cpp_plugin = "bin/grpc_cpp_plugin" .. (is_host("windows") and ".exe" or "") + assert(os.isfile(path.join(package:installdir(), grpc_cpp_plugin))) end - local languages = "c++" .. package:dep("abseil"):config("cxx_standard") if package:is_library() then + local languages = "c++" .. package:dep("abseil"):config("cxx_standard") assert(package:check_cxxsnippets({test = [[ void test() { auto v = grpc::Version(); From dc5806b9c5846ff66f5c726115c3b4370cbf3ee2 Mon Sep 17 00:00:00 2001 From: star9029 Date: Tue, 24 Dec 2024 13:13:02 +0800 Subject: [PATCH 21/24] fix macos shared --- packages/g/grpc/xmake.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/g/grpc/xmake.lua b/packages/g/grpc/xmake.lua index 9e4f937850f..472b6c49937 100644 --- a/packages/g/grpc/xmake.lua +++ b/packages/g/grpc/xmake.lua @@ -50,7 +50,13 @@ package("grpc") end end) - on_install("linux", "macosx", "windows", function (package) + on_install(function (package) + -- @see https://github.com/grpc/grpc/issues/36654#issuecomment-2228569158 + if package:is_plat("macosx") and package:config("shared") then + io.replace("CMakeLists.txt", "target_compile_features(upb_textformat_lib PUBLIC cxx_std_14)", + "target_compile_features(upb_textformat_lib PUBLIC cxx_std_14)\ntarget_link_options(upb_textformat_lib PRIVATE -Wl,-undefined,dynamic_lookup)\ntarget_link_options(upb_json_lib PRIVATE -Wl,-undefined,dynamic_lookup)", {plain = true}) + end + local configs = { "-DgRPC_DOWNLOAD_ARCHIVES=OFF", "-DCMAKE_CXX_STANDARD=" .. package:dep("abseil"):config("cxx_standard"), From b45400a01441b4f4e614bc187ebc6be0882535fd Mon Sep 17 00:00:00 2001 From: star9029 Date: Tue, 24 Dec 2024 17:38:51 +0800 Subject: [PATCH 22/24] Support cross-compilation --- packages/g/grpc/xmake.lua | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/packages/g/grpc/xmake.lua b/packages/g/grpc/xmake.lua index 472b6c49937..de7288686b4 100644 --- a/packages/g/grpc/xmake.lua +++ b/packages/g/grpc/xmake.lua @@ -29,8 +29,8 @@ package("grpc") if on_check then on_check(function (package) - if package:is_cross() then - raise("package(grpc) unsupported cross-compilation") + if package:is_plat("mingw", "msys") then + raise("package(grpc) unsupported mingw plat on msys.\nFix refer: https://github.com/msys2/MINGW-packages/tree/404359eedd188a8427ed139659472d64bd250384/mingw-w64-grpc") end end) end @@ -56,6 +56,17 @@ package("grpc") io.replace("CMakeLists.txt", "target_compile_features(upb_textformat_lib PUBLIC cxx_std_14)", "target_compile_features(upb_textformat_lib PUBLIC cxx_std_14)\ntarget_link_options(upb_textformat_lib PRIVATE -Wl,-undefined,dynamic_lookup)\ntarget_link_options(upb_json_lib PRIVATE -Wl,-undefined,dynamic_lookup)", {plain = true}) end + if package:is_cross() then + -- xrepo protobuf will remove protoc.exe in cross-compilation + -- Avoid using CONFIG mode in cmake to find protoc.exe + io.replace("cmake/protobuf.cmake", "find_package(Protobuf REQUIRED CONFIG)", "find_package(Protobuf)", {plain = true}) + -- Disable plugin build + -- https://github.com/grpc/grpc/issues/29370 + io.replace("CMakeLists.txt", "add_library(grpc_plugin_support", + "if(0)\nadd_library(grpc_plugin_support", {plain = true}) + io.replace("CMakeLists.txt", "if(gRPC_INSTALL)\n install(TARGETS grpc_plugin_support", + "endif()\nif(0)\n install(TARGETS grpc_plugin_support", {plain = true}) + end local configs = { "-DgRPC_DOWNLOAD_ARCHIVES=OFF", @@ -84,6 +95,9 @@ package("grpc") table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release")) table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) + table.insert(configs, "-DgRPC_BUILD_CODEGEN=" .. (package:is_cross() and "OFF" or "ON")) + table.insert(configs, "-DgRPC_BUILD_GRPC_CPP_PLUGIN=" .. (package:is_cross() and "OFF" or "ON")) + local opt = {} if not (package:gitref() or package:version():ge("1.68.2")) then opt.packagedeps = "protobuf-cpp" @@ -95,10 +109,6 @@ package("grpc") os.cp(path.join(package:buildir(), "grpc_cpp_plugin*"), package:installdir("bin")) else import("package.tools.cmake").install(package, configs, opt) - - if package:is_cross() then - os.tryrm(package:installdir("bin/*.exe")) - end end end) From 6bae953a35a7bcb36e3646047aa74e011c3cbf09 Mon Sep 17 00:00:00 2001 From: star9029 Date: Tue, 24 Dec 2024 23:37:45 +0800 Subject: [PATCH 23/24] use openssl3 --- packages/g/grpc/xmake.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/g/grpc/xmake.lua b/packages/g/grpc/xmake.lua index de7288686b4..cc0aad44c89 100644 --- a/packages/g/grpc/xmake.lua +++ b/packages/g/grpc/xmake.lua @@ -19,7 +19,7 @@ package("grpc") end add_deps("cmake") - add_deps("c-ares", "re2", "protobuf-cpp", "openssl", "zlib") + add_deps("c-ares", "re2", "protobuf-cpp", "openssl3", "zlib") if is_plat("linux", "bsd") then add_syslinks("pthread", "dl", "m") From d38b82875004fc3215d3c4f260bbc7b0faf16c82 Mon Sep 17 00:00:00 2001 From: star9029 Date: Wed, 25 Dec 2024 01:37:20 +0800 Subject: [PATCH 24/24] limit plat --- packages/g/grpc/xmake.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/g/grpc/xmake.lua b/packages/g/grpc/xmake.lua index cc0aad44c89..057cb05d07d 100644 --- a/packages/g/grpc/xmake.lua +++ b/packages/g/grpc/xmake.lua @@ -50,7 +50,7 @@ package("grpc") end end) - on_install(function (package) + on_install("!wasm", function (package) -- @see https://github.com/grpc/grpc/issues/36654#issuecomment-2228569158 if package:is_plat("macosx") and package:config("shared") then io.replace("CMakeLists.txt", "target_compile_features(upb_textformat_lib PUBLIC cxx_std_14)",