Subject: [PATCH 17/21] gnu: Add mono-5.8.0.

From: Efraim Flashner <[email-masked]>
Date: Mon, 16 Dec 2024 19:26:40 +0200

From: unmush <[email-masked]>

* gnu/packages/dotnet.scm
  (mono-5.8.0-external-repo-specs, mono-5.8.0): New variables.
* gnu/packages/patches/mono-5.8.0-patches.patch: New patch.
* gnu/local.mk (dist_patch_DATA): Register new patch.

Change-Id: Iea71bf52d67a182f7543adaba44409dbf6c3c0e2
---
 gnu/local.mk                                  |   1 +
 gnu/packages/dotnet.scm                       | 123 ++++++++++++++++++
 gnu/packages/patches/mono-5.8.0-patches.patch |  60 +++++++++
 3 files changed, 184 insertions(+)
 create mode 100644 gnu/packages/patches/mono-5.8.0-patches.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 788f3bb835a..2b1a6f7c782 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1828,6 +1828,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/mono-2.11.4-fixes.patch			\
   %D%/packages/patches/mono-4.9.0-fix-runtimemetadataversion.patch		\
   %D%/packages/patches/mono-5.4.0-patches.patch		\
+  %D%/packages/patches/mono-5.8.0-patches.patch		\
   %D%/packages/patches/mosaicatcher-unbundle-htslib.patch	\
   %D%/packages/patches/mrrescue-support-love-11.patch		\
   %D%/packages/patches/mtools-mformat-uninitialized.patch	\
