diff options
| author | Danny Milosavljevic <dannym@friendly-machines.com> | 2026-04-08 17:03:07 +0200 |
|---|---|---|
| committer | Danny Milosavljevic <dannym@friendly-machines.com> | 2026-07-17 01:41:56 +0200 |
| commit | a0a9240d0aaaab6067fbe6464f20d3942c0657cc (patch) | |
| tree | 53aa6d3a8fd59c22c7c16c3bc79684c14600bae1 /gnu/packages/dotnet.scm | |
| parent | 0648b5020f856216e4ee9daf7bc35a89e8fc0f00 (diff) | |
gnu: Add roslyn@2.3.0.
* gnu/packages/patches/roslyn-2.3.0-default-literal-for-csc-2.0.patch: New file.
* gnu/local.mk (dist-patch_DATA): Add reference to it.
* gnu/packages/dotnet.scm (roslyn-2.3): New variable.
Change-Id: I9f279ad1e6adcebb5148f38ae27b9cc464920713
Diffstat (limited to 'gnu/packages/dotnet.scm')
| -rw-r--r-- | gnu/packages/dotnet.scm | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/gnu/packages/dotnet.scm b/gnu/packages/dotnet.scm index af89d4580f7..e33eeddb981 100644 --- a/gnu/packages/dotnet.scm +++ b/gnu/packages/dotnet.scm | |||
| @@ -2561,6 +2561,113 @@ entirely from source using Mono's @command{mcs}. It produces a C# 7.0 | |||
| 2561 | compiler that can be used to bootstrap newer Roslyn versions.") | 2561 | compiler that can be used to bootstrap newer Roslyn versions.") |
| 2562 | (license license:asl2.0) | 2562 | (license license:asl2.0) |
| 2563 | (properties '((hidden? #t))))) | 2563 | (properties '((hidden? #t))))) |
| 2564 | |||
| 2565 | |||
| 2566 | ;;; | ||
| 2567 | ;;; roslyn-2.3: inherits roslyn-2.0, built with csc 2.0 | ||
| 2568 | ;;; | ||
| 2569 | |||
| 2570 | (define-public roslyn-2.3 | ||
| 2571 | (package | ||
| 2572 | (inherit roslyn-2.0) | ||
| 2573 | (version "2.3.0") | ||
| 2574 | (source | ||
| 2575 | (origin | ||
| 2576 | (method git-fetch) | ||
| 2577 | (uri (git-reference | ||
| 2578 | (url "https://github.com/dotnet/roslyn") | ||
| 2579 | (commit (string-append "version-" version)))) | ||
| 2580 | (file-name (git-file-name "roslyn" version)) | ||
| 2581 | (sha256 | ||
| 2582 | (base32 | ||
| 2583 | "1hr7lh7vm8lbj73a63xwlwwgmwm068mll1rcihn2cmg5bi5jkzp6")) | ||
| 2584 | (patches | ||
| 2585 | (search-patches "roslyn-2.3.0-default-literal-for-csc-2.0.patch")))) | ||
| 2586 | (native-inputs (list roslyn-2.0)) | ||
| 2587 | (arguments | ||
| 2588 | (substitute-keyword-arguments arguments | ||
| 2589 | ((#:phases phases '()) | ||
| 2590 | #~(modify-phases #$phases | ||
| 2591 | ;; Replace mcs-specific fixes with csc-2.0-specific fixes. | ||
| 2592 | (replace 'fix-compiler-compat | ||
| 2593 | (lambda _ | ||
| 2594 | ;; csc 2.0 does not support "= default)" (C# 7.1). | ||
| 2595 | (substitute* "src/Compilers/Core/Portable/AdditionalTextFile.cs" | ||
| 2596 | (("CancellationToken cancellationToken = default\\)") | ||
| 2597 | "CancellationToken cancellationToken = default(CancellationToken))")) | ||
| 2598 | (substitute* "src/Compilers/Core/Portable/FileSystemExtensions.cs" | ||
| 2599 | (("CancellationToken cancellationToken = default\\)") | ||
| 2600 | "CancellationToken cancellationToken = default(CancellationToken))")))) | ||
| 2601 | |||
| 2602 | ;; Delete pre-generated files; we regenerate from XML. | ||
| 2603 | (add-after 'remove-stale-files 'delete-generated-files | ||
| 2604 | (lambda _ | ||
| 2605 | (for-each delete-file | ||
| 2606 | (find-files "src/Compilers/CSharp/Portable/Generated" | ||
| 2607 | "\\.cs$")))) | ||
| 2608 | |||
| 2609 | ;; Replace the mcs wrapper with one that calls roslyn-2.0's csc. | ||
| 2610 | ;; Mono's /bin/csc is broken (points at nonexistent csc.exe), | ||
| 2611 | ;; so we must ensure our wrapper is found first. | ||
| 2612 | (replace 'create-csc-wrapper | ||
| 2613 | (lambda* (#:key inputs #:allow-other-keys) | ||
| 2614 | (mkdir-p "bootstrap-bin") | ||
| 2615 | (call-with-output-file "bootstrap-bin/csc" | ||
| 2616 | (lambda (port) | ||
| 2617 | (format port "#!~a~%exec mono ~a \"$@\"~%" | ||
| 2618 | (which "bash") | ||
| 2619 | (string-append (assoc-ref inputs "roslyn") "/lib/roslyn/csc.exe")))) | ||
| 2620 | (chmod "bootstrap-bin/csc" #o755) | ||
| 2621 | (setenv "PATH" | ||
| 2622 | (string-append (getcwd) "/bootstrap-bin:" | ||
| 2623 | (getenv "PATH"))))) | ||
| 2624 | |||
| 2625 | ;; SRM source needs C# 7.2 -> 7.0 downgrades for csc 2.0. | ||
| 2626 | (replace 'prepare-srm-source | ||
| 2627 | (lambda _ | ||
| 2628 | (copy-recursively #$%srm-source-dir "srm-src-patched") | ||
| 2629 | (for-each make-file-writable | ||
| 2630 | (find-files "srm-src-patched")) | ||
| 2631 | (for-each | ||
| 2632 | (lambda (file) | ||
| 2633 | (substitute* file | ||
| 2634 | (("readonly partial struct") "partial struct") | ||
| 2635 | (("readonly struct") "struct"))) | ||
| 2636 | (find-files "srm-src-patched" "\\.cs$")) | ||
| 2637 | (for-each | ||
| 2638 | (lambda (file) | ||
| 2639 | (substitute* file | ||
| 2640 | (("\\bin MemoryBlock ") "MemoryBlock ") | ||
| 2641 | (("metadataTableStream = default;") | ||
| 2642 | "metadataTableStream = default(MemoryBlock);") | ||
| 2643 | (("standalonePdbStream = default;") | ||
| 2644 | "standalonePdbStream = default(MemoryBlock);"))) | ||
| 2645 | (find-files "srm-src-patched" "MetadataReader\\.cs$")) | ||
| 2646 | (substitute* | ||
| 2647 | "srm-src-patched/System/Reflection/Metadata/Ecma335/Encoding/ControlFlowBuilder.cs" | ||
| 2648 | (("label: default, opCode: default\\)") | ||
| 2649 | "label: default(LabelHandle), opCode: default(ILOpCode))")) | ||
| 2650 | (for-each | ||
| 2651 | (lambda (file) | ||
| 2652 | (substitute* file | ||
| 2653 | (("StandaloneSignatureHandle localVariablesSignature = default,") | ||
| 2654 | "StandaloneSignatureHandle localVariablesSignature = default(StandaloneSignatureHandle),") | ||
| 2655 | (("\\) : default;") | ||
| 2656 | ") : default(ExceptionRegionEncoder);"))) | ||
| 2657 | (find-files "srm-src-patched/System/Reflection/Metadata/Ecma335/Encoding" | ||
| 2658 | "\\.cs$")) | ||
| 2659 | (for-each | ||
| 2660 | (lambda (file) | ||
| 2661 | (substitute* file | ||
| 2662 | (("type: ") "") (("version: ") "") (("stamp: ") ""))) | ||
| 2663 | (find-files "srm-src-patched/System/Reflection/PortableExecutable/DebugDirectory" | ||
| 2664 | "\\.cs$")))))))) | ||
| 2665 | (synopsis "C# 7.1 compiler bootstrapped from source") | ||
| 2666 | (description | ||
| 2667 | "This package provides the Roslyn C# compiler (@command{csc}), built | ||
| 2668 | from source using @code{roslyn-2.0} as the bootstrap compiler. It produces | ||
| 2669 | a C# 7.1 compiler that supports default literals, which is needed to build | ||
| 2670 | newer Roslyn versions."))) | ||
| 2564 | ;; too new version: 15.9.21.664 | 2671 | ;; too new version: 15.9.21.664 |
| 2565 | ;; too old (no support for mono) version: 14.0 | 2672 | ;; too old (no support for mono) version: 14.0 |
| 2566 | (define-public msbuild | 2673 | (define-public msbuild |
