summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorDanny Milosavljevic <dannym@friendly-machines.com>2025-06-15 22:00:49 +0200
committerDanny Milosavljevic <dannym@friendly-machines.com>2025-06-22 10:05:55 +0200
commit15a43c743102b5026eccb82be94af30de799f79f (patch)
treea9f1788a7caf60b8480154fa22e3f3b41e31a2d9 /gnu
parente365fc68f3f48167dcb1b63d6acbc1d857d1ed15 (diff)
gnu: Add mono-system-reflection-metadata-bootstrap.
* gnu/packages/dotnet.scm (mono-system-reflection-metadata-bootstrap): New variable. Change-Id: I05d30bc85c182316ccd099bc18473a91a0d8e7f1
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/dotnet.scm63
1 files changed, 63 insertions, 0 deletions
diff --git a/gnu/packages/dotnet.scm b/gnu/packages/dotnet.scm
index 10a3cb611c1..778045f201d 100644
--- a/gnu/packages/dotnet.scm
+++ b/gnu/packages/dotnet.scm
@@ -1981,3 +1981,66 @@ most of the heavy lifting.")
the source code included within the Mono source tree.")
(home-page "https://dot.net/")
(license license:expat)))
+
+(define mono-system-reflection-metadata-bootstrap
+ (package
+ (name "mono-system-reflection-metadata-bootstrap")
+ ;; Upstream version 1.4.2; but for bootstrap packages it's more useful to have the mono version here.
+ (version
+ (package-version mono))
+ (source
+ (package-source mono))
+ (build-system gnu-build-system)
+ (inputs
+ (list mono-system-collections-immutable-bootstrap)) ; not required: mono-system-buffers-bootstrap
+ (native-inputs
+ (list mono))
+ (arguments
+ (list #:phases
+ #~(modify-phases %standard-phases
+ (delete 'bootstrap)
+ (add-after 'unpack 'chdir
+ (lambda _
+ (chdir "external/corefx/src/System.Reflection.Metadata/src")
+ (substitute* "../../Common/src/System/SR.cs"
+ ;; I don't want to drag System.Security.AccessControl into the bootstrap path.
+ (("new ResourceManager[(]ResourceType[)]")
+ "new ResourceManager(\"System.Collections.Immutable\", typeof(SR).Assembly)"))))
+ (add-after 'chdir 'prepare
+ (lambda* (#:key inputs #:allow-other-keys)
+ (for-each
+ (lambda (name)
+ (if (file-exists? name)
+ (delete-file name)
+ (format #t "Warning: File ~s doesn't exist~%" name)))
+ ;; We don't need those since they would be for different .NET standards.
+ '("./System/Reflection/Internal/Utilities/CriticalDisposableObject.netstandard1.1.cs"
+ "./System/Reflection/Internal/Utilities/EncodingHelper.netcoreapp.cs"
+ "./System/Reflection/Internal/Utilities/FileStreamReadLightUp.netstandard1.1.cs"
+ "./System/Reflection/Internal/Utilities/MemoryMapLightUp.netstandard1.1.cs"))))
+ (delete 'configure)
+ (replace 'build
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (invoke "resx2sr" "-o" "SR.cs" "-n" "System.SR" "--warn-mismatch"
+ "Resources/Strings.resx")
+ (apply invoke "mcs"
+ "-target:library"
+ "-langversion:7.2"
+ "-unsafe"
+ "-out:System.Reflection.Metadata.dll"
+ ; ,(string-append "-r:" buffers-dll)
+ (string-append "-r:"
+ (search-input-file inputs
+ "/lib/mono/4.5/System.Collections.Immutable.dll"))
+ "../../Common/src/System/SR.cs"
+ (find-files "." "\\.cs$"))))
+ (delete 'check)
+ (replace 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((lib-dir (string-append #$output "/lib/mono/4.5")))
+ (install-file "System.Reflection.Metadata.dll" lib-dir)))))))
+ (synopsis "System.Reflection.Metadata library for bootstrapping")
+ (description "This package builds the System.Reflection.Metadata library from
+the source code included within the Mono source tree.")
+ (home-page "https://dot.net/")
+ (license license:expat)))