diff --git a/gnu/packages/dotnet.scm b/gnu/packages/dotnet.scm
index 7799f9b951a..82fc2033707 100644
--- a/gnu/packages/dotnet.scm
+++ b/gnu/packages/dotnet.scm
@@ -1275,3 +1275,126 @@ (define-public mono-pre-5.8.0
          ((#:phases phases #~%standard-phases)
           #~(modify-phases #$phases
               (delete 'patch-sub-autogen.sh-shebang))))))))
+
+(define mono-5.8.0-external-repo-specs
+  '(("api-doc-tools"               "d03e819838c6241f92f90655cb448cc47c9e8791"
+     "1riki79f3ig3cxigviss81dz601hn92a1gifglm0mzjbs76sf3fj"
+     #:recursive? #t)
+    ("api-snapshot"                "6668c80a9499218c0b8cc41f48a9e242587df756"
+     "0vbwbwa1hr4jlj7283w8bk3v5i8s43h8413r2pkh4hf38b2rks7d")
+    ("aspnetwebstack"              "e77b12e6cc5ed260a98447f609e887337e44e299"
+     "0rks344qr4fmp3fs1264d2qkmm348m8d1kjd7z4l94iiirwn1fq1")
+    (("reference-assemblies" "binary-reference-assemblies")
+     "e048fe4a88d237d105ae02fe0363a68296099362"
+     "0i87i3x694f4g8s2flflv0ah88blxds7gbiyrwrmscqdjsifhy49")
+    ("bockbuild"                   "cb4545409dafe16dfe86c7d8e6548a69c369e2a2"
+     "0svdfv61d6ppwd4zgki129r9prf75fnsqihna253zfwfpzpingx7")
+    ("boringssl"                   "3e0770e18835714708860ba9fe1af04a932971ff"
+     "139a0gl91a52k2r6na6ialzkqykaj1rk88zjrkaz3sdxx7nmmg6y")
+    ("cecil"                       "76ffcdabae660e9586273c9b40db180a0dc8d4c8"
+     "0f3bsfri28pxmnb0m6074bnmmjgsr7cjixv9fhnp6aimhvy4l5p4")
+    (("cecil" "cecil-legacy")      "33d50b874fd527118bc361d83de3d494e8bb55e1"
+     "1p4hl1796ib26ykyf5snl6cj0lx0v7mjh0xqhjw6qdh753nsjyhb")
+    ("corefx"                      "b965d1f8b5281712c4400ef28ed97670ffd4880d"
+     "0r9hr0bs3j3agqi2pq4n1km9jfycaqvxf6756y7r5l3ykqsd6wsr")
+    ("corert"                      "48dba73801e804e89f00311da99d873f9c550278"
+     "1zw47jf4cwqmaixylisxi73xf6cap41bwf9vlmpxanzxaqklzsvk")
+    ("ikdasm"                      "465c0815558fd43c0110f8d00fc186ac0044ac6a"
+     "0xir7pcgq04hb7s8g9wsqdrypb6l29raj3iz5rcqzdm0056k75w2")
+    (("ikvm-fork" "ikvm")          "847e05fced5c9a41ff0f24f1f9d40d5a8a5772c1"
+     "1fl9bm3lmzf8iqv3x4iqkz9fc54mwdvrxisxg2nvwwcsi4saffpi")
+    ("linker"                      "c62335c350f3902ff0459112f7efc8b926f4f15d"
+     "015191sdw9i7vnhlsycv65pw8nnfpkd65k11jw1y9bikb4x3aj8x")
+    ("Newtonsoft.Json"             "471c3e0803a9f40a0acc8aeceb31de6ff93a52c4"
+     "0dgngd5hqk6yhlg40kabn6qdnknm32zcx9q6bm2w31csnsk5978s")
+    (("NuGet.BuildTasks" "nuget-buildtasks")
+     "b2c30bc81b2a7733a4eeb252a55f6b4d50cfc3a1"
+     "01vajrfx6y12f525xdiwfbn9qzmym2s65rbiqpy9d9xw0pnq7gbl")
+    (("NUnitLite" "nunit-lite")    "764656cdafdb3acd25df8cb52a4e0ea14760fccd"
+     "0pc7lk3p916is8cn4ngaqvjlmlzv3vvjpyksy4pvb3qb5iiaw0vq")
+    ;; ("roslyn-binaries"          "e484c75e2edd3c3f1870a2468a71a56220cf1f7f"
+    ;;  "")
+    ("rx"                          "b29a4b0fda609e0af33ff54ed13652b6ccf0e05e"
+     "1n1jwhmsbkcv2d806immcpzkb72rz04xy98myw355a8w5ah25yiv")
+    ;; ("xunit-binaries"           "d4433b0972f40cb3efaa3fbba52869bde5df8fa8"
+    ;;  "")
+    ))
+
+(define-public mono-5.8.0
+  (package
+    (inherit mono-pre-5.8.0)
+    (version "5.8.0.129")
+    (name "mono")
+    (source (origin
+              (method git-fetch)
+              (uri
+               (git-reference
+                (url "https://gitlab.winehq.org/mono/mono.git")
+                (commit "mono-5.8.0.129")))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0130vd33yzp4w7570qw9xjq2g7b2xmacjbpkmzrpbhy8as5hy4z6"))
+              (modules '((guix build utils)
+                         (ice-9 string-fun)))
+              (snippet #~(begin
+                           #$(add-external-repos
+                              mono-5.8.0-external-repo-specs)
+                           #$@prepare-mono-source-0))
+              (patches
+               (search-patches "mono-5.8.0-patches.patch"))))
+    (native-inputs (modify-inputs (package-native-inputs mono-pre-5.8.0)
+                     (replace "mono" mono-pre-5.8.0)))
+    (arguments
+     (substitute-keyword-arguments (package-arguments mono-pre-5.8.0)
+       ((#:phases phases #~%standard-phases)
+        #~(modify-phases #$phases
+            (replace 'build-reference-assemblies
+              ;; More references need updating this time...
+              (lambda* (#:key make-flags #:allow-other-keys)
+                (let ((top (getcwd)))
+                  (with-directory-excursion
+                      "external/binary-reference-assemblies"
+                    (substitute* (find-files "." "^Makefile$")
+                      (("CSC_COMMON_ARGS := " all)
+                       (string-append all "-delaysign+ "))
+                      (("IBM\\.Data\\.DB2_REFS := " all)
+                       (string-append all "System.Xml "))
+                      (("Mono\\.Data\\.Sqlite_REFS := " all)
+                       (string-append all "System.Xml "))
+                      (("System\\.Data\\.DataSetExtensions_REFS := " all)
+                       (string-append all "System.Xml "))
+                      (("System\\.Data\\.OracleClient_REFS := " all)
+                       (string-append all "System.Xml "))
+                      (("System\\.IdentityModel_REFS := " all)
+                       (string-append all "System.Configuration "))
+                      (("System\\.Design_REFS := " all)
+                       (string-append all "Accessibility "))
+                      (("System\\.Web\\.Extensions\\.Design_REFS := " all)
+                       (string-append all "System.Windows.Forms System.Web "))
+                      (("System\\.ServiceModel\\.Routing_REFS := " all)
+                       (string-append all "System.Xml "))
+                      (("System\\.Web\\.Abstractions_REFS := " all)
+                       (string-append all "System "))
+                      (("System\\.Reactive\\.Windows\\.Forms_REFS := " all)
+                       (string-append all "System "))
+                      (("System\\.Windows\\.Forms\\.DataVisualization_REFS := " all)
+                       (string-append all "Accessibility "))
+                      (("Facades/System\\.ServiceModel\\.Primitives_REFS := " all)
+                       (string-append all "System.Xml "))
+                      (("Facades/System\\.Dynamic\\.Runtime_REFS := " all)
+                       (string-append all "System "))
+                      (("Facades/System\\.Xml\\.XDocument_REFS := " all)
+                       (string-append all "System.Xml "))
+                      (("Facades/System\\.Runtime\\.Serialization.Xml_REFS := " all)
+                       (string-append all "System.Xml "))
+                      (("Facades/System\\.Data\\.Common_REFS := " all)
+                       (string-append all "System System.Xml ")))
+                    (apply invoke "make"
+                           (string-append "CSC=MONO_PATH="
+                                          top "/mcs/class/lib/build"
+                                          " "
+                                          top "/runtime/mono-wrapper"
+                                          " "
+                                          top "/mcs/class/lib/build/mcs.exe")
+                           make-flags)))))))))))
diff --git a/gnu/packages/patches/mono-5.8.0-patches.patch b/gnu/packages/patches/mono-5.8.0-patches.patch
new file mode 100644
index 00000000000..f73c51d92f5
--- /dev/null
+++ b/gnu/packages/patches/mono-5.8.0-patches.patch
@@ -0,0 +1,60 @@
+diff --git a/mcs/class/System/Mono.AppleTls/AppleTlsContext.cs b/mcs/class/System/Mono.AppleTls/AppleTlsContext.cs
+index 0cc69e47648..51ded713ba6 100644
+--- a/mcs/class/System/Mono.AppleTls/AppleTlsContext.cs
++++ b/mcs/class/System/Mono.AppleTls/AppleTlsContext.cs
+@@ -775,7 +775,7 @@ namespace Mono.AppleTls
+ 		[DllImport (SecurityLibrary)]
+ 		extern unsafe static /* OSStatus */ SslStatus SSLRead (/* SSLContextRef */ IntPtr context, /* const void* */ byte* data, /* size_t */ IntPtr dataLength, /* size_t* */ out IntPtr processed);
+ 
+-		public override unsafe (int ret, bool wantMore) Read (byte[] buffer, int offset, int count)
++		public override unsafe System.ValueTuple<int, bool> Read (byte[] buffer, int offset, int count)
+ 		{
+ 			if (Interlocked.Exchange (ref pendingIO, 1) == 1)
+ 				throw new InvalidOperationException ();
+@@ -816,7 +816,7 @@ namespace Mono.AppleTls
+ 		[DllImport (SecurityLibrary)]
+ 		extern unsafe static /* OSStatus */ SslStatus SSLWrite (/* SSLContextRef */ IntPtr context, /* const void* */ byte* data, /* size_t */ IntPtr dataLength, /* size_t* */ out IntPtr processed);
+ 
+-		public override unsafe (int ret, bool wantMore) Write (byte[] buffer, int offset, int count)
++		public override unsafe System.ValueTuple<int, bool> Write (byte[] buffer, int offset, int count)
+ 		{
+ 			if (Interlocked.Exchange (ref pendingIO, 1) == 1)
+ 				throw new InvalidOperationException ();
+diff --git a/mcs/class/System/Mono.Btls/MonoBtlsContext.cs b/mcs/class/System/Mono.Btls/MonoBtlsContext.cs
+index 559db4aca5d..b70239c5163 100644
+--- a/mcs/class/System/Mono.Btls/MonoBtlsContext.cs
++++ b/mcs/class/System/Mono.Btls/MonoBtlsContext.cs
+@@ -300,7 +300,7 @@ namespace Mono.Btls
+ 			throw new NotImplementedException ();
+ 		}
+ 
+-		public override (int ret, bool wantMore) Read (byte[] buffer, int offset, int size)
++		public override System.ValueTuple<int, bool> Read (byte[] buffer, int offset, int size)
+ 		{
+ 			Debug ("Read: {0} {1} {2}", buffer.Length, offset, size);
+ 
+@@ -329,7 +329,7 @@ namespace Mono.Btls
+ 			}
+ 		}
+ 
+-		public override (int ret, bool wantMore) Write (byte[] buffer, int offset, int size)
++		public override System.ValueTuple<int, bool> Write (byte[] buffer, int offset, int size)
+ 		{
+ 			Debug ("Write: {0} {1} {2}", buffer.Length, offset, size);
+ 
+diff --git a/mcs/class/System/Mono.Net.Security/MobileTlsContext.cs b/mcs/class/System/Mono.Net.Security/MobileTlsContext.cs
+index 74410976a85..46f0eb59b9c 100644
+--- a/mcs/class/System/Mono.Net.Security/MobileTlsContext.cs
++++ b/mcs/class/System/Mono.Net.Security/MobileTlsContext.cs
+@@ -165,9 +165,9 @@ namespace Mono.Net.Security
+ 
+ 		public abstract void Flush ();
+ 
+-		public abstract (int ret, bool wantMore) Read (byte[] buffer, int offset, int count);
++		public abstract System.ValueTuple<int, bool> Read (byte[] buffer, int offset, int count);
+ 
+-		public abstract (int ret, bool wantMore) Write (byte[] buffer, int offset, int count);
++		public abstract System.ValueTuple<int, bool> Write (byte[] buffer, int offset, int count);
+ 
+ 		public abstract void Shutdown ();
+ 
-- 
Efraim Flashner   <[email-masked]>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted