diff options
| author | Danny Milosavljevic <dannym@friendly-machines.com> | 2026-04-08 02:46:48 +0200 |
|---|---|---|
| committer | Danny Milosavljevic <dannym@friendly-machines.com> | 2026-07-17 01:41:56 +0200 |
| commit | 0648b5020f856216e4ee9daf7bc35a89e8fc0f00 (patch) | |
| tree | 2d2beec48cdd63e5a58167f477ac9cdc5cc71cdc /gnu/packages/dotnet.scm | |
| parent | ba2e09c171a317c3e84cbf2f5149c1132b9e341f (diff) | |
gnu: Add roslyn@2.0.
* gnu/packages/patches/roslyn-2.0.0-bootstrap-with-mono.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add reference to it.
* gnu/packages/dotnet.scm (%srm-source-dir): New variable.
(%roslyn-stale-files): New variable.
(roslyn-2.0): New variable.
Change-Id: I4d7f7e2ab8a4d0c2792d9ad74501592fe60b1bd3
Diffstat (limited to 'gnu/packages/dotnet.scm')
| -rw-r--r-- | gnu/packages/dotnet.scm | 400 |
1 files changed, 400 insertions, 0 deletions
diff --git a/gnu/packages/dotnet.scm b/gnu/packages/dotnet.scm index 9a3446af24b..af89d4580f7 100644 --- a/gnu/packages/dotnet.scm +++ b/gnu/packages/dotnet.scm | |||
| @@ -2161,6 +2161,406 @@ the source code included within the Mono source tree.") | |||
| 2161 | (home-page "https://dot.net/") | 2161 | (home-page "https://dot.net/") |
| 2162 | (license license:expat)))) | 2162 | (license license:expat)))) |
| 2163 | 2163 | ||
| 2164 | ;;; | ||
| 2165 | ;;; Bootstrap chain: mcs -> csc 2.0 (C# 7.0) -> csc 2.3 (C# 7.1) -> csc 2.8 (C# 7.2) | ||
| 2166 | ;;; | ||
| 2167 | |||
| 2168 | (define %srm-source-dir | ||
| 2169 | (file-append (package-source mono-bootstrap) | ||
| 2170 | "/external/corefx/src/System.Reflection.Metadata/src")) | ||
| 2171 | |||
| 2172 | (define %roslyn-stale-files | ||
| 2173 | '("src/Compilers/Core/Portable/TextLineSpan.cs" | ||
| 2174 | "src/Compilers/Core/Portable/Serialization/SimpleRecordingObjectBinder.cs" | ||
| 2175 | "src/Compilers/Core/Portable/System/Reflection/BlobBuilder.cs" | ||
| 2176 | "src/Compilers/Core/Portable/System/Reflection/BlobWriter.cs" | ||
| 2177 | "src/Compilers/Core/Portable/System/Reflection/Internal/Utilities/BlobUtilities.cs" | ||
| 2178 | "src/Compilers/Core/Portable/System/Reflection/Metadata/Ecma335/MetadataBuilder.Tables.cs" | ||
| 2179 | "src/Compilers/Core/Portable/System/Reflection/Metadata/Ecma335/MetadataBuilder.Heaps.cs" | ||
| 2180 | "src/Compilers/Core/Portable/NativePdbWriter/IUnsafeComStream.cs" | ||
| 2181 | "src/Compilers/Core/Portable/NativePdbWriter/ComMemoryStream.cs" | ||
| 2182 | "src/Compilers/CSharp/Portable/FlowAnalysis/AbstractFlowPass.AbstractLocalState.cs" | ||
| 2183 | "src/Compilers/CSharp/Portable/Compiler/Compiler.cs" | ||
| 2184 | "src/Compilers/CSharp/Portable/Lowering/TempHelpers.cs" | ||
| 2185 | "src/Compilers/CSharp/Portable/Lowering/StateMachineRewriter/StateMachineHoistedLocalSymbol.cs")) | ||
| 2186 | |||
| 2187 | |||
| 2188 | ;;; | ||
| 2189 | ;;; roslyn-2.0: bootstrapped from Mono's mcs | ||
| 2190 | ;;; | ||
| 2191 | |||
| 2192 | (define-public roslyn-2.0 | ||
| 2193 | (package | ||
| 2194 | (name "roslyn") | ||
| 2195 | (version "2.0.0") | ||
| 2196 | (source | ||
| 2197 | (origin | ||
| 2198 | (method git-fetch) | ||
| 2199 | (uri (git-reference | ||
| 2200 | (url "https://github.com/dotnet/roslyn") | ||
| 2201 | (commit (string-append "version-" version)))) | ||
| 2202 | (file-name (git-file-name name version)) | ||
| 2203 | (sha256 | ||
| 2204 | (base32 | ||
| 2205 | "1gimga04ripx5znkh6gxr9k7179n032mcvl9w7wc2rfx7wrnly4a")) | ||
| 2206 | (patches | ||
| 2207 | (search-patches "roslyn-2.0.0-bootstrap-with-mono.patch")))) | ||
| 2208 | (build-system gnu-build-system) | ||
| 2209 | (inputs (list bash-minimal | ||
| 2210 | mono-bootstrap | ||
| 2211 | mono-system-collections-immutable-bootstrap)) | ||
| 2212 | (arguments | ||
| 2213 | (list | ||
| 2214 | #:tests? #f | ||
| 2215 | #:modules '((guix build gnu-build-system) | ||
| 2216 | (guix build utils) | ||
| 2217 | (ice-9 rdelim)) | ||
| 2218 | #:phases | ||
| 2219 | #~(modify-phases %standard-phases | ||
| 2220 | ;; mcs-specific workarounds. | ||
| 2221 | (add-after 'unpack 'fix-compiler-compat | ||
| 2222 | (lambda _ | ||
| 2223 | ;; mcs crashes on "is null" at emit time in yield methods. | ||
| 2224 | (for-each | ||
| 2225 | (lambda (file) | ||
| 2226 | (substitute* file ((" is null") | ||
| 2227 | " == null"))) | ||
| 2228 | (append | ||
| 2229 | (find-files "src/Compilers/Core/Portable" "\\.cs$") | ||
| 2230 | (find-files "src/Compilers/Core/AnalyzerDriver" "\\.cs$") | ||
| 2231 | (find-files "src/Compilers/CSharp/Portable" "\\.cs$") | ||
| 2232 | (find-files "src/Compilers/Shared" "\\.cs$") | ||
| 2233 | (find-files "src/Dependencies" "\\.cs$"))) | ||
| 2234 | ;; mcs crashes emitting "out var" inside yield methods. | ||
| 2235 | (substitute* | ||
| 2236 | "src/Dependencies/CodeAnalysis.Metadata/CustomDebugInfoReader.cs" | ||
| 2237 | (("out var globalVersion, out var globalCount") | ||
| 2238 | "out byte globalVersion, out byte globalCount") | ||
| 2239 | (("out var version, out var kind, out var size, out var alignmentSize") | ||
| 2240 | "out byte version, out CustomDebugInfoKind kind, out int size, out int alignmentSize") | ||
| 2241 | (("out var tempMethodToken") | ||
| 2242 | "out int tempMethodToken")) | ||
| 2243 | (substitute* "src/Dependencies/PooledObjects/ArrayBuilder.cs" | ||
| 2244 | (("out var bucket") "out ArrayBuilder<T> bucket")) | ||
| 2245 | ;; mcs does not track definite assignment through "?.". | ||
| 2246 | (substitute* | ||
| 2247 | "src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs" | ||
| 2248 | (("GlobalExpressionVariable field;") | ||
| 2249 | "GlobalExpressionVariable field = null;")))) | ||
| 2250 | |||
| 2251 | ;; Mono mscorlib compatibility (shared by all versions). | ||
| 2252 | (add-after 'fix-compiler-compat 'fix-mono-compat | ||
| 2253 | (lambda _ | ||
| 2254 | (substitute* | ||
| 2255 | "src/Compilers/Core/Portable/InternalUtilities/KeyValuePair.cs" | ||
| 2256 | (("static class KeyValuePair") | ||
| 2257 | "static class KeyValuePairUtil")) | ||
| 2258 | (for-each | ||
| 2259 | (lambda (file) | ||
| 2260 | (substitute* file | ||
| 2261 | (("KeyValuePair\\.Create") "KeyValuePairUtil.Create"))) | ||
| 2262 | (append | ||
| 2263 | (find-files "src/Compilers/Core/Portable" "\\.cs$") | ||
| 2264 | (find-files "src/Compilers/CSharp/Portable" "\\.cs$"))) | ||
| 2265 | (substitute* "src/Compilers/Core/Portable/EncodedStringText.cs" | ||
| 2266 | (("if \\(CodePagesEncodingProvider\\.Instance != null\\)") | ||
| 2267 | "if (false)") | ||
| 2268 | (("Encoding\\.RegisterProvider\\(CodePagesEncodingProvider\\.Instance\\);") | ||
| 2269 | "// not available in Mono")))) | ||
| 2270 | |||
| 2271 | ;; SRM inline compilation conflicts (shared by all versions). | ||
| 2272 | (add-after 'fix-mono-compat 'fix-srm-inline | ||
| 2273 | (lambda _ | ||
| 2274 | (substitute* | ||
| 2275 | "src/Compilers/Core/Portable/Emit/EditAndContinue/DeltaMetadataWriter.cs" | ||
| 2276 | (("var writer = PooledBlobBuilder") | ||
| 2277 | "var writer = Microsoft.Cci.PooledBlobBuilder")) | ||
| 2278 | (substitute* (list | ||
| 2279 | "src/Compilers/Core/Portable/Compilation/Compilation.cs" | ||
| 2280 | "src/Compilers/Core/Portable/StrongName/StrongNameProvider.cs") | ||
| 2281 | (("\\bPathUtilities\\.") | ||
| 2282 | "Roslyn.Utilities.PathUtilities.")) | ||
| 2283 | (substitute* "src/Compilers/Core/Portable/PEWriter/PeWriter.cs" | ||
| 2284 | (("protected override void Serialize\\(BlobBuilder builder, SectionLocation location\\)") | ||
| 2285 | "protected internal override void Serialize(BlobBuilder builder, SectionLocation location)")))) | ||
| 2286 | |||
| 2287 | (add-after 'fix-srm-inline 'remove-stale-files | ||
| 2288 | (lambda _ | ||
| 2289 | (for-each | ||
| 2290 | (lambda (f) (when (file-exists? f) (delete-file f))) | ||
| 2291 | '#$%roslyn-stale-files))) | ||
| 2292 | |||
| 2293 | ;; ComMemoryStream is used by the Windows native PDB writer. | ||
| 2294 | ;; On Linux we never write native PDBs, but the type must | ||
| 2295 | ;; exist for compilation. | ||
| 2296 | (add-after 'remove-stale-files 'create-com-memory-stream-stub | ||
| 2297 | (lambda _ | ||
| 2298 | (call-with-output-file | ||
| 2299 | "src/Compilers/Core/Portable/NativePdbWriter/ComMemoryStream.cs" | ||
| 2300 | (lambda (port) | ||
| 2301 | (display | ||
| 2302 | "using System; using System.IO; | ||
| 2303 | namespace Roslyn.Utilities | ||
| 2304 | { | ||
| 2305 | internal sealed class ComMemoryStream : Stream | ||
| 2306 | { | ||
| 2307 | public override bool CanRead => false; | ||
| 2308 | public override bool CanSeek => true; | ||
| 2309 | public override bool CanWrite => true; | ||
| 2310 | public override long Length => _length; | ||
| 2311 | public override long Position { get; set; } | ||
| 2312 | private long _length; | ||
| 2313 | public override void Flush() {} | ||
| 2314 | public override int Read(byte[] b, int o, int c) | ||
| 2315 | => throw new NotSupportedException(); | ||
| 2316 | public override long Seek(long o, SeekOrigin so) => 0; | ||
| 2317 | public override void SetLength(long v) { _length = v; } | ||
| 2318 | public override void Write(byte[] b, int o, int c) {} | ||
| 2319 | internal byte[] GetChunks() => Array.Empty<byte>(); | ||
| 2320 | } | ||
| 2321 | } | ||
| 2322 | " port))))) | ||
| 2323 | |||
| 2324 | (delete 'configure) | ||
| 2325 | |||
| 2326 | ;; Create a compiler wrapper so the build phase can use "csc" | ||
| 2327 | ;; uniformly. Inherited versions replace this phase to point | ||
| 2328 | ;; at the previously-built csc instead of mcs. | ||
| 2329 | (add-before 'build 'create-csc-wrapper | ||
| 2330 | (lambda _ | ||
| 2331 | (mkdir-p "bootstrap-bin") | ||
| 2332 | (call-with-output-file "bootstrap-bin/csc" | ||
| 2333 | (lambda (port) | ||
| 2334 | (format port "#!~a~%exec mcs -langversion:7.2 \"$@\"~%" | ||
| 2335 | (which "bash")))) | ||
| 2336 | (chmod "bootstrap-bin/csc" #o755) | ||
| 2337 | (setenv "PATH" | ||
| 2338 | (string-append (getcwd) "/bootstrap-bin:" | ||
| 2339 | (getenv "PATH"))))) | ||
| 2340 | |||
| 2341 | ;; Response file for additional compiler flags. Empty by | ||
| 2342 | ;; default; roslyn-2.8 replaces this to add -langversion:7.1. | ||
| 2343 | (add-before 'build 'create-csc-rsp | ||
| 2344 | (lambda _ | ||
| 2345 | (call-with-output-file "csc.rsp" | ||
| 2346 | (lambda (port) #t)))) | ||
| 2347 | |||
| 2348 | ;; Generate bootstrap support files (SR class, IVT, .resources). | ||
| 2349 | (replace 'build | ||
| 2350 | (lambda _ | ||
| 2351 | ;; Bootstrap SR class from SRM string resources. | ||
| 2352 | (invoke "resx2sr" "-o" "srm-strings.cs" "-n" "System.SR" | ||
| 2353 | "--warn-mismatch" | ||
| 2354 | (string-append #$%srm-source-dir "/Resources/Strings.resx")) | ||
| 2355 | (call-with-output-file "bootstrap-sr.cs" | ||
| 2356 | (lambda (port) | ||
| 2357 | (display | ||
| 2358 | "namespace System | ||
| 2359 | { | ||
| 2360 | internal class SR | ||
| 2361 | { | ||
| 2362 | internal static string Format(string f, object a0) => string.Format(f, a0); | ||
| 2363 | internal static string Format(string f, object a0, object a1) => string.Format(f, a0, a1); | ||
| 2364 | internal static string Format(string f, object a0, object a1, object a2) => string.Format(f, a0, a1, a2); | ||
| 2365 | internal static string Format(string f, params object[] args) => string.Format(f, args); | ||
| 2366 | " port) | ||
| 2367 | (call-with-input-file "srm-strings.cs" | ||
| 2368 | (lambda (in) | ||
| 2369 | (let loop () | ||
| 2370 | (let ((line (read-line in))) | ||
| 2371 | (unless (eof-object? line) | ||
| 2372 | (when (string-contains line "public const") | ||
| 2373 | (display line port) | ||
| 2374 | (newline port)) | ||
| 2375 | (loop)))))) | ||
| 2376 | (display " }\n}\n" port))) | ||
| 2377 | ;; InternalsVisibleTo attributes. | ||
| 2378 | (call-with-output-file "bootstrap-ivt.cs" | ||
| 2379 | (lambda (port) | ||
| 2380 | (display | ||
| 2381 | "using System.Runtime.CompilerServices; | ||
| 2382 | [assembly: InternalsVisibleTo(\"Microsoft.CodeAnalysis.CSharp\")] | ||
| 2383 | [assembly: InternalsVisibleTo(\"csc\")] | ||
| 2384 | [assembly: InternalsVisibleTo(\"Microsoft.CodeAnalysis.CompilerServer\")] | ||
| 2385 | [assembly: InternalsVisibleTo(\"VBCSCompiler\")] | ||
| 2386 | " port))) | ||
| 2387 | (call-with-output-file "bootstrap-csharp-ivt.cs" | ||
| 2388 | (lambda (port) | ||
| 2389 | (format port | ||
| 2390 | "using System.Runtime.CompilerServices; | ||
| 2391 | using System.Reflection; | ||
| 2392 | [assembly: InternalsVisibleTo(\"csc\")] | ||
| 2393 | [assembly: AssemblyVersion(\"~a.0\")] | ||
| 2394 | [assembly: AssemblyFileVersion(\"~a.0\")] | ||
| 2395 | [assembly: AssemblyInformationalVersion(\"~a\")] | ||
| 2396 | " #$(package-version this-package) #$(package-version this-package) #$(package-version this-package)))) | ||
| 2397 | ;; .resources from .resx. | ||
| 2398 | (invoke "resgen" | ||
| 2399 | "src/Compilers/Core/Portable/CodeAnalysisResources.resx" | ||
| 2400 | "Microsoft.CodeAnalysis.CodeAnalysisResources.resources") | ||
| 2401 | (invoke "resgen" | ||
| 2402 | "src/Compilers/CSharp/Portable/CSharpResources.resx" | ||
| 2403 | "Microsoft.CodeAnalysis.CSharp.CSharpResources.resources"))) | ||
| 2404 | |||
| 2405 | ;; Build code generators from XML and run them. | ||
| 2406 | ;; roslyn-2.8 deletes this phase (uses checked-in generated files). | ||
| 2407 | (add-after 'build 'generate-source | ||
| 2408 | (lambda _ | ||
| 2409 | (mkdir-p "generated") | ||
| 2410 | (apply invoke "csc" "@csc.rsp" | ||
| 2411 | "-out:generated/CSharpSyntaxGenerator.exe" | ||
| 2412 | "-r:System.dll" "-r:System.Core.dll" | ||
| 2413 | "-r:System.Xml.dll" "-r:System.Xml.Linq.dll" | ||
| 2414 | (find-files | ||
| 2415 | "src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator" | ||
| 2416 | "\\.cs$")) | ||
| 2417 | (invoke "mono" "generated/CSharpSyntaxGenerator.exe" | ||
| 2418 | "src/Compilers/CSharp/Portable/Syntax/Syntax.xml" | ||
| 2419 | "generated/") | ||
| 2420 | (apply invoke "csc" "@csc.rsp" | ||
| 2421 | "-out:generated/BoundTreeGenerator.exe" | ||
| 2422 | "-r:System.dll" "-r:System.Core.dll" | ||
| 2423 | "-r:System.Xml.dll" "-r:System.Xml.Linq.dll" | ||
| 2424 | (find-files | ||
| 2425 | "src/Tools/Source/CompilerGeneratorTools/Source/BoundTreeGenerator" | ||
| 2426 | "\\.cs$")) | ||
| 2427 | (invoke "mono" "generated/BoundTreeGenerator.exe" "CSharp" | ||
| 2428 | "src/Compilers/CSharp/Portable/BoundTree/BoundNodes.xml" | ||
| 2429 | "generated/BoundNodes.xml.Generated.cs") | ||
| 2430 | (apply invoke "csc" "@csc.rsp" | ||
| 2431 | "-out:generated/CSharpErrorFactsGenerator.exe" | ||
| 2432 | "-r:System.dll" "-r:System.Core.dll" | ||
| 2433 | (find-files | ||
| 2434 | "src/Tools/Source/CompilerGeneratorTools/Source/CSharpErrorFactsGenerator" | ||
| 2435 | "\\.cs$")) | ||
| 2436 | (invoke "mono" "generated/CSharpErrorFactsGenerator.exe" | ||
| 2437 | "src/Compilers/CSharp/Portable/Errors/ErrorCode.cs" | ||
| 2438 | "generated/ErrorFacts.Generated.cs"))) | ||
| 2439 | |||
| 2440 | ;; Prepare SRM source for inline compilation. | ||
| 2441 | ;; roslyn-2.0 uses the original source (mcs handles C# 7.2). | ||
| 2442 | ;; roslyn-2.3 and roslyn-2.8 replace this to copy+patch for | ||
| 2443 | ;; C# 7.2 -> 7.0/7.1 downgrades. | ||
| 2444 | (add-after 'generate-source 'prepare-srm-source | ||
| 2445 | (lambda _ #t)) | ||
| 2446 | |||
| 2447 | ;; Compile the three assemblies. | ||
| 2448 | (add-after 'prepare-srm-source 'compile | ||
| 2449 | (lambda* (#:key inputs #:allow-other-keys) | ||
| 2450 | (let* ((sci-dll | ||
| 2451 | (search-input-file | ||
| 2452 | inputs "/lib/mono/4.5/System.Collections.Immutable.dll")) | ||
| 2453 | (srm-dir | ||
| 2454 | (if (file-exists? "srm-src-patched") | ||
| 2455 | "srm-src-patched" | ||
| 2456 | #$%srm-source-dir)) | ||
| 2457 | (srm-source-files | ||
| 2458 | (filter | ||
| 2459 | (lambda (f) | ||
| 2460 | (not (or (string-contains f "netstandard") | ||
| 2461 | (string-contains f "netcoreapp") | ||
| 2462 | (string-contains f "AssemblyInfo") | ||
| 2463 | (string-suffix? "/SR.cs" f)))) | ||
| 2464 | (find-files srm-dir "\\.cs$"))) | ||
| 2465 | (deps-dir | ||
| 2466 | (if (file-exists? "src/Dependencies/CodeAnalysis.Metadata") | ||
| 2467 | "src/Dependencies/CodeAnalysis.Metadata" | ||
| 2468 | "src/Dependencies/CodeAnalysis.Debugging"))) | ||
| 2469 | |||
| 2470 | ;; 1. Microsoft.CodeAnalysis.dll | ||
| 2471 | (apply invoke "csc" "@csc.rsp" "-target:library" "-unsafe" | ||
| 2472 | "-out:Microsoft.CodeAnalysis.dll" | ||
| 2473 | (string-append | ||
| 2474 | "-resource:Microsoft.CodeAnalysis.CodeAnalysisResources.resources" | ||
| 2475 | ",Microsoft.CodeAnalysis.CodeAnalysisResources.resources") | ||
| 2476 | "-r:System.dll" "-r:System.Core.dll" | ||
| 2477 | "-r:System.Xml.dll" "-r:System.Xml.Linq.dll" | ||
| 2478 | "-r:System.Numerics.dll" "-r:System.IO.Compression.dll" | ||
| 2479 | "-r:System.Security.dll" | ||
| 2480 | "-r:System.Runtime.Serialization.dll" | ||
| 2481 | (string-append "-r:" sci-dll) | ||
| 2482 | "-d:COMPILERCORE" "-d:SRM" | ||
| 2483 | "bootstrap-sr.cs" "bootstrap-ivt.cs" | ||
| 2484 | "src/Compilers/Shared/CoreClrShim.cs" | ||
| 2485 | "src/Compilers/Shared/DesktopShim.cs" | ||
| 2486 | (append | ||
| 2487 | (find-files "src/Compilers/Core/Portable" "\\.cs$") | ||
| 2488 | (find-files "src/Compilers/Core/AnalyzerDriver" "\\.cs$") | ||
| 2489 | (find-files deps-dir "\\.cs$") | ||
| 2490 | (find-files "src/Dependencies/PooledObjects" "\\.cs$") | ||
| 2491 | srm-source-files)) | ||
| 2492 | |||
| 2493 | ;; 2. Microsoft.CodeAnalysis.CSharp.dll | ||
| 2494 | (apply invoke "csc" "@csc.rsp" "-target:library" "-unsafe" | ||
| 2495 | "-out:Microsoft.CodeAnalysis.CSharp.dll" | ||
| 2496 | (string-append | ||
| 2497 | "-resource:Microsoft.CodeAnalysis.CSharp.CSharpResources.resources" | ||
| 2498 | ",Microsoft.CodeAnalysis.CSharp.CSharpResources.resources") | ||
| 2499 | "-r:System.dll" "-r:System.Core.dll" | ||
| 2500 | "-r:System.Xml.dll" "-r:System.Xml.Linq.dll" | ||
| 2501 | "-r:System.Numerics.dll" "-r:System.IO.Compression.dll" | ||
| 2502 | (string-append "-r:" sci-dll) | ||
| 2503 | "-r:Microsoft.CodeAnalysis.dll" | ||
| 2504 | "bootstrap-csharp-ivt.cs" | ||
| 2505 | "src/Compilers/CSharp/CSharpAnalyzerDriver/CSharpDeclarationComputer.cs" | ||
| 2506 | (append | ||
| 2507 | (find-files "src/Compilers/CSharp/Portable" "\\.cs$") | ||
| 2508 | ;; Generated source files (from generate-source phase | ||
| 2509 | ;; or checked into the source tree). | ||
| 2510 | (if (file-exists? "generated") | ||
| 2511 | (find-files "generated" "\\.cs$") | ||
| 2512 | '()))) | ||
| 2513 | |||
| 2514 | ;; 3. csc.exe | ||
| 2515 | (invoke "csc" "@csc.rsp" "-out:csc.exe" | ||
| 2516 | "-r:System.dll" "-r:System.Core.dll" | ||
| 2517 | (string-append "-r:" sci-dll) | ||
| 2518 | "-r:Microsoft.CodeAnalysis.dll" | ||
| 2519 | "-r:Microsoft.CodeAnalysis.CSharp.dll" | ||
| 2520 | "src/Compilers/CSharp/csc/Program.cs" | ||
| 2521 | "src/Compilers/Shared/Csc.cs" | ||
| 2522 | "src/Compilers/Shared/BuildClient.cs" | ||
| 2523 | "src/Compilers/Shared/BuildServerConnection.cs" | ||
| 2524 | "src/Compilers/Shared/DesktopBuildClient.cs" | ||
| 2525 | "src/Compilers/Shared/DesktopAnalyzerAssemblyLoader.cs" | ||
| 2526 | "src/Compilers/Shared/ExitingTraceListener.cs" | ||
| 2527 | "src/Compilers/Shared/CoreClrShim.cs" | ||
| 2528 | "src/Compilers/Shared/DesktopShim.cs" | ||
| 2529 | "src/Compilers/Core/CommandLine/BuildProtocol.cs" | ||
| 2530 | "src/Compilers/Core/CommandLine/NativeMethods.cs" | ||
| 2531 | "src/Compilers/Core/CommandLine/ConsoleUtil.cs" | ||
| 2532 | "src/Compilers/Core/CommandLine/CompilerServerLogger.cs")))) | ||
| 2533 | |||
| 2534 | (replace 'install | ||
| 2535 | (lambda* (#:key inputs outputs #:allow-other-keys) | ||
| 2536 | (let* ((out (assoc-ref outputs "out")) | ||
| 2537 | (lib (string-append out "/lib/roslyn")) | ||
| 2538 | (bin (string-append out "/bin")) | ||
| 2539 | (sci-dll (search-input-file | ||
| 2540 | inputs | ||
| 2541 | "/lib/mono/4.5/System.Collections.Immutable.dll"))) | ||
| 2542 | (mkdir-p lib) | ||
| 2543 | (mkdir-p bin) | ||
| 2544 | (install-file "csc.exe" lib) | ||
| 2545 | (install-file "Microsoft.CodeAnalysis.dll" lib) | ||
| 2546 | (install-file "Microsoft.CodeAnalysis.CSharp.dll" lib) | ||
| 2547 | (symlink sci-dll | ||
| 2548 | (string-append lib "/System.Collections.Immutable.dll")) | ||
| 2549 | (call-with-output-file (string-append bin "/csc") | ||
| 2550 | (lambda (port) | ||
| 2551 | (format port "#!~a~%exec ~a ~a/csc.exe \"$@\"~%" | ||
| 2552 | (search-input-file inputs "/bin/bash") | ||
| 2553 | (search-input-file inputs "/bin/mono") | ||
| 2554 | lib))) | ||
| 2555 | (chmod (string-append bin "/csc") #o755))))))) | ||
| 2556 | (home-page "https://github.com/dotnet/roslyn") | ||
| 2557 | (synopsis "C# 7.0 compiler bootstrapped from source with Mono") | ||
| 2558 | (description | ||
| 2559 | "This package provides the Roslyn C# compiler (@command{csc}), built | ||
| 2560 | 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.") | ||
| 2562 | (license license:asl2.0) | ||
| 2563 | (properties '((hidden? #t))))) | ||
| 2164 | ;; too new version: 15.9.21.664 | 2564 | ;; too new version: 15.9.21.664 |
| 2165 | ;; too old (no support for mono) version: 14.0 | 2565 | ;; too old (no support for mono) version: 14.0 |
| 2166 | (define-public msbuild | 2566 | (define-public msbuild |
