diff options
| author | Danny Milosavljevic <dannym@friendly-machines.com> | 2026-04-08 17:09:15 +0200 |
|---|---|---|
| committer | Danny Milosavljevic <dannym@friendly-machines.com> | 2026-07-17 01:41:57 +0200 |
| commit | 1e78c108e5e3bce2f53437baf1390545c11c184b (patch) | |
| tree | 9db3343da78a401a4b17ef2e4f421663eb9e9076 /gnu/packages/dotnet.scm | |
| parent | a883d8d02b76983f15d1a3733b13b46c174bdd03 (diff) | |
gnu: Add roslyn@3.8.0.
* gnu/packages/patches/roslyn-3.8.0-bootstrap-with-csc-3.2.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add reference to it.
* gnu/packages/dotnet.scm (roslyn-3.8): New variable.
(roslyn): New variable.
Change-Id: I29bd9d1f2f29965856653b3cb67c6655e863fc74
Diffstat (limited to 'gnu/packages/dotnet.scm')
| -rw-r--r-- | gnu/packages/dotnet.scm | 445 |
1 files changed, 445 insertions, 0 deletions
diff --git a/gnu/packages/dotnet.scm b/gnu/packages/dotnet.scm index 6f423de54cb..350147536a4 100644 --- a/gnu/packages/dotnet.scm +++ b/gnu/packages/dotnet.scm | |||
| @@ -3010,6 +3010,451 @@ a C# 8.0 compiler."))) | |||
| 3010 | from source using @code{roslyn-3.0} as the bootstrap compiler. It adds | 3010 | from source using @code{roslyn-3.0} as the bootstrap compiler. It adds |
| 3011 | support for the @code{notnull} generic constraint, which is needed to build | 3011 | support for the @code{notnull} generic constraint, which is needed to build |
| 3012 | newer Roslyn versions."))) | 3012 | newer Roslyn versions."))) |
| 3013 | |||
| 3014 | |||
| 3015 | ;;; | ||
| 3016 | ;;; roslyn-3.8: inherits roslyn-3.2, built with csc 3.2 | ||
| 3017 | ;;; This is the target version for Mono 6.12 compatibility. | ||
| 3018 | ;;; | ||
| 3019 | |||
| 3020 | (define-public roslyn-3.8 | ||
| 3021 | (package | ||
| 3022 | (inherit roslyn-3.2) | ||
| 3023 | (version "3.8.0") | ||
| 3024 | (source | ||
| 3025 | (origin | ||
| 3026 | (method git-fetch) | ||
| 3027 | (uri (git-reference | ||
| 3028 | (url "https://github.com/dotnet/roslyn") | ||
| 3029 | (commit (string-append "v" version)))) | ||
| 3030 | (file-name (git-file-name "roslyn" version)) | ||
| 3031 | (sha256 | ||
| 3032 | (base32 | ||
| 3033 | "0z003zysqbd35dmw5dby3rs4471cb8qh5jlswyibc4qffh0dkfx4")) | ||
| 3034 | (patches | ||
| 3035 | (search-patches "roslyn-3.8.0-bootstrap-with-csc-3.2.patch")))) | ||
| 3036 | (native-inputs (list roslyn-3.2)) | ||
| 3037 | (arguments | ||
| 3038 | (substitute-keyword-arguments (package-arguments roslyn-3.2) | ||
| 3039 | ((#:phases phases '()) | ||
| 3040 | #~(modify-phases #$phases | ||
| 3041 | (replace 'create-csc-rsp | ||
| 3042 | (lambda _ | ||
| 3043 | (call-with-output-file "csc.rsp" | ||
| 3044 | (lambda (port) | ||
| 3045 | (display "-langversion:preview\n-d:NET472\n" port))))) | ||
| 3046 | |||
| 3047 | ;; Point at roslyn-3.2's csc. | ||
| 3048 | (replace 'create-csc-wrapper | ||
| 3049 | (lambda* (#:key inputs #:allow-other-keys) | ||
| 3050 | (mkdir-p "bootstrap-bin") | ||
| 3051 | (call-with-output-file "bootstrap-bin/csc" | ||
| 3052 | (lambda (port) | ||
| 3053 | (format port "#!~a~%exec mono ~a \"$@\"~%" | ||
| 3054 | (which "bash") | ||
| 3055 | (string-append (assoc-ref inputs "roslyn") "/lib/roslyn/csc.exe")))) | ||
| 3056 | (chmod "bootstrap-bin/csc" #o755) | ||
| 3057 | (setenv "PATH" | ||
| 3058 | (string-append (getcwd) "/bootstrap-bin:" | ||
| 3059 | (getenv "PATH"))))) | ||
| 3060 | |||
| 3061 | ;; 3.8 has more files with PathUtilities ambiguity | ||
| 3062 | ;; between SRM's and Roslyn's PathUtilities classes. | ||
| 3063 | ;; PathUtilities ambiguity already handled by the patch. | ||
| 3064 | (delete 'fix-srm-inline) | ||
| 3065 | (delete 'fix-srm-inline-3.0) | ||
| 3066 | |||
| 3067 | ;; Mono 6.12's mscorlib provides NotNullWhenAttribute etc. | ||
| 3068 | ;; (backported from .NET Core 3.0), but NOT MemberNotNullAttribute | ||
| 3069 | ;; or MemberNotNullWhenAttribute (added in .NET 5). | ||
| 3070 | ;; Replace the polyfill file: remove types that conflict with | ||
| 3071 | ;; mscorlib, keep the two that Mono lacks. | ||
| 3072 | (replace 'remove-stale-files | ||
| 3073 | (lambda _ | ||
| 3074 | (for-each | ||
| 3075 | (lambda (f) (when (file-exists? f) (delete-file f))) | ||
| 3076 | '("src/Compilers/Core/Portable/DiaSymReader/Utilities/IUnsafeComStream.cs" | ||
| 3077 | "src/Compilers/Core/Portable/DiaSymReader/Utilities/ComMemoryStream.cs" | ||
| 3078 | ;; Index/Range polyfills are internal and shadow | ||
| 3079 | ;; Mono 6.12's public mscorlib types. Delete so | ||
| 3080 | ;; csc finds the mscorlib versions. | ||
| 3081 | "src/Compilers/Core/Portable/InternalUtilities/Index.cs" | ||
| 3082 | "src/Compilers/Core/Portable/InternalUtilities/Range.cs")) | ||
| 3083 | (call-with-output-file | ||
| 3084 | "src/Compilers/Core/Portable/InternalUtilities/NullableAttributes.cs" | ||
| 3085 | (lambda (port) | ||
| 3086 | (display | ||
| 3087 | "namespace System.Diagnostics.CodeAnalysis | ||
| 3088 | { | ||
| 3089 | [System.AttributeUsage(System.AttributeTargets.Method | System.AttributeTargets.Property, Inherited = false, AllowMultiple = true)] | ||
| 3090 | internal sealed class MemberNotNullAttribute : System.Attribute | ||
| 3091 | { | ||
| 3092 | public MemberNotNullAttribute(string member) => Members = new[] { member }; | ||
| 3093 | public MemberNotNullAttribute(params string[] members) => Members = members; | ||
| 3094 | public string[] Members { get; } | ||
| 3095 | } | ||
| 3096 | |||
| 3097 | [System.AttributeUsage(System.AttributeTargets.Method | System.AttributeTargets.Property, Inherited = false, AllowMultiple = true)] | ||
| 3098 | internal sealed class MemberNotNullWhenAttribute : System.Attribute | ||
| 3099 | { | ||
| 3100 | public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new[] { member }; } | ||
| 3101 | public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } | ||
| 3102 | public bool ReturnValue { get; } | ||
| 3103 | public string[] Members { get; } | ||
| 3104 | } | ||
| 3105 | } | ||
| 3106 | " port))))) | ||
| 3107 | |||
| 3108 | ;; 3.8 removed DesktopShim, DesktopBuildClient, and | ||
| 3109 | ;; DesktopAnalyzerAssemblyLoader source files. The inherited | ||
| 3110 | ;; compile phase still references them; create empty stubs. | ||
| 3111 | (add-before 'compile 'create-desktop-stubs | ||
| 3112 | (lambda _ | ||
| 3113 | (for-each | ||
| 3114 | (lambda (f) | ||
| 3115 | (unless (file-exists? f) | ||
| 3116 | (call-with-output-file f | ||
| 3117 | (lambda (port) (newline port))))) | ||
| 3118 | '("src/Compilers/Shared/DesktopShim.cs" | ||
| 3119 | "src/Compilers/Shared/DesktopBuildClient.cs" | ||
| 3120 | "src/Compilers/Shared/DesktopAnalyzerAssemblyLoader.cs")))) | ||
| 3121 | |||
| 3122 | ;; Core IVT needs Scripting and VB assembly names so they | ||
| 3123 | ;; can access internal APIs. | ||
| 3124 | (replace 'build | ||
| 3125 | (lambda _ | ||
| 3126 | ;; Bootstrap SR class from SRM string resources. | ||
| 3127 | ;; Roslyn 2.0-3.2: resx at src/Dependencies/.../Strings.resx | ||
| 3128 | ;; Roslyn 3.8+: resx at %srm-source-dir/Resources/Strings.resx | ||
| 3129 | (invoke "resx2sr" "-o" "srm-strings.cs" "-n" "System.SR" | ||
| 3130 | "--warn-mismatch" | ||
| 3131 | (string-append #$%srm-source-dir "/Resources/Strings.resx")) | ||
| 3132 | (invoke "resx2sr" "-o" "bootstrap-sr.cs" "-n" | ||
| 3133 | "Microsoft.CodeAnalysis.CodeAnalysisResources" | ||
| 3134 | "src/Compilers/Core/Portable/CodeAnalysisResources.resx") | ||
| 3135 | ;; SR.Format wrappers (resx2sr only generates constants; | ||
| 3136 | ;; SRM code calls SR.Format for string interpolation). | ||
| 3137 | (call-with-output-file "srm-strings-format.cs" | ||
| 3138 | (lambda (port) | ||
| 3139 | (display | ||
| 3140 | "namespace System { | ||
| 3141 | partial class SR { | ||
| 3142 | internal static string Format(string f, object a0) => string.Format(f, a0); | ||
| 3143 | internal static string Format(string f, object a0, object a1) => string.Format(f, a0, a1); | ||
| 3144 | internal static string Format(string f, object a0, object a1, object a2) => string.Format(f, a0, a1, a2); | ||
| 3145 | internal static string Format(string f, params object[] args) => string.Format(f, args); | ||
| 3146 | } | ||
| 3147 | } | ||
| 3148 | " port))) | ||
| 3149 | ;; CodeAnalysisResources.ResourceManager property | ||
| 3150 | ;; (needed by diagnostic message formatting). | ||
| 3151 | (call-with-output-file "bootstrap-resourcemanager.cs" | ||
| 3152 | (lambda (port) | ||
| 3153 | (display | ||
| 3154 | "namespace Microsoft.CodeAnalysis { | ||
| 3155 | partial class CodeAnalysisResources { | ||
| 3156 | static System.Resources.ResourceManager _rm; | ||
| 3157 | public static System.Resources.ResourceManager ResourceManager { | ||
| 3158 | get { | ||
| 3159 | if (_rm == null) | ||
| 3160 | _rm = new System.Resources.ResourceManager( | ||
| 3161 | \"Microsoft.CodeAnalysis.CodeAnalysisResources\", | ||
| 3162 | typeof(CodeAnalysisResources).Assembly); | ||
| 3163 | return _rm; | ||
| 3164 | } | ||
| 3165 | } | ||
| 3166 | } | ||
| 3167 | } | ||
| 3168 | " port))) | ||
| 3169 | ;; Core IVT: allow CSharp, VB, Scripting, csc, csi, vbc. | ||
| 3170 | (call-with-output-file "bootstrap-ivt.cs" | ||
| 3171 | (lambda (port) | ||
| 3172 | (for-each | ||
| 3173 | (lambda (asm) | ||
| 3174 | (format port | ||
| 3175 | "[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(~s)]~%" | ||
| 3176 | asm)) | ||
| 3177 | '("Microsoft.CodeAnalysis.CSharp" | ||
| 3178 | "Microsoft.CodeAnalysis.VisualBasic" | ||
| 3179 | "Microsoft.CodeAnalysis.Scripting" | ||
| 3180 | "Microsoft.CodeAnalysis.CSharp.Scripting" | ||
| 3181 | "csc" "csi" "vbc" "VBCSCompiler")))) | ||
| 3182 | ;; CSharp IVT: allow csc, csi, CSharp.Scripting. | ||
| 3183 | (call-with-output-file "bootstrap-csharp-ivt.cs" | ||
| 3184 | (lambda (port) | ||
| 3185 | (format port "using System.Runtime.CompilerServices; | ||
| 3186 | using System.Reflection; | ||
| 3187 | [assembly: InternalsVisibleTo(\"csc\")] | ||
| 3188 | [assembly: InternalsVisibleTo(\"csi\")] | ||
| 3189 | [assembly: InternalsVisibleTo(\"Microsoft.CodeAnalysis.CSharp.Scripting\")] | ||
| 3190 | [assembly: AssemblyVersion(\"~a.0\")] | ||
| 3191 | [assembly: AssemblyFileVersion(\"~a.0\")] | ||
| 3192 | [assembly: AssemblyInformationalVersion(\"~a\")] | ||
| 3193 | " #$(package-version this-package) | ||
| 3194 | #$(package-version this-package) | ||
| 3195 | #$(package-version this-package)))) | ||
| 3196 | ;; Scripting IVT: allow CSharp.Scripting, csi. | ||
| 3197 | (call-with-output-file "bootstrap-scripting-ivt.cs" | ||
| 3198 | (lambda (port) | ||
| 3199 | (display "using System.Runtime.CompilerServices; | ||
| 3200 | [assembly: InternalsVisibleTo(\"Microsoft.CodeAnalysis.CSharp.Scripting\")] | ||
| 3201 | [assembly: InternalsVisibleTo(\"csi\")] | ||
| 3202 | " port))) | ||
| 3203 | ;; .resources from .resx for all assemblies. | ||
| 3204 | (invoke "resgen" | ||
| 3205 | "src/Compilers/Core/Portable/CodeAnalysisResources.resx" | ||
| 3206 | "Microsoft.CodeAnalysis.CodeAnalysisResources.resources") | ||
| 3207 | (invoke "resgen" | ||
| 3208 | "src/Compilers/CSharp/Portable/CSharpResources.resx" | ||
| 3209 | "Microsoft.CodeAnalysis.CSharp.CSharpResources.resources") | ||
| 3210 | ;; CSharpResources.Designer.cs for string constants. | ||
| 3211 | (invoke "resx2sr" "-o" | ||
| 3212 | "src/Compilers/CSharp/Portable/CSharpResources.Designer.cs" | ||
| 3213 | "-n" "Microsoft.CodeAnalysis.CSharp.CSharpResources" | ||
| 3214 | "src/Compilers/CSharp/Portable/CSharpResources.resx") | ||
| 3215 | ;; ScriptingResources.Designer.cs. | ||
| 3216 | (invoke "resx2sr" "-o" | ||
| 3217 | "src/Scripting/Core/ScriptingResources.Designer.cs" | ||
| 3218 | "-n" "Microsoft.CodeAnalysis.Scripting.ScriptingResources" | ||
| 3219 | "src/Scripting/Core/ScriptingResources.resx") | ||
| 3220 | ;; CSharpScriptingResources.Designer.cs. | ||
| 3221 | (invoke "resx2sr" "-o" | ||
| 3222 | "src/Scripting/CSharp/CSharpScriptingResources.Designer.cs" | ||
| 3223 | "-n" "Microsoft.CodeAnalysis.CSharp.Scripting.CSharpScriptingResources" | ||
| 3224 | "src/Scripting/CSharp/CSharpScriptingResources.resx"))) | ||
| 3225 | |||
| 3226 | ;; Build CSharpSyntaxGenerator from source and regenerate | ||
| 3227 | ;; the three Syntax.xml.*.Generated.cs files. The generator | ||
| 3228 | ;; reads Syntax.xml and produces C# 8 compatible output | ||
| 3229 | ;; (patched SourceWriter.cs emits casts for switch expressions | ||
| 3230 | ;; and removes TResult?/where TResult : default). | ||
| 3231 | (add-before 'compile 'generate-source | ||
| 3232 | (lambda* (#:key inputs #:allow-other-keys) | ||
| 3233 | (mkdir-p "generated") | ||
| 3234 | ;; Delete checked-in generated files; we regenerate them | ||
| 3235 | ;; with C# 8 compatible output from patched generators. | ||
| 3236 | (for-each delete-file | ||
| 3237 | (find-files "src/Compilers/CSharp/Portable/Generated" | ||
| 3238 | "\\.cs$")) | ||
| 3239 | ;; CSharpSyntaxGenerator needs 4 source files from the | ||
| 3240 | ;; compiler tree (enum/constant definitions only). | ||
| 3241 | ;; -d:NETCOREAPP is harmless here (no code gated on it | ||
| 3242 | ;; in 3.8) but needed by 3.9 where the CLI entry point | ||
| 3243 | ;; moved behind #if NETCOREAPP. Passing it here lets | ||
| 3244 | ;; 3.9 inherit this phase unchanged. | ||
| 3245 | (apply invoke "csc" "@csc.rsp" "-d:NETCOREAPP" | ||
| 3246 | "-out:generated/CSharpSyntaxGenerator.exe" | ||
| 3247 | "-r:System.dll" "-r:System.Core.dll" | ||
| 3248 | "-r:System.Xml.dll" "-r:System.Xml.Linq.dll" | ||
| 3249 | (string-append | ||
| 3250 | "-r:" (search-input-file | ||
| 3251 | inputs | ||
| 3252 | "/lib/mono/4.5/System.Collections.Immutable.dll")) | ||
| 3253 | (append | ||
| 3254 | (find-files | ||
| 3255 | "src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator" | ||
| 3256 | "\\.cs$") | ||
| 3257 | (list | ||
| 3258 | "src/Compilers/CSharp/Portable/Syntax/SyntaxKind.cs" | ||
| 3259 | "src/Compilers/CSharp/Portable/Syntax/SyntaxKindFacts.cs" | ||
| 3260 | "src/Compilers/CSharp/Portable/Declarations/DeclarationModifiers.cs" | ||
| 3261 | "src/Compilers/Core/Portable/Symbols/WellKnownMemberNames.cs"))) | ||
| 3262 | (invoke "mono" "generated/CSharpSyntaxGenerator.exe" | ||
| 3263 | "src/Compilers/CSharp/Portable/Syntax/Syntax.xml" | ||
| 3264 | "generated/") | ||
| 3265 | ;; BoundTreeGenerator. | ||
| 3266 | (apply invoke "csc" "@csc.rsp" | ||
| 3267 | "-out:generated/BoundTreeGenerator.exe" | ||
| 3268 | "-r:System.dll" "-r:System.Core.dll" | ||
| 3269 | "-r:System.Xml.dll" "-r:System.Xml.Linq.dll" | ||
| 3270 | (find-files | ||
| 3271 | "src/Tools/Source/CompilerGeneratorTools/Source/BoundTreeGenerator" | ||
| 3272 | "\\.cs$")) | ||
| 3273 | (invoke "mono" "generated/BoundTreeGenerator.exe" "CSharp" | ||
| 3274 | "src/Compilers/CSharp/Portable/BoundTree/BoundNodes.xml" | ||
| 3275 | "generated/BoundNodes.xml.Generated.cs") | ||
| 3276 | ;; CSharpErrorFactsGenerator. | ||
| 3277 | (apply invoke "csc" "@csc.rsp" | ||
| 3278 | "-out:generated/CSharpErrorFactsGenerator.exe" | ||
| 3279 | "-r:System.dll" "-r:System.Core.dll" | ||
| 3280 | (find-files | ||
| 3281 | "src/Tools/Source/CompilerGeneratorTools/Source/CSharpErrorFactsGenerator" | ||
| 3282 | "\\.cs$")) | ||
| 3283 | (invoke "mono" "generated/CSharpErrorFactsGenerator.exe" | ||
| 3284 | "src/Compilers/CSharp/Portable/Errors/ErrorCode.cs" | ||
| 3285 | "generated/ErrorFacts.Generated.cs") | ||
| 3286 | ;; CoreAssemblyLoaderImpl stub: the real implementation | ||
| 3287 | ;; uses .NET Core's AssemblyLoadContext; on Mono the | ||
| 3288 | ;; Desktop loader is used instead. | ||
| 3289 | (call-with-output-file "CoreAssemblyLoaderImpl_stub.cs" | ||
| 3290 | (lambda (port) | ||
| 3291 | (display | ||
| 3292 | "namespace Microsoft.CodeAnalysis.Scripting.Hosting { | ||
| 3293 | internal sealed class CoreAssemblyLoaderImpl : AssemblyLoaderImpl { | ||
| 3294 | internal CoreAssemblyLoaderImpl(InteractiveAssemblyLoader loader) : base(loader) | ||
| 3295 | { throw new System.PlatformNotSupportedException(); } | ||
| 3296 | public override System.Reflection.Assembly LoadFromStream(System.IO.Stream peStream, System.IO.Stream pdbStream) | ||
| 3297 | { throw new System.PlatformNotSupportedException(); } | ||
| 3298 | public override AssemblyAndLocation LoadFromPath(string assemblyFilePath) | ||
| 3299 | { throw new System.PlatformNotSupportedException(); } | ||
| 3300 | public override void Dispose() { } | ||
| 3301 | } | ||
| 3302 | } | ||
| 3303 | " port))))) | ||
| 3304 | |||
| 3305 | ;; Compile all assemblies: Core, CSharp, Scripting, | ||
| 3306 | ;; CSharp.Scripting, and csc.exe. | ||
| 3307 | (replace 'compile | ||
| 3308 | (lambda* (#:key inputs #:allow-other-keys) | ||
| 3309 | (let* ((sci-dll | ||
| 3310 | (search-input-file | ||
| 3311 | inputs "/lib/mono/4.5/System.Collections.Immutable.dll")) | ||
| 3312 | (srm-dir | ||
| 3313 | (if (file-exists? "srm-src-patched") | ||
| 3314 | "srm-src-patched" | ||
| 3315 | #$%srm-source-dir)) | ||
| 3316 | (srm-source-files | ||
| 3317 | (filter | ||
| 3318 | (lambda (f) | ||
| 3319 | (not (or (string-contains f "netstandard") | ||
| 3320 | (string-contains f "netcoreapp") | ||
| 3321 | (string-contains f "AssemblyInfo") | ||
| 3322 | (string-suffix? "/SR.cs" f)))) | ||
| 3323 | (find-files srm-dir "\\.cs$"))) | ||
| 3324 | (deps-dir | ||
| 3325 | (if (file-exists? "src/Dependencies/CodeAnalysis.Metadata") | ||
| 3326 | "src/Dependencies/CodeAnalysis.Metadata" | ||
| 3327 | "src/Dependencies/CodeAnalysis.Debugging"))) | ||
| 3328 | |||
| 3329 | ;; 1. Microsoft.CodeAnalysis.dll (Core) | ||
| 3330 | (apply invoke "csc" "@csc.rsp" "-target:library" "-unsafe" | ||
| 3331 | "-out:Microsoft.CodeAnalysis.dll" | ||
| 3332 | (string-append | ||
| 3333 | "-resource:Microsoft.CodeAnalysis.CodeAnalysisResources.resources" | ||
| 3334 | ",Microsoft.CodeAnalysis.CodeAnalysisResources.resources") | ||
| 3335 | "-r:System.dll" "-r:System.Core.dll" | ||
| 3336 | "-r:System.Xml.dll" "-r:System.Xml.Linq.dll" | ||
| 3337 | "-r:System.Numerics.dll" "-r:System.IO.Compression.dll" | ||
| 3338 | "-r:System.Security.dll" | ||
| 3339 | "-r:System.Runtime.Serialization.dll" | ||
| 3340 | (string-append "-r:" sci-dll) | ||
| 3341 | "-d:COMPILERCORE" "-d:SRM" | ||
| 3342 | "srm-strings.cs" "srm-strings-format.cs" | ||
| 3343 | "bootstrap-sr.cs" "bootstrap-resourcemanager.cs" | ||
| 3344 | "bootstrap-ivt.cs" | ||
| 3345 | "src/Compilers/Shared/CoreClrShim.cs" | ||
| 3346 | "src/Compilers/Shared/DesktopShim.cs" | ||
| 3347 | (append | ||
| 3348 | (find-files "src/Compilers/Core/Portable" "\\.cs$") | ||
| 3349 | (find-files "src/Compilers/Core/AnalyzerDriver" "\\.cs$") | ||
| 3350 | (find-files deps-dir "\\.cs$") | ||
| 3351 | (find-files "src/Dependencies/PooledObjects" "\\.cs$") | ||
| 3352 | srm-source-files)) | ||
| 3353 | |||
| 3354 | ;; 2. Microsoft.CodeAnalysis.CSharp.dll | ||
| 3355 | (apply invoke "csc" "@csc.rsp" "-target:library" "-unsafe" | ||
| 3356 | "-out:Microsoft.CodeAnalysis.CSharp.dll" | ||
| 3357 | (string-append | ||
| 3358 | "-resource:Microsoft.CodeAnalysis.CSharp.CSharpResources.resources" | ||
| 3359 | ",Microsoft.CodeAnalysis.CSharp.CSharpResources.resources") | ||
| 3360 | "-r:System.dll" "-r:System.Core.dll" | ||
| 3361 | "-r:System.Xml.dll" "-r:System.Xml.Linq.dll" | ||
| 3362 | "-r:System.Numerics.dll" "-r:System.IO.Compression.dll" | ||
| 3363 | (string-append "-r:" sci-dll) | ||
| 3364 | "-r:Microsoft.CodeAnalysis.dll" | ||
| 3365 | "bootstrap-csharp-ivt.cs" | ||
| 3366 | "src/Compilers/CSharp/CSharpAnalyzerDriver/CSharpDeclarationComputer.cs" | ||
| 3367 | (append | ||
| 3368 | (find-files "src/Compilers/CSharp/Portable" "\\.cs$") | ||
| 3369 | (if (file-exists? "generated") | ||
| 3370 | (find-files "generated" "\\.cs$") | ||
| 3371 | '()))) | ||
| 3372 | |||
| 3373 | ;; 3. Microsoft.CodeAnalysis.Scripting.dll | ||
| 3374 | (apply invoke "csc" "@csc.rsp" "-target:library" "-unsafe" | ||
| 3375 | "-d:SCRIPTING" | ||
| 3376 | "-out:Microsoft.CodeAnalysis.Scripting.dll" | ||
| 3377 | "-r:System.dll" "-r:System.Core.dll" | ||
| 3378 | "-r:System.Runtime.Serialization.dll" | ||
| 3379 | (string-append "-r:" sci-dll) | ||
| 3380 | "-r:Microsoft.CodeAnalysis.dll" | ||
| 3381 | "bootstrap-scripting-ivt.cs" | ||
| 3382 | "CoreAssemblyLoaderImpl_stub.cs" | ||
| 3383 | (append | ||
| 3384 | (filter | ||
| 3385 | ;; Exclude .NET Core-only assembly loader. | ||
| 3386 | (lambda (f) | ||
| 3387 | (not (string-suffix? "CoreAssemblyLoaderImpl.cs" f))) | ||
| 3388 | (find-files "src/Scripting/Core" "\\.cs$")) | ||
| 3389 | (find-files | ||
| 3390 | "src/Compilers/Shared/GlobalAssemblyCacheHelpers" | ||
| 3391 | "\\.cs$"))) | ||
| 3392 | |||
| 3393 | ;; 4. Microsoft.CodeAnalysis.CSharp.Scripting.dll | ||
| 3394 | (apply invoke "csc" "@csc.rsp" "-target:library" | ||
| 3395 | "-out:Microsoft.CodeAnalysis.CSharp.Scripting.dll" | ||
| 3396 | "-r:System.dll" "-r:System.Core.dll" | ||
| 3397 | (string-append "-r:" sci-dll) | ||
| 3398 | "-r:Microsoft.CodeAnalysis.dll" | ||
| 3399 | "-r:Microsoft.CodeAnalysis.CSharp.dll" | ||
| 3400 | "-r:Microsoft.CodeAnalysis.Scripting.dll" | ||
| 3401 | (find-files "src/Scripting/CSharp" "\\.cs$")) | ||
| 3402 | |||
| 3403 | ;; 5. csc.exe | ||
| 3404 | (invoke "csc" "@csc.rsp" "-out:csc.exe" | ||
| 3405 | "-r:System.dll" "-r:System.Core.dll" | ||
| 3406 | (string-append "-r:" sci-dll) | ||
| 3407 | "-r:Microsoft.CodeAnalysis.dll" | ||
| 3408 | "-r:Microsoft.CodeAnalysis.CSharp.dll" | ||
| 3409 | "src/Compilers/CSharp/csc/Program.cs" | ||
| 3410 | "src/Compilers/Shared/Csc.cs" | ||
| 3411 | "src/Compilers/Shared/BuildClient.cs" | ||
| 3412 | "src/Compilers/Shared/BuildServerConnection.cs" | ||
| 3413 | "src/Compilers/Shared/DesktopBuildClient.cs" | ||
| 3414 | "src/Compilers/Shared/DesktopAnalyzerAssemblyLoader.cs" | ||
| 3415 | "src/Compilers/Shared/ExitingTraceListener.cs" | ||
| 3416 | "src/Compilers/Shared/CoreClrShim.cs" | ||
| 3417 | "src/Compilers/Shared/DesktopShim.cs" | ||
| 3418 | "src/Compilers/Shared/NamedPipeUtil.cs" | ||
| 3419 | "src/Compilers/Shared/RuntimeHostInfo.cs" | ||
| 3420 | "src/Compilers/Core/CommandLine/BuildProtocol.cs" | ||
| 3421 | "src/Compilers/Core/CommandLine/NativeMethods.cs" | ||
| 3422 | "src/Compilers/Core/CommandLine/ConsoleUtil.cs" | ||
| 3423 | "src/Compilers/Core/CommandLine/CompilerServerLogger.cs")))) | ||
| 3424 | |||
| 3425 | ;; Install all assemblies. | ||
| 3426 | (replace 'install | ||
| 3427 | (lambda* (#:key inputs outputs #:allow-other-keys) | ||
| 3428 | (let* ((out (assoc-ref outputs "out")) | ||
| 3429 | (lib (string-append out "/lib/roslyn")) | ||
| 3430 | (bin (string-append out "/bin")) | ||
| 3431 | (sci-dll (search-input-file | ||
| 3432 | inputs | ||
| 3433 | "/lib/mono/4.5/System.Collections.Immutable.dll"))) | ||
| 3434 | (mkdir-p lib) | ||
| 3435 | (mkdir-p bin) | ||
| 3436 | (for-each | ||
| 3437 | (lambda (f) (install-file f lib)) | ||
| 3438 | '("csc.exe" | ||
| 3439 | "Microsoft.CodeAnalysis.dll" | ||
| 3440 | "Microsoft.CodeAnalysis.CSharp.dll" | ||
| 3441 | "Microsoft.CodeAnalysis.Scripting.dll" | ||
| 3442 | "Microsoft.CodeAnalysis.CSharp.Scripting.dll")) | ||
| 3443 | (symlink sci-dll | ||
| 3444 | (string-append lib "/System.Collections.Immutable.dll")) | ||
| 3445 | (call-with-output-file (string-append bin "/csc") | ||
| 3446 | (lambda (port) | ||
| 3447 | (format port "#!~a~%exec mono ~a/csc.exe \"$@\"~%" | ||
| 3448 | (search-input-file inputs "/bin/bash") lib))) | ||
| 3449 | (chmod (string-append bin "/csc") #o755)))))))) | ||
| 3450 | (synopsis "C# 9.0 compiler and scripting libraries, bootstrapped from source") | ||
| 3451 | (description | ||
| 3452 | "This package provides the Roslyn C# compiler (@command{csc}) and | ||
| 3453 | scripting libraries, built from source using @code{roslyn-3.2} as the | ||
| 3454 | bootstrap compiler. It produces a C# 9.0 compiler matching Mono 6.12."))) | ||
| 3455 | |||
| 3456 | (define roslyn roslyn-3.8) | ||
| 3457 | |||
| 3013 | ;; too new version: 15.9.21.664 | 3458 | ;; too new version: 15.9.21.664 |
| 3014 | ;; too old (no support for mono) version: 14.0 | 3459 | ;; too old (no support for mono) version: 14.0 |
| 3015 | (define-public msbuild | 3460 | (define-public msbuild |
