projects/guix·blob javascript-team · refs

4278 lines · 222.7 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2024 unmush <[email protected]>
3;;; Copyright © 2024 Efraim Flashner <[email protected]>
4;;; Copyright © 2025 Danny Milosavljevic <[email protected]>
5;;; Copyright © 2025 nomike <[email protected]>
6;;;
7;;; This file is part of GNU Guix.
8;;;
9;;; GNU Guix is free software; you can redistribute it and/or modify it
10;;; under the terms of the GNU General Public License as published by
11;;; the Free Software Foundation; either version 3 of the License, or (at
12;;; your option) any later version.
13;;;
14;;; GNU Guix is distributed in the hope that it will be useful, but
15;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;;; GNU General Public License for more details.
18;;;
19;;; You should have received a copy of the GNU General Public License
20;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22(define-module (gnu packages dotnet)
23 #:use-module ((guix licenses) #:prefix license:)
24 #:use-module (gnu packages assembly)
25 #:use-module (gnu packages bash)
26 #:use-module (gnu packages bison)
27 #:use-module (gnu packages check)
28 #:use-module (gnu packages cmake)
29 #:use-module (gnu packages compression)
30 #:use-module (gnu packages curl)
31 #:use-module (gnu packages databases)
32 #:use-module (gnu packages compiler-tools)
33 #:use-module (gnu packages gettext)
34 #:use-module (gnu packages pkg-config)
35 #:use-module (gnu packages base)
36 #:use-module (gnu packages autotools)
37 #:use-module (gnu packages bdw-gc)
38 #:use-module (gnu packages fontutils)
39 #:use-module (gnu packages glib)
40 #:use-module (gnu packages icu4c)
41 #:use-module (gnu packages instrumentation)
42 #:use-module (gnu packages kerberos)
43 #:use-module (gnu packages libffi)
44 #:use-module (gnu packages linux)
45 #:use-module (gnu packages llvm)
46 #:use-module (gnu packages perl)
47 #:use-module (gnu packages photo)
48 #:use-module (gnu packages texinfo)
49 #:use-module (gnu packages tls)
50 #:use-module (gnu packages image)
51 #:use-module (gnu packages gtk)
52 #:use-module (gnu packages python)
53 #:use-module (gnu packages xml)
54 #:use-module (gnu packages xorg)
55 #:use-module (gnu packages version-control)
56 #:use-module (gnu packages)
57 #:use-module (guix modules)
58 #:use-module (guix packages)
59 #:use-module (guix download)
60 #:use-module (guix git-download)
61 #:use-module (guix gexp)
62 #:use-module (guix utils)
63 #:use-module (guix build-system cmake)
64 #:use-module (guix build-system gnu)
65 #:use-module (guix build-system trivial)
66 #:use-module (ice-9 match))
67
68(define-public treecc
69 (package
70 (name "treecc")
71 (version "0.3.10")
72 (source (origin
73 (method url-fetch)
74 (uri (string-append
75 "mirror://savannah/dotgnu-pnet/treecc-" version ".tar.gz"))
76 (sha256
77 (base32
78 "1rzgnspg2xccdq3qsx0vi3j28h4qkrzbrjnhzvnny34fjfk217ay"))))
79 (build-system gnu-build-system)
80 (home-page "https://www.gnu.org/software/dotgnu/")
81 (synopsis "Tree Compiler-Compiler")
82 (description "The treecc program is designed to assist in the development
83of compilers and other language-based tools. It manages the generation of
84code to handle abstract syntax trees and operations upon the trees.")
85 (license license:gpl2+)))
86
87;; Several improvements occurred past the 0.8.0 release that make it
88;; easier to bootstrap mono.
89(define-public pnet-git
90 (let ((commit "3baf94734d8dc3fdabba68a8891e67a43ed6c4bd")
91 (version "0.8.0")
92 (revision "0"))
93 (package
94 (name "pnet-git")
95 (version (git-version version revision commit))
96 (source (origin
97 (method git-fetch)
98 (uri (git-reference
99 (url "https://git.savannah.gnu.org/git/dotgnu-pnet/pnet.git")
100 (commit commit)))
101 (file-name (git-file-name name version))
102 (sha256
103 (base32
104 "0vznvrgz8l0mpib1rz5v3clr7cn570vyp80f7f1jvzivnc1imzn6"))
105 (modules '((guix build utils)))
106 (snippet
107 #~(begin
108 (for-each delete-file-recursively '("libffi" "libgc"))
109 (for-each delete-file
110 (append
111 (filter file-exists?
112 '("compile"
113 "configure"
114 "config.guess"
115 "config.sub"
116 "depcomp"
117 "install-sh"
118 "ltconfig"
119 "ltcf-c.sh"
120 "ltmain.sh"))
121 (find-files "." "Makefile(\\.in)?$")
122 (find-files "." "_(grammar|scanner)\\.(c|h)$")))
123 ;; Fix to not require bundled dependencies
124 (substitute* "configure.in"
125 (("GCLIBS='.*libgc.a'") "GCLIBS='-lgc'")
126 ;; AC_SEARCH_LIBJIT checks hardcoded header locations
127 (("search_libjit=true")
128 (string-append "search_libjit=false\n"
129 "JIT_LIBS=-ljit")))
130 (substitute* "Makefile.am"
131 (("OPT_SUBDIRS \\+= lib.*") ""))
132 (substitute* "support/hb_gc.c"
133 (("#include .*/libgc/include/gc.h.")
134 "#include <gc.h>")
135 (("#include .*/libgc/include/gc_typed.h.")
136 "#include <gc/gc_typed.h>"))
137 (substitute* (list "codegen/Makefile.am"
138 "cscc/bf/Makefile.am"
139 "cscc/csharp/Makefile.am"
140 "cscc/c/Makefile.am"
141 "cscc/java/Makefile.am")
142 ;; Generated files aren't prerequisites
143 (("TREECC_OUTPUT =.*") ""))
144 (substitute* "cscc/csharp/cs_grammar.y"
145 (("YYLEX") "yylex()"))
146 (substitute* "cscc/common/cc_main.h"
147 (("CCPreProc CCPreProcessorStream;" all)
148 (string-append "extern " all)))
149 (substitute* "csdoc/scanner.c"
150 (("int\ttoken;" all)
151 (string-append "extern " all)))
152 (substitute* "doc/cvmdoc.py"
153 (("python1.5")
154 "python"))
155 (substitute* "profiles/full"
156 ;; If this is left unmodified, it causes a segfault in
157 ;; pnetlib's tests. Unrollers are somewhat
158 ;; architecture-specific anyway, and it will fall back
159 ;; to using GNU C's labels-as-values feature (it can be
160 ;; made to further fall back to fully
161 ;; standards-portable interpreter implementations).
162 (("IL_CONFIG_UNROLL=y")
163 "IL_CONFIG_UNROLL=n"))))
164 (patches (search-patches "pnet-newer-libgc-fix.patch"
165 "pnet-newer-texinfo-fix.patch"
166 "pnet-fix-line-number-info.patch"
167 "pnet-fix-off-by-one.patch"))))
168 (build-system gnu-build-system)
169 (native-inputs
170 (list autoconf
171 automake
172 bison
173 flex
174 libatomic-ops
175 libtool
176 python-minimal-wrapper
177 texinfo
178 treecc))
179 (inputs
180 (cons* libffi
181 libgc
182 (if (supported-package? libjit)
183 (list libjit)
184 '())))
185 (arguments
186 (append (if (this-package-input "libjit")
187 (list #:configure-flags #~(list "--with-jit"))
188 '())
189 (list #:make-flags
190 #~(list (string-append
191 "CFLAGS=-O2 -g -Wno-pointer-to-int-cast"
192 " -Wno-error=implicit-function-declaration"
193 " -Wno-error=incompatible-pointer-types")))))
194 (native-search-paths
195 (list (search-path-specification
196 (variable "CSCC_LIB_PATH")
197 (files (list "lib/cscc/lib")))))
198 (home-page "http://www.gnu.org/software/dotgnu/html2.0/pnet.html")
199 (synopsis "Compiler for the C# programming language")
200 (description
201 "The goal of this project is to build a suite of free software tools
202to build and execute .NET applications, including a C# compiler,
203assembler, disassembler, and runtime engine.")
204 (license license:gpl2+))))
205
206(define-public pnetlib-git
207 (let ((version "0.8.0")
208 (commit "c3c12b8b0c65f5482d03d6a4865f7670e98baf4c")
209 (revision "0"))
210 (package
211 (name "pnetlib-git")
212 (version (git-version version revision commit))
213 (source (origin
214 (method git-fetch)
215 (uri (git-reference
216 (url
217 "https://git.savannah.gnu.org/git/dotgnu-pnet/pnetlib.git")
218 (commit commit)))
219 (file-name (git-file-name name version))
220 (sha256
221 (base32
222 "04dikki3lr3m1cacirld90rpi95656b2y2mc5rkycb7s0yfdz1nk"))
223 (modules '((guix build utils)))
224 (snippet
225 #~(begin
226 (for-each delete-file
227 (append (filter file-exists?
228 '("configure"
229 "config.guess"
230 "config.sub"
231 "install-sh"
232 "ltmain.sh"))
233 (find-files "." "Makefile(\\.in)?$")))
234 (substitute* (find-files "tests" "^Makefile\\.am$")
235 (("TESTS_ENVIRONMENT.*")
236 (string-append
237 "LOG_COMPILER = $(SHELL)\n"
238 "AM_LOG_FLAGS = $(top_builddir)/tools/run_test.sh"
239 " $(top_builddir)")))
240 (substitute* "tools/run_test.sh.in"
241 (("en_US") "en_US.utf8"))
242 (substitute* "tools/wrapper.sh.in"
243 (("exec .LN_S clrwrap ..1.")
244 (string-append
245 "echo '#!@SHELL@' >> $1\n"
246 "echo exec $CLRWRAP"
247 " $(dirname $(dirname $1))"
248 "/lib/cscc/lib/$(basename $1).exe >> $1\n"
249 "chmod +x $1")))))))
250 (build-system gnu-build-system)
251 (arguments
252 (list
253 #:make-flags #~(list "CFLAGS=-O2 -g -Wno-pointer-to-int-cast")
254 #:tests? (and (not (%current-target-system))
255 (not (target-aarch64?)))
256 #:phases
257 #~(modify-phases %standard-phases
258 (add-after 'unpack 'disable-x11-tests
259 (lambda _
260 (substitute* "tests/Makefile.am"
261 ;; This actually always fails, for a number of
262 ;; reasons:
263 ;; 1. We have no libx11 present, nor do we have an X display
264 ;; present. This will cause libXsharpSupport.so to be
265 ;; built with only shims that fail at runtime.
266 ;; 2. No mechanism is provided for
267 ;; tests/System.Windows.Forms/TestForms.dll to find
268 ;; libXsharpSupport.so, which seems to sit at
269 ;; Xsharp/.libs/libXsharpSupport.so.
270 ;; With a libjit pnet,
271 ;; System.Drawing.Toolkit.ToolkitHandler.CreateDefaultToolkit
272 ;; throws ArgumentNullException when invoking Assembly.Load,
273 ;; while a cvm pnet instead succeeds temporarily, but then
274 ;; fails when invoking
275 ;; System.Drawing.Toolkit.DrawingToolkit..ctor. For some
276 ;; reason this results in csunit passing the former and
277 ;; failing the latter.
278 (("System\\.Windows\\.Forms") "")))))))
279 (native-inputs
280 (list autoconf automake libtool treecc))
281 (inputs
282 (list pnet-git))
283 (home-page "http://www.gnu.org/software/dotgnu/html2.0/pnet.html")
284 (synopsis "Libraries for the C# programming language")
285 (description
286 "DotGNU Portable.NET Library contains an implementation of the C# library,
287for use with .NET-capable runtime engines and applications.")
288 (license license:gpl2+))))
289
290(define prepare-mono-source-0
291 #~((when (file-exists? "configure")
292 (delete-file "configure"))
293 (when (file-exists? "libgc")
294 (delete-file-recursively "libgc"))
295 ;; just to be sure
296 (for-each delete-file
297 (find-files "." "\\.(dll|exe|DLL|EXE|so)$"))
298 ;; We deleted docs/AgilityPack.dll earlier (if it existed), and it's
299 ;; required for building the documentation, so skip building the
300 ;; documentation. According to docs/README, "the sources to this DLL
301 ;; live in GNOME CVS module beagle/Filters/AgilityPack".
302 (substitute* "Makefile.am"
303 (("^(|DIST_|MOONLIGHT_|MONOTOUCH_)SUBDIRS =.*" all)
304 (string-replace-substring
305 (string-replace-substring
306 (string-replace-substring all " docs" "")
307 " $(libgc_dir)" "")
308 " libgc" "")))))
309
310;; A lot of the fixes are shared between many versions, and it doesn't hurt to
311;; apply them to versions before or after they are necessary, so just include
312;; them all.
313(define prepare-mono-source
314 #~(begin
315 #$@prepare-mono-source-0
316 (substitute* (filter file-exists?
317 '("configure.in"
318 "configure.ac"))
319 (("int f = isinf \\(1\\);")
320 "int f = isinf (1.0);"))
321 ;; makedev is in <sys/sysmacros.h> now. Include it.
322 (substitute* "mono/io-layer/processes.c"
323 (("#ifdef HAVE_SYS_MKDEV_H") "#if 1")
324 (("sys/mkdev.h") "sys/sysmacros.h"))
325 (substitute* (filter file-exists? '("mono/metadata/boehm-gc.c"))
326 (("GC_set_finalizer_notify_proc")
327 "GC_set_await_finalize_proc")
328 (("GC_toggleref_register_callback")
329 "GC_set_toggleref_func"))
330 (substitute* (filter file-exists? '("mono/utils/mono-compiler.h"))
331 (("static __thread gpointer x MONO_TLS_FAST")
332 "static __thread gpointer x __attribute__((used))"))
333 ;; Since the time the old mono versions were written at, gcc has started
334 ;; removing more things it thinks are unused (for example because they
335 ;; are only referenced in inline assembly of some sort).
336 (substitute* (filter file-exists? '("mono/metadata/sgen-alloc.c"))
337 (("static __thread char \\*\\*tlab_next_addr")
338 "static __thread char **tlab_next_addr __attribute__((used))"))
339 (substitute* (filter file-exists? '("mono/utils/mono-compiler.h"))
340 (("#define MONO_TLS_FAST ")
341 "#define MONO_TLS_FAST __attribute__((used)) "))))
342
343(define-public mono-1.2.6
344 (let ((cflags (string-append "-O2 -g -DARG_MAX=500 "
345 "-Wno-error=implicit-function-declaration "
346 "-Wno-error=incompatible-pointer-types "
347 "-Wno-error=implicit-int "
348 "-Wno-error=return-mismatch")))
349 (package
350 (version "1.2.6")
351 (name "mono")
352 (source (origin
353 (method url-fetch)
354 (uri (string-append
355 "http://download.mono-project.com/sources/mono/"
356 "mono-" version ".tar.bz2"))
357 (sha256
358 (base32 "03sn7wyvrjkkkbrqajpmqifxfn83p30qprizpb3m6c5cdhwlzk14"))
359 (modules '((guix build utils)
360 (ice-9 string-fun)))
361 (snippet #~(begin
362 #$prepare-mono-source
363 (with-directory-excursion
364 "mcs/class/System/System.Text.RegularExpressions"
365 (delete-file "BaseMachine.cs")
366 ;; Can't patch a file with different line endings,
367 ;; so the patch creates a new one, and we overwrite
368 ;; the old one here.
369 (rename-file "BaseMachine.cs-2"
370 "BaseMachine.cs"))))
371 (patches (search-patches "mono-1.2.6-bootstrap.patch"
372 "mono-1.2.6-callsite-bound.patch"))))
373 (build-system gnu-build-system)
374 (native-inputs
375 (list autoconf
376 automake
377 bison
378 libtool
379 pnet-git
380 pnetlib-git
381 pkg-config))
382 (inputs
383 (list glib
384 libgc
385 libx11
386 zlib))
387 (arguments
388 (list
389 #:configure-flags #~(list "--with-gc=boehm")
390 #:make-flags #~(list (string-append "EXTERNAL_MCS="
391 #+(this-package-native-input "pnet-git")
392 "/bin/cscc")
393 (string-append "EXTERNAL_RUNTIME="
394 #+(this-package-native-input "pnet-git")
395 "/bin/ilrun")
396 (string-append "CFLAGS=" #$cflags)
397 #$(string-append "CC=" (cc-for-target))
398 "V=1")
399 ;; build fails nondeterministically without this
400 #:parallel-build? #f
401 #:phases
402 #~(modify-phases %standard-phases
403 (add-after 'unpack 'fix-includes
404 (lambda _
405 ;; Upstream forgot to #include that.
406 (substitute* "mono/metadata/security.c"
407 (("#include <mono/metadata/image.h>")
408 "#include <mono/metadata/image.h>
409#include <mono/metadata/assembly.h>"))))
410 (add-after 'unpack 'set-env
411 (lambda _
412 ;; Configure script for sock_un.sun_path uses exit() without importing it.
413 (setenv "CFLAGS" #$cflags)
414 ;; All tests under mcs/class fail trying to access $HOME
415 (setenv "HOME" "/tmp")
416 ;; ZIP files have "DOS time" which starts in Jan 1980.
417 (setenv "SOURCE_DATE_EPOCH" "315532800"))))
418 ;; System.Object isn't marked as serializable because it causes issues
419 ;; with compiling with pnet (circular class reference between Object and
420 ;; SerializableAttribute), and this causes tests to fail.
421 #:tests? #f))
422 (native-search-paths
423 (list (search-path-specification
424 (variable "MONO_PATH")
425 (files (list "lib/mono")))))
426 (synopsis "Compiler and libraries for the C# programming language")
427 (description "Mono is a compiler, vm, debugger and set of libraries for C#
428a C-style programming language from Microsoft that is very similar to Java.")
429 (home-page "https://www.mono-project.com/")
430 ;; See ./LICENSE
431 (license (list
432 ;; most of mcs/tools, mono/man, most of mcs/class, tests by
433 ;; default, mono/eglib
434 license:x11
435 ;; mcs/mcs, mcs/gmcs, some of mcs/tools
436 license:gpl1+ ;; note: ./mcs/LICENSE.GPL specifies no version
437 ;; mono/mono (the mono VM, I think they meant mono/mini)
438 license:lgpl2.0+ ;; note: ./mcs/LICENSE.LGPL specifies no version
439 ;; mcs/jay
440 license:bsd-4)))))
441
442(define-public mono-1.9.1
443 (package
444 (inherit mono-1.2.6)
445 (version "1.9.1")
446 (name "mono")
447 (source (origin
448 (method git-fetch)
449 (uri (git-reference
450 (url "https://gitlab.winehq.org/mono/mono.git")
451 (commit "mono-1.9.1.1")))
452 (file-name (git-file-name name version))
453 (sha256
454 (base32
455 "0s1n3zdhc2alk9smxfdl1kjz7lz2p19gs0ks4hgr864jlmf13bws"))
456 (modules '((guix build utils)
457 (ice-9 string-fun)))
458 (snippet prepare-mono-source)
459 (patches (search-patches
460 "mono-1.9.1-fixes.patch"
461 "mono-1.9.1-add-MONO_CREATE_IMAGE_VERSION.patch"
462 "mono-1.9.1-reproducibility.patch"))))
463 (native-inputs
464 (modify-inputs (package-native-inputs mono-1.2.6)
465 (delete "pnet-git")
466 (delete "pnetlib-git")
467 (prepend mono-1.2.6)
468 (append which)
469 ;; needed for tests
470 (append perl)))
471 (arguments
472 (substitute-keyword-arguments (package-arguments mono-1.2.6)
473 ((#:make-flags _ #f)
474 #~(list (string-append "CFLAGS=-O2 -g -DARG_MAX=500 "
475 "-Wno-error=implicit-function-declaration "
476 "-Wno-error=incompatible-pointer-types "
477 "-Wno-error=implicit-int "
478 "-Wno-error=return-mismatch")
479 #$(string-append "CC=" (cc-for-target))
480 "NO_SIGN_ASSEMBLY=yes" ; non-reproducible otherwise.
481 "V=1"))
482 ((#:phases phases #~%standard-phases)
483 #~(modify-phases #$phases
484 (add-before 'install 'delete-mdb
485 (lambda _
486 ;; Those are a source of non-reproducibility--because of the
487 ;; random GUIDs. We are also nerfing the module GUIDs anyway
488 ;; so I don't think .net still knows which mdb module is for
489 ;; what implementation module.
490 (for-each delete-file (find-files "." "[.]mdb$"))))
491 ;; Note: Would also work directly after unpack.
492 (add-after 'configure 'disable-signing
493 (lambda _
494 ;; This would be a source of non-reproducibility and have no /keyfile.
495 (substitute* "mcs/class/IBM.Data.DB2/Makefile"
496 (("^LIB_MCS_FLAGS =")
497 "LIB_MCS_FLAGS = /delaysign+ "))
498 ;; This would be a source of non-reproducibility.
499 (substitute* "mcs/class/FirebirdSql.Data.Firebird/Assembly/AssemblyInfo.cs"
500 (("AssemblyDelaySign[(]false[)]")
501 "AssemblyDelaySign(true)"))))
502 (add-before 'configure 'set-cflags
503 (lambda _
504 ;; apparently can't be set via make flags in this version
505 (let ((original (getenv "CFLAGS")))
506 (setenv "CFLAGS" (string-append (or original "")
507 (if original " " "")
508 "-DARG_MAX=500 "
509 "-Wno-error=implicit-function-declaration "
510 "-Wno-error=incompatible-pointer-types "
511 "-Wno-error=implicit-int "
512 "-Wno-error=return-mismatch ")))))
513 (add-before 'configure 'set-create-image-version
514 (lambda _
515 ;; pnet produces v2.x assemblies. Mono does this weird thing
516 ;; where it always produces assemblies of the same version as
517 ;; the runtime that is running it, which is based on the
518 ;; version of the assembly that it loaded, which is based on
519 ;; what it decided for the previous compiler... on and on all
520 ;; the way back to pnet. This breaks that chain, because
521 ;; otherwise it ends up compiling the initial mcs against .NET
522 ;; 2.0 libraries and then running with .NET 1.0 libraries.
523 (setenv "MONO_CREATE_IMAGE_VERSION" "v1.1.4322")))
524 (add-after 'unpack 'patch-test-driver-shebang
525 (lambda _
526 (patch-shebang "mono/tests/test-driver")))))
527 ((#:tests? _ #f) #f)
528 ((#:parallel-tests? _ #f) #f)))))
529
530(define-public mono-2.4.2
531 (package
532 (inherit mono-1.9.1)
533 (version "2.4.2.3")
534 (name "mono")
535 (source (origin
536 (method git-fetch)
537 (uri (git-reference
538 (url "https://gitlab.winehq.org/mono/mono.git")
539 (commit (string-append
540 "mono-" (string-replace-substring version "." "-")))))
541 (file-name (git-file-name name version))
542 (sha256
543 (base32
544 "0mnrk17rd9c5rh30dh82a39c9ak1ns998b41ivprvy7m068skpda"))
545 (modules '((guix build utils)
546 (ice-9 string-fun)))
547 (snippet prepare-mono-source)
548 (patches (search-patches "mono-2.4.2.3-reproducibility.patch"
549 "mono-2.4.2.3-fixes.patch"
550 "mono-2.4.2.3-fix-parallel-builds.patch"))))
551 (native-inputs (modify-inputs (package-native-inputs mono-1.9.1)
552 (replace "mono" mono-1.9.1)))
553 (inputs (modify-inputs (package-inputs mono-1.9.1)
554 (append gettext-minimal)))
555 (arguments
556 (substitute-keyword-arguments (package-arguments mono-1.9.1)
557 ((#:make-flags _ #f)
558 #~(list (string-append "CFLAGS=-O2 -g -DARG_MAX=500 "
559 "-Wno-error=implicit-function-declaration "
560 "-Wno-error=incompatible-pointer-types "
561 "-Wno-error=implicit-int "
562 "-Wno-error=return-mismatch "
563 "-Wno-error=int-conversion ")
564 #$(string-append "CC=" (cc-for-target))
565 "V=1"))
566 ((#:tests? _ #f)
567 ;; When it tries building iltests.il in mono/mini, it gets: error
568 ;; CS0006: cannot find metadata file `TestDriver.dll'. It builds fine
569 ;; outside of the build environment, but later tests fail, and I can't
570 ;; be bothered to figure out what's causing ilasm to not find
571 ;; TestDriver.dll.
572 #f)
573 ((#:phases phases #~%standard-phases)
574 #~(modify-phases #$phases
575 (add-after 'unpack 'disable-mono-mini-timestamps
576 (lambda _
577 ;; Note: Newer monos have mono/mini/Makefile.am.in .
578 (substitute* '("mono/mini/Makefile.am")
579 (("`date`")
580 ;; This timestamp is the same as SOURCE_DATE_EPOCH.
581 "Tue Jan 1 12:00:00 AM UTC 1980"))))
582 (add-before 'bootstrap 'patch-sub-autogen.sh-shebang
583 (lambda _
584 (patch-shebang "eglib/autogen.sh")))))))
585 (license (list
586 ;; most of mcs/tools, mono/man, most of mcs/class, tests by
587 ;; default, mono/eglib
588 ;; mcs/mcs, mcs/gmcs (dual-licensed GPL)
589 ;; samples
590 license:x11
591 ;; mcs/mcs, mcs/gmcs (dual-licensed X11)
592 ;; some of mcs/tools
593 license:gpl1+ ;; note: ./mcs/LICENSE.GPL specifies no version
594 ;; mono/mono (the mono VM, I think they meant mono/mini)
595 license:lgpl2.0+ ;; note: ./mcs/LICENSE.LGPL specifies no version
596 ;; mcs/jay
597 license:bsd-4))))
598
599(define-public mono-2.6.4
600 (package
601 (inherit mono-2.4.2)
602 (version "2.6.4")
603 (name "mono")
604 (source (origin
605 (method git-fetch)
606 (uri (git-reference
607 (url "https://gitlab.winehq.org/mono/mono.git")
608 (commit (string-append "mono-" version))))
609 (file-name (git-file-name name version))
610 (sha256
611 (base32
612 "17977w45qh8jmfsl4bhi83si4fxd8s3x8b0pxnwdzjv3bqr54c85"))
613 (modules '((guix build utils)
614 (ice-9 string-fun)))
615 (snippet prepare-mono-source)
616 (patches (search-patches "mono-2.4.2.3-reproducibility.patch"
617 "mono-2.6.4-fixes.patch"))))
618 (native-inputs (modify-inputs (package-native-inputs mono-2.4.2)
619 (replace "mono" mono-2.4.2)))))
620
621;; submodule checkouts use git://, which isn't supported by github anymore, so
622;; we need to manually provide them instead of being able to use (recursive?
623;; #t). Also try not to think too hard about the fact that some of these
624;; submodules in later versions contain binary compiler blobs which mono
625;; maintainers presumably used when creating the bootstrap binaries they
626;; published. All fetched and updated over unauthenticated git://.
627
628(define mono-2.11.4-external-repo-specs
629 ;; format: ({reponame OR (reponame dir-name)} commit-hash origin-sha256) ...
630 ;; if reponame starts with https:// it is treated as the repository url,
631 ;; otherwise the name of a repository under https://github.com/mono/
632 '(("aspnetwebstack" "1836deff6a2683b8a5b7dd78f2b591a10b47573e"
633 "0vqq45i8k6jylljarr09hqqiwjs8wn0lgjrl6bz72vxqpp0j344k")
634 ("cecil" "54e0a50464edbc254b39ea3c885ee91ada730705"
635 "007szbf5a14q838695lwdp7ap6rwzz3kzllgjfnibzlqipw3x2yk")
636 ("entityframework" "9baca562ee3a747a41870f45e749e4436b6aca26"
637 "0l8k04bykbrbk5q2pz8hzh8xy8y4ayz7j97fw0kyk3lrai89v5da")
638 ("Newtonsoft.Json" "471c3e0803a9f40a0acc8aeceb31de6ff93a52c4"
639 "0dgngd5hqk6yhlg40kabn6qdnknm32zcx9q6bm2w31csnsk5978s")))
640
641(define (add-external-repos specs)
642 (define (reponame->url reponame)
643 (if (string-prefix? "https://" reponame)
644 reponame
645 (string-append "https://github.com/mono/" reponame)))
646
647 (define* (external-repo-gexp reponame commit hash
648 #:key recursive? (patches '()))
649 (let ((short-commit (string-take commit 6))
650 (reponame (if (pair? reponame) (car reponame)
651 reponame))
652 (dir-name (if (pair? reponame) (cadr reponame)
653 reponame)))
654 #~(copy-recursively #+(origin
655 (method git-fetch)
656 (uri (git-reference
657 (url (reponame->url reponame))
658 (commit commit)
659 (recursive? recursive?)))
660 (file-name
661 (git-file-name dir-name
662 short-commit))
663 (sha256 (base32 hash))
664 (patches (map search-patch patches)))
665 #$(string-append "./external/" dir-name))))
666
667 (define (spec->gexp spec)
668 (apply external-repo-gexp spec))
669
670 #~(begin
671 #+@(map spec->gexp specs)))
672
673(define-public mono-2.11.4
674 (package
675 (inherit mono-2.6.4)
676 (version "2.11.4")
677 (name "mono")
678 (source (origin
679 (method git-fetch)
680 (uri (git-reference
681 (url "https://gitlab.winehq.org/mono/mono.git")
682 (commit (string-append "mono-" version))))
683 (file-name (git-file-name name version))
684 (sha256
685 (base32
686 "0y2bifi2avbjmfp80hjga2dyqip4b46zkvx6yfr9pa2hhm940rpx"))
687 (modules '((guix build utils)
688 (ice-9 string-fun)))
689 (snippet #~(begin
690 #$(add-external-repos
691 mono-2.11.4-external-repo-specs)
692 #$prepare-mono-source))
693 (patches (search-patches "mono-2.11.4-fixes.patch"))))
694 (build-system gnu-build-system)
695 (arguments
696 (substitute-keyword-arguments (package-arguments mono-2.6.4)
697 ((#:phases phases #~%standard-phases)
698 #~(modify-phases #$phases
699 (delete 'disable-signing)))))
700 (native-inputs (modify-inputs (package-native-inputs mono-2.6.4)
701 (replace "mono" mono-2.6.4)))
702 (license (list
703 ;; most of mcs/tools, mono/man, most of mcs/class, tests by
704 ;; default, mono/eglib, mono/metadata/sgen*,
705 ;; mono/arch/*/XXX-codegen.h
706 ;; mcs/mcs, mcs/gmcs (dual-licensed GPL)
707 ;; samples
708 license:x11
709 ;; mcs/mcs, mcs/gmcs (dual-licensed X11)
710 ;; some of mcs/tools
711 license:gpl1+ ;; note: ./mcs/LICENSE.GPL specifies no version
712 ;; mono/mono (the mono VM, I think they meant mono/mini)
713 license:lgpl2.0+ ;; note: ./mcs/LICENSE.LGPL specifies no version
714 ;; mcs/jay
715 license:bsd-4
716 ;; mcs/class/System.Core/System/TimeZoneInfo.Android.cs
717 license:asl2.0))))
718
719(define mono-3.0.12-external-repo-specs
720 ;; format: ({reponame OR (reponame dir-name)} commit sha256) ...
721 ;; if reponame starts with https:// it is treated as the repository url,
722 ;; otherwise the name of a repository under https://github.com/mono/
723 '(("aspnetwebstack" "e77b12e6cc5ed260a98447f609e887337e44e299"
724 "0rks344qr4fmp3fs1264d2qkmm348m8d1kjd7z4l94iiirwn1fq1")
725 ("cecil" "54e0a50464edbc254b39ea3c885ee91ada730705"
726 "007szbf5a14q838695lwdp7ap6rwzz3kzllgjfnibzlqipw3x2yk")
727 ("entityframework" "a5faddeca2bee08636f1b7b3af8389bd4119f4cd"
728 "0b05pzf6qwdd92pbzym32nfmw8rq36820vdzakq1kykfmddjr9a7")
729 (("ikvm-fork" "ikvm") "10b8312c8024111780ee382688cd4c8754b1f1ac"
730 "025wf9gjgfvrq42vgw91ahy3cmzcw094vx783dsp7gjdyd8q09nm")
731 ("Lucene.Net" "88fb67b07621dfed054d8d75fd50672fb26349df"
732 "1rfxqfz7hkp9rg5anvxlv6fna0xi0bnv1y8qbhf8x48l08yjb38k")
733 ("Newtonsoft.Json" "471c3e0803a9f40a0acc8aeceb31de6ff93a52c4"
734 "0dgngd5hqk6yhlg40kabn6qdnknm32zcx9q6bm2w31csnsk5978s")
735 ("rx" "17e8477b2cb8dd018d49a567526fe99fd2897857"
736 "0fyyy4jf0mma6kff6fvbvdcs5ra1bz4s063nvjjva9xlnv7sjvh4")))
737
738(define-public mono-3.0
739 (package
740 (inherit mono-2.11.4)
741 (version "3.0.12")
742 (name "mono")
743 (source (origin
744 (method git-fetch)
745 (uri (git-reference
746 (url "https://gitlab.winehq.org/mono/mono.git")
747 (commit (string-append "mono-" version))))
748 (file-name (git-file-name name version))
749 (sha256
750 (base32
751 "110f3hcfikk6bxbrgjas5dqldci9f24gvm3vdgn4j9j7xhlcx1lj"))
752 (modules '((guix build utils)
753 (ice-9 string-fun)))
754 (snippet #~(begin
755 #$(add-external-repos
756 mono-3.0.12-external-repo-specs)
757 #$prepare-mono-source))))
758 (arguments
759 (substitute-keyword-arguments (package-arguments mono-2.11.4)
760 ((#:phases phases #~%standard-phases)
761 #~(modify-phases #$phases
762 (delete 'disable-mono-mini-timestamps)))))
763 (native-inputs (modify-inputs (package-native-inputs mono-2.11.4)
764 (replace "mono" mono-2.11.4)))
765 (license (list
766 ;; most of mcs/tools, mono/man, most of mcs/class, tests by
767 ;; default, mono/eglib, mono/metadata/sgen*,
768 ;; mono/arch/*/XXX-codegen.h
769 ;; mcs/mcs, mcs/gmcs (dual-licensed GPL)
770 ;; samples
771 license:x11
772 ;; mcs/mcs, mcs/gmcs (dual-licensed X11)
773 ;; some of mcs/tools
774 license:gpl1+ ;; note: ./mcs/LICENSE.GPL specifies no version
775 ;; mono/mono (the mono VM, I think they meant mono/mini)
776 ;; mono/support (note: directory doesn't exist, probably meant
777 ;; ./support, but that contains a copy of zlib?)
778 license:lgpl2.0+ ;; note: ./mcs/LICENSE.LGPL specifies no version
779 ;; mcs/jay
780 license:bsd-4
781 ;; mcs/class/System.Core/System/TimeZoneInfo.Android.cs
782 license:asl2.0
783 ;; ./support, contains a copy of zlib
784 license:zlib))))
785
786(define mono-3.12.1-external-repo-specs
787 ;; format: ({reponame OR (reponame dir-name)} commit sha256) ...
788 '(("aspnetwebstack" "e77b12e6cc5ed260a98447f609e887337e44e299"
789 "0rks344qr4fmp3fs1264d2qkmm348m8d1kjd7z4l94iiirwn1fq1")
790 ("cecil" "33d50b874fd527118bc361d83de3d494e8bb55e1"
791 "1p4hl1796ib26ykyf5snl6cj0lx0v7mjh0xqhjw6qdh753nsjyhb")
792 ("entityframework" "a5faddeca2bee08636f1b7b3af8389bd4119f4cd"
793 "0b05pzf6qwdd92pbzym32nfmw8rq36820vdzakq1kykfmddjr9a7")
794 ("ikdasm" "7ded4decb9c39446be634d42a575fda9bc3d945c"
795 "0f3mbfizxmvr5njj123w0wn7sz85v5q2mzwijjql8w1095i0916l")
796 (("ikvm-fork" "ikvm") "22534de2098acbcf208f6b06836d122dab799e4b"
797 "1ivywy5sc594sl3bs9xrkna1dbhkp7v1mv79n96ydgq6zcs0698l")
798 ("Lucene.Net" "88fb67b07621dfed054d8d75fd50672fb26349df"
799 "1rfxqfz7hkp9rg5anvxlv6fna0xi0bnv1y8qbhf8x48l08yjb38k")
800 ("Newtonsoft.Json" "471c3e0803a9f40a0acc8aeceb31de6ff93a52c4"
801 "0dgngd5hqk6yhlg40kabn6qdnknm32zcx9q6bm2w31csnsk5978s")
802 ("rx" "00c1aadf149334c694d2a5096983a84cf46221b8"
803 "0ndam0qrnkb4gj21lapqgcy0mqw7s18viswsjyjyaaa4fgqw8kmq")))
804
805(define-public mono-3.12.1
806 (package
807 (inherit mono-3.0)
808 (version "3.12.1")
809 (name "mono")
810 (source (origin
811 (method git-fetch)
812 (uri (git-reference
813 (url "https://gitlab.winehq.org/mono/mono.git")
814 (commit (string-append "mono-" version))))
815 (file-name (git-file-name name version))
816 (sha256
817 (base32
818 "01sxrnfch61k8v7av7ccbmy3v37ky8yp8460j6ycnbyfa3305y0f"))
819 (modules '((guix build utils)
820 (ice-9 string-fun)))
821 (snippet #~(begin
822 #$(add-external-repos
823 mono-3.12.1-external-repo-specs)
824 #$prepare-mono-source))))
825 (native-inputs (modify-inputs (package-native-inputs mono-3.0)
826 (replace "mono" mono-3.0)))
827 (arguments
828 (substitute-keyword-arguments (package-arguments mono-3.0)
829 ((#:phases phases #~%standard-phases)
830 #~(modify-phases #$phases
831 (replace 'set-cflags
832 (lambda _
833 (setenv "CFLAGS"
834 (string-append "-O2 -g "
835 "-Wno-error=implicit-function-declaration "
836 "-Wno-error=incompatible-pointer-types "
837 "-Wno-error=implicit-int "
838 "-Wno-error=return-mismatch "
839 "-Wno-error=int-conversion"))))
840 (add-after 'unpack 'set-TZ
841 (lambda _
842 ;; for some reason a default is only used if this is empty, not
843 ;; if it is unset.
844 (setenv "TZ" "")))))))))
845
846(define mono-4.9.0-external-repo-specs
847 ;; format: ({reponame OR (reponame dir-name)} commit sha256) ...
848 '(("aspnetwebstack" "e77b12e6cc5ed260a98447f609e887337e44e299"
849 "0rks344qr4fmp3fs1264d2qkmm348m8d1kjd7z4l94iiirwn1fq1")
850 ;; (("reference-assemblies" "binary-reference-assemblies")
851 ;; "6c77197318fe85dfddf75a1b344b9bf8d0007b0b"
852 ;; "11hbs952srjlsiyin76y2llm5rfjkwjc67ya1i3p0pw193zw14jk")
853 ;; According to github description this is a "custom" fork of boringssl
854 ("boringssl" "c06ac6b33d3e7442ad878488b9d1100127eff998"
855 "187zpi1rvh9i6jfccwzqq337rxxi1rgny6mjq79r08dlrh0lydzc")
856 ("buildtools" "9b6ee8686be55a983d886938165b6206cda50772"
857 "0sjw3swavcmijynmaxh647qpkjsbgihdr8lhkyzf8dsprhlq4fxd")
858 ("cecil" "2b39856e80d8513f70bc3241ed05325b0de679ae"
859 "0vvax32r6bnhvrcvis83gdrdqcgyxb704hz28g9q0wnay4knqxdm")
860 (("cecil" "cecil-legacy") "33d50b874fd527118bc361d83de3d494e8bb55e1"
861 "1p4hl1796ib26ykyf5snl6cj0lx0v7mjh0xqhjw6qdh753nsjyhb")
862 ;; ("debian-snapshot" "9342f8f052f81deaba789f030db23a88b4369724"
863 ;; "")
864 ("ikdasm" "e4deabf61c11999f200dcea6f6d6b42474cc2131"
865 "1frbf70y7n7l72j393avdiwk6153cvfwwpighkf2m46clqmq4han")
866 (("ikvm-fork" "ikvm") "367864ef810859ae3ce652864233b35f2dd5fdbe"
867 "0ig99kbma4s0mzb13nzsk1vm200ygfr11q6mzgh6jj46s2fc35px")
868 ("Lucene.Net.Light" "85978b7eb94738f516824341213d5e94060f5284"
869 "0d118i52m3a0vfjhfci81a2kc4qvnj23gs02hrvdrfpd1q92fyii")
870 ("Newtonsoft.Json" "471c3e0803a9f40a0acc8aeceb31de6ff93a52c4"
871 "0dgngd5hqk6yhlg40kabn6qdnknm32zcx9q6bm2w31csnsk5978s")
872 ("nuget-buildtasks" "04bdab55d8de9edcf628694cfd2001561e8f8e60"
873 "1nklxayxkdskg5wlfl44cndzqkl18v561rz03hwx7wbn5w89q775")
874 ("nunit-lite" "4bc79a6da1f0ee538560b7e4d0caff46d3c86e4f"
875 "085fpabjw47rn8hb5zw6wizsg2jrgdbj9rnlar9lrls40wig272q")
876 ("rx" "b29a4b0fda609e0af33ff54ed13652b6ccf0e05e"
877 "1n1jwhmsbkcv2d806immcpzkb72rz04xy98myw355a8w5ah25yiv")))
878
879(define-public mono-4.9.0
880 (package
881 (inherit mono-3.12.1)
882 (version "4.9.0")
883 (name "mono")
884 (source (origin
885 (method git-fetch)
886 (uri
887 (git-reference
888 (url "https://gitlab.winehq.org/mono/mono.git")
889 ;; some commit chosen after configure.ac was updated to make
890 ;; the version >= 4.9.0
891 (commit "5a3736606e6243d2c84d4df2cf35c284214b8cc4")))
892 (file-name (git-file-name name version))
893 (sha256
894 (base32
895 "0vqkkqkaqwbii4hdzg0vffyy31fz1kmmsa67jyqwxdsvgpjszih3"))
896 (modules '((guix build utils)
897 (ice-9 string-fun)))
898 (snippet #~(begin
899 #$(add-external-repos
900 mono-4.9.0-external-repo-specs)
901 #$prepare-mono-source))
902 (patches (search-patches
903 ;; Saves us an extra intermediate step
904 "mono-4.9.0-fix-runtimemetadataversion.patch"))))
905 (native-inputs (modify-inputs (package-native-inputs mono-3.12.1)
906 (replace "mono" mono-3.12.1)
907 (append tzdata-for-tests)))
908 (arguments
909 (substitute-keyword-arguments (package-arguments mono-3.12.1)
910 ((#:configure-flags _ #f)
911 ;; "External Boehm is no longer supported" - I VILL NOT use the
912 ;; bundled software!
913 #~(list "--with-sgen=yes"
914 "--disable-boehm"
915 "--with-csc=mcs"))
916 ((#:phases phases #~%standard-phases)
917 #~(modify-phases #$phases
918 ;; The files moved and were fixed upstream anyway.
919 (delete 'fix-includes)
920 ;; GCC static library linking dependency resolution got stricter--so
921 ;; we have to add a dependency.
922 (add-after 'unpack 'patch-sgen-linking
923 (lambda _
924 (substitute* "tools/monograph/Makefile.am"
925 (("/mono/metadata/libmonoruntimesgen-static[.]la")
926 (string-append "/mono/metadata/libmonoruntimesgen-static.la "
927 "$(top_builddir)/mono/sgen/libmonosgen-static.la")))))
928 (add-before 'configure 'set-TZDIR
929 (lambda* (#:key native-inputs inputs #:allow-other-keys)
930 (search-input-directory (or native-inputs inputs)
931 "share/zoneinfo")))
932 (add-after 'unpack 'use-old-mono-libraries
933 ;; At this point in history mono had not, to my knowledge,
934 ;; deigned to grace us with the actual sources to the binaries
935 ;; shipped in external/binary-reference-assemblies, so just copy
936 ;; the libraries from an older mono for now I guess.
937 (lambda _
938 (substitute* "mcs/class/reference-assemblies/Makefile"
939 (("\\.\\./\\.\\./\\.\\./external/binary-reference-assemblies/v")
940 (string-append #$(this-package-native-input "mono")
941 "/lib/mono/")))))
942 (add-after 'unpack 'disable-Microsoft.Build.Tasks-tests
943 (lambda _
944 ;; These fail for unknown reasons
945 (substitute* "mcs/class/Microsoft.Build.Tasks/Makefile"
946 (("^include ../../build/library.make" all)
947 (string-append
948 all "\nrun-test-recursive:\n\t@echo skipping tests\n")))))))))
949 (license (list
950 ;; most of mcs/tools, mono/man, most of mcs/class, tests by
951 ;; default, mono/eglib, mono/metadata/sgen*,
952 ;; mono/arch/*/XXX-codegen.h
953 ;; mcs/mcs, mcs/gmcs (dual-licensed GPL)
954 ;; samples
955 license:x11
956 ;; mcs/mcs, mcs/gmcs (dual-licensed X11)
957 ;; some of mcs/tools
958 license:gpl1+ ;; note: ./mcs/LICENSE.GPL specifies no version
959 ;; mono/mono (the mono VM, I think they meant mono/mini)
960 ;; mono/support (note: directory doesn't exist, probably meant
961 ;; ./support, but that contains a copy of zlib?)
962 license:lgpl2.0+ ;; note: ./mcs/LICENSE.LGPL specifies no version
963 ;; mcs/jay, mono/utils/memcheck.h
964 license:bsd-4
965 ;; mono/utils/bsearch.c, mono/io-layer/wapi_glob.{h,c}
966 license:bsd-3
967 ;; mono/utils/freebsd-{dwarf,elf_common,elf64,elf32}.h
968 license:bsd-2
969 ;; mcs/class/System.Core/System/TimeZoneInfo.Android.cs
970 ;; mcs/class/RabbitMQ.Client (dual licensed mpl1.1)
971 license:asl2.0
972 ;; ./support, contains a copy of zlib, incl. ./support/minizip
973 license:zlib
974 ;; mono/docs/HtmlAgilityPack, mcs/unit24
975 license:ms-pl
976 ;; mcs/class/I18N/mklist.sh, mono/benchmark/{zipmark,logic}.cs
977 ;; mcs/class/{,Compat.}ICSharpCode.SharpZipLib
978 license:gpl2+
979 ;; mcs/class/RabbitMQ.Client (dual licensed asl2.0)
980 license:mpl1.1
981 ;; API Documentation
982 license:cc-by4.0))))
983
984(define mono-5.0.1-external-repo-specs
985 '(("aspnetwebstack" "e77b12e6cc5ed260a98447f609e887337e44e299"
986 "0rks344qr4fmp3fs1264d2qkmm348m8d1kjd7z4l94iiirwn1fq1")
987 ;; snippet in the actual package will delete all dlls and exes, so this
988 ;; should be rebuilt from scratch.
989 (("reference-assemblies" "binary-reference-assemblies")
990 "febc100f0313f0dc9d75dd1bcea45e87134b5b55"
991 "0lpj911m2lq23r22dpy4i02fy4ykf27dx8fvqpxsxknysj2jl6y4")
992 ("bockbuild" "512ba41a94bec35ff0c395eb71a180fda23da95c"
993 "16m00la8svx8v07sxy4zxbpq0cbq7d3nzy53w8kqml8b18h5dabg")
994 ("boringssl" "c06ac6b33d3e7442ad878488b9d1100127eff998"
995 "187zpi1rvh9i6jfccwzqq337rxxi1rgny6mjq79r08dlrh0lydzc")
996 ("buildtools" "9b6ee8686be55a983d886938165b6206cda50772"
997 "0sjw3swavcmijynmaxh647qpkjsbgihdr8lhkyzf8dsprhlq4fxd")
998 ("cecil" "7801534de1bfed97c844821c3244e05fc7ffcfb8"
999 "0dmfyzkm57n3lbgllx6ffz4g84x1slkib9hb4cfp3nhz852qim7b")
1000 (("cecil" "cecil-legacy") "33d50b874fd527118bc361d83de3d494e8bb55e1"
1001 "1p4hl1796ib26ykyf5snl6cj0lx0v7mjh0xqhjw6qdh753nsjyhb")
1002 ("corefx" "bd96ae5f1485ae8541fe476dfd944efde76bcd9c"
1003 "0j51lc54dmwa4fzna2vjfj4pcd1lk1s5bp5dfix1aqcncyzivazi")
1004 ("corert" "d87c966d80c1274373ddafe3375bf1730cd430ed"
1005 "078v5ks7inm2g1hf96x19k42jnv1qhhh7r8jxrfc7jk4v4lgmqyf")
1006 ("ikdasm" "e4deabf61c11999f200dcea6f6d6b42474cc2131"
1007 "1frbf70y7n7l72j393avdiwk6153cvfwwpighkf2m46clqmq4han")
1008 (("ikvm-fork" "ikvm") "367864ef810859ae3ce652864233b35f2dd5fdbe"
1009 "0ig99kbma4s0mzb13nzsk1vm200ygfr11q6mzgh6jj46s2fc35px")
1010 ("linker" "e4d9784ac37b9ebf4757175c92bc7a3ec9fd867a"
1011 "0ga7br9lqdsycz22dndkbiwbd0c60ml6nl22xlsnjr7lwdccfjvl")
1012 ("Lucene.Net.Light" "85978b7eb94738f516824341213d5e94060f5284"
1013 "0d118i52m3a0vfjhfci81a2kc4qvnj23gs02hrvdrfpd1q92fyii")
1014 ("Newtonsoft.Json" "471c3e0803a9f40a0acc8aeceb31de6ff93a52c4"
1015 "0dgngd5hqk6yhlg40kabn6qdnknm32zcx9q6bm2w31csnsk5978s")
1016 (("NuGet.BuildTasks" "nuget-buildtasks")
1017 "8d307472ea214f2b59636431f771894dbcba7258"
1018 "1h1frnj0x8k7b29ic4jisch0vlpmsmghjw554pz277f2nxaidljj")
1019 (("NUnitLite" "nunit-lite") "690603bea98aae69fca9a65130d88591bc6cabee"
1020 "1f845ysjzs3yd9gcyww66dnkx484z5fknb8l0xz74sjmxk2mngwc")
1021 ;; ("roslyn-binaries" "0d4198b1299bcb019973749da4d47e90f15a1e46"
1022 ;; "")
1023 ("rx" "b29a4b0fda609e0af33ff54ed13652b6ccf0e05e"
1024 "1n1jwhmsbkcv2d806immcpzkb72rz04xy98myw355a8w5ah25yiv")))
1025
1026(define-public mono-5.0.1
1027 (package
1028 (inherit mono-4.9.0)
1029 (version "5.0.1")
1030 (name "mono")
1031 (source (origin
1032 (method git-fetch)
1033 (uri
1034 (git-reference
1035 (url "https://gitlab.winehq.org/mono/mono.git")
1036 (commit "mono-5.0.1.1")))
1037 (file-name (git-file-name name version))
1038 (sha256
1039 (base32
1040 "05z9bddljp8xwsw7qw3f7bic8i202wrc60pjb9fn4igwfz9278n5"))
1041 (modules '((guix build utils)
1042 (ice-9 string-fun)))
1043 (snippet #~(begin
1044 #$(add-external-repos
1045 mono-5.0.1-external-repo-specs)
1046 #$@prepare-mono-source-0))))
1047 (native-inputs (modify-inputs (package-native-inputs mono-4.9.0)
1048 (replace "mono" mono-4.9.0)
1049 (append cmake-minimal)))
1050 (arguments
1051 (substitute-keyword-arguments (package-arguments mono-4.9.0)
1052 ((#:make-flags _ #f)
1053 ;; Build system is buggy here, it does some weird wildcard expansion
1054 ;; that assumes there's only at most one file in a directory
1055 #~(list "V=1" "SKIP_AOT=1"))
1056 ((#:phases phases #~%standard-phases)
1057 #~(modify-phases #$phases
1058 (add-after 'unpack 'disable-roslyn-install
1059 ;; For some reason there is no predefined way to persuade mono to
1060 ;; not install the binary blobs it assumes are there.
1061 (lambda _
1062 (substitute* "mcs/packages/Makefile"
1063 (("^install-local:")
1064 (string-append "install-local:
1065 echo \"Skipping blob install\"
1066
1067unused0:")))))
1068 (delete 'use-old-mono-libraries)
1069 (add-after 'build 'build-reference-assemblies
1070 (lambda* (#:key make-flags parallel-build? #:allow-other-keys)
1071 (let ((top (getcwd))
1072 ;; parallel-build? needs to be false for mono's build
1073 ;; phase, but it should work here.
1074 (parallel-build? #t))
1075 (with-directory-excursion "external/binary-reference-assemblies"
1076 ;; No clue why all these references are missing, just
1077 ;; power through I guess.
1078 (substitute* (find-files "." "^Makefile$")
1079 (("CSC_COMMON_ARGS := " all)
1080 (string-append all "-delaysign+ "))
1081 (("IBM\\.Data\\.DB2_REFS := " all)
1082 (string-append all "System.Xml "))
1083 (("Mono\\.Data\\.Sqlite_REFS := " all)
1084 (string-append all "System.Xml "))
1085 (("System\\.Data\\.DataSetExtensions_REFS := " all)
1086 (string-append all "System.Xml "))
1087 (("System\\.Data\\.OracleClient_REFS := " all)
1088 (string-append all "System.Xml "))
1089 (("System\\.IdentityModel_REFS := " all)
1090 (string-append all "System.Configuration "))
1091 (("System\\.Design_REFS := " all)
1092 (string-append all "Accessibility "))
1093 (("System\\.Web\\.Extensions\\.Design_REFS := " all)
1094 (string-append all "System.Windows.Forms System.Web "))
1095 (("System\\.ServiceModel\\.Routing_REFS := " all)
1096 (string-append all "System.Xml "))
1097 (("System\\.Web\\.Abstractions_REFS := " all)
1098 (string-append all "System "))
1099 (("System\\.Reactive\\.Windows\\.Forms_REFS := " all)
1100 (string-append all "System "))
1101 (("System\\.Windows\\.Forms\\.DataVisualization_REFS := " all)
1102 (string-append all "Accessibility "))
1103 (("Facades/System\\.ServiceModel\\.Primitives_REFS := " all)
1104 (string-append all "System.Xml "))
1105 (("Facades/System\\.Dynamic\\.Runtime_REFS := " all)
1106 (string-append all "System "))
1107 (("Facades/System\\.Xml\\.XDocument_REFS := " all)
1108 (string-append all "System.Xml "))
1109 (("Facades/System\\.Runtime\\.Serialization.Xml_REFS := " all)
1110 (string-append all "System.Xml ")))
1111 (apply invoke "make"
1112 `(,@(if parallel-build?
1113 `("-j" ,(number->string
1114 (parallel-job-count)))
1115 '())
1116 ,(string-append "CSC=MONO_PATH="
1117 top "/mcs/class/lib/build"
1118 " "
1119 top "/runtime/mono-wrapper"
1120 " "
1121 top "/mcs/class/lib/build/mcs.exe")
1122 ,@make-flags))))))))))))
1123
1124(define mono-5.1.0-external-repo-specs
1125 '(("aspnetwebstack" "e77b12e6cc5ed260a98447f609e887337e44e299"
1126 "0rks344qr4fmp3fs1264d2qkmm348m8d1kjd7z4l94iiirwn1fq1")
1127 (("reference-assemblies" "binary-reference-assemblies")
1128 "febc100f0313f0dc9d75dd1bcea45e87134b5b55"
1129 "0lpj911m2lq23r22dpy4i02fy4ykf27dx8fvqpxsxknysj2jl6y4")
1130 ("bockbuild" "fd1d6c404d763c98b6f0e64e98ab65f92e808245"
1131 "0l2n9863j5y20lp3fjcpbb0a9jcfk0kqmnzlsw20qchd05rjgyb0")
1132 ("boringssl" "c06ac6b33d3e7442ad878488b9d1100127eff998"
1133 "187zpi1rvh9i6jfccwzqq337rxxi1rgny6mjq79r08dlrh0lydzc")
1134 ("buildtools" "b5cc6e6ab5f71f6c0be7b730058b426e92528479"
1135 "0ldj5l4p4q8j9dhk0nifr3m0i64csvb56wlc2xd4zy80sfgmjn06")
1136 ("cecil" "44bc86223530a07fa74ab87007cf264e53d63400"
1137 "0smsa8i4709y1nky3hshj7ayxhjcc17wlnfdvhfay7ly5dxml84g")
1138 (("cecil" "cecil-legacy") "33d50b874fd527118bc361d83de3d494e8bb55e1"
1139 "1p4hl1796ib26ykyf5snl6cj0lx0v7mjh0xqhjw6qdh753nsjyhb")
1140 ("corefx" "63c51e726292149b4868db71baa883e5ad173766"
1141 "1406rbra83k6gw2dnnsfqcfwiy1h89y6lq64ma5rckmb5drb0ng9")
1142 ("corert" "31eda261991f9f6c1add1686b6d3799f835b2978"
1143 "0s0pd4m9070xlx238fdhqf2b3iyd2vzff3f0sxlyi8s0lhsrl8zv")
1144 ("ikdasm" "88b67c42ca8b7d58141c176b46749819bfcef166"
1145 "0b0b1dhg80r640n81iqawwkxi1k289n4zxjfj0ldd9rkvfxvlwaw")
1146 (("ikvm-fork" "ikvm") "7c1e61bec8c069b2cc9e214c3094b147d76bbf82"
1147 "0vmc5r4j76hkd4zis1769ppdl1h1l7z8cld0y4p1m64n86ghkzfn")
1148 ("linker" "1bdcf6b7bfbe3b03fdaa76f6124d0d7374f08615"
1149 "1xx6s8dcgcz803yvqgzhcgmj16c9s8vrvvl8k4y0xma5w51kn23k")
1150 ("Lucene.Net.Light" "85978b7eb94738f516824341213d5e94060f5284"
1151 "0d118i52m3a0vfjhfci81a2kc4qvnj23gs02hrvdrfpd1q92fyii")
1152 ("Newtonsoft.Json" "471c3e0803a9f40a0acc8aeceb31de6ff93a52c4"
1153 "0dgngd5hqk6yhlg40kabn6qdnknm32zcx9q6bm2w31csnsk5978s")
1154 (("NuGet.BuildTasks" "nuget-buildtasks")
1155 "04bdab55d8de9edcf628694cfd2001561e8f8e60"
1156 "1nklxayxkdskg5wlfl44cndzqkl18v561rz03hwx7wbn5w89q775")
1157 (("NUnitLite" "nunit-lite") "690603bea98aae69fca9a65130d88591bc6cabee"
1158 "1f845ysjzs3yd9gcyww66dnkx484z5fknb8l0xz74sjmxk2mngwc")
1159 ;; ("roslyn-binaries" "0d4198b1299bcb019973749da4d47e90f15a1e46"
1160 ;; "")
1161 ("rx" "b29a4b0fda609e0af33ff54ed13652b6ccf0e05e"
1162 "1n1jwhmsbkcv2d806immcpzkb72rz04xy98myw355a8w5ah25yiv")
1163 ;; ("xunit-binaries" "b8e20d265b368dd6252703d5afd038d0b028e388"
1164 ;; "")
1165 ))
1166
1167(define-public mono-5.1.0
1168 (package
1169 (inherit mono-5.0.1)
1170 (version "5.1.0")
1171 (name "mono")
1172 (source (origin
1173 (method git-fetch)
1174 (uri (git-reference
1175 (url "https://gitlab.winehq.org/mono/mono.git")
1176 (commit "6fafd08b507c56f11a2eb6570703a39e5bdc0a81")))
1177 (file-name (git-file-name name version))
1178 (sha256
1179 (base32
1180 "1sxq40nay5ghhmfbdln98iri19y0h7q36r3pqnxmxnm94livx2k5"))
1181 (modules '((guix build utils)
1182 (ice-9 string-fun)))
1183 (snippet #~(begin
1184 #$(add-external-repos
1185 mono-5.1.0-external-repo-specs)
1186 #$@prepare-mono-source-0))))
1187 (arguments
1188 (substitute-keyword-arguments (package-arguments mono-5.0.1)
1189 ((#:phases phases #~%standard-phases)
1190 #~(modify-phases #$phases
1191 (add-after 'build 'build-resx2sr
1192 (lambda* (#:key make-flags #:allow-other-keys)
1193 (apply invoke "make" "-C" "mcs/tools/resx2sr" make-flags)))
1194 (add-after 'install 'install-resx2sr
1195 (lambda* (#:key inputs make-flags #:allow-other-keys)
1196 (apply invoke "make" "-C" "mcs/tools/resx2sr" "install" make-flags)
1197 ;; They don't install a wrapper script--but we need it for
1198 ;; bootstrapping MSBuild.
1199 (let ((resx2sr (string-append #$output "/bin/resx2sr")))
1200 (call-with-output-file resx2sr
1201 (lambda (port)
1202 (format port "#!~a
1203exec ~s ~s \"$@\"
1204"
1205 (search-input-file inputs "/bin/bash")
1206 (string-append #$output "/bin/mono")
1207 (string-append #$output "/lib/mono/4.5/resx2sr.exe"))))
1208 (chmod resx2sr #o755))))))))
1209 (native-inputs (modify-inputs (package-native-inputs mono-5.0.1)
1210 (replace "mono" mono-5.0.1)))))
1211
1212(define mono-5.2.0-external-repo-specs
1213 '(("aspnetwebstack" "e77b12e6cc5ed260a98447f609e887337e44e299"
1214 "0rks344qr4fmp3fs1264d2qkmm348m8d1kjd7z4l94iiirwn1fq1")
1215 (("reference-assemblies" "binary-reference-assemblies")
1216 "142cbeb62ffabf1dd9c1414d8dd76f93bcbed0c2"
1217 "1wkd589hgb16m5zvmp9yb57agyyryaa1jj8vhl4w20i2hp22wad9")
1218 ("bockbuild" "45aa142fa322f5b41051e7f40008f03346a1e119"
1219 "1sjlgzh3hq251k729a1px707c1q2gnfayghgx1z5qyddnyaxna20")
1220 ("boringssl" "3e0770e18835714708860ba9fe1af04a932971ff"
1221 "139a0gl91a52k2r6na6ialzkqykaj1rk88zjrkaz3sdxx7nmmg6y")
1222 ("buildtools" "b5cc6e6ab5f71f6c0be7b730058b426e92528479"
1223 "0ldj5l4p4q8j9dhk0nifr3m0i64csvb56wlc2xd4zy80sfgmjn06")
1224 ("cecil" "362e2bb00fa693d04c2d140a4cd313eb82c78d95"
1225 "0bvaavlnldrja8ixb66bg33kz05950vm5sk4pz0k0zjgspfgpcvd")
1226 (("cecil" "cecil-legacy") "33d50b874fd527118bc361d83de3d494e8bb55e1"
1227 "1p4hl1796ib26ykyf5snl6cj0lx0v7mjh0xqhjw6qdh753nsjyhb")
1228 ("corefx" "78360b22e71b70de1d8cc9588cb4ef0040449c31"
1229 "1wrszafyar7q1cdfba68xd6b4d54p3iim2czmxblms1yw19ycqm7")
1230 ("corert" "ed6296dfbb88d66f08601c013caee30c88c41afa"
1231 "179q1aiq44bzdckg1xqm6iwyx835cp6161w5vgsfrgbw0p3kidxr")
1232 ("ikdasm" "88b67c42ca8b7d58141c176b46749819bfcef166"
1233 "0b0b1dhg80r640n81iqawwkxi1k289n4zxjfj0ldd9rkvfxvlwaw")
1234 (("ikvm-fork" "ikvm") "7c1e61bec8c069b2cc9e214c3094b147d76bbf82"
1235 "0vmc5r4j76hkd4zis1769ppdl1h1l7z8cld0y4p1m64n86ghkzfn")
1236 ("linker" "c7450ca2669becddffdea7dcdcc06692e57989e1"
1237 "0vd1vw6hqm1p127m6079p9n4xrckrf4iakvj41hnqfwws94w5mv1")
1238 ("Lucene.Net.Light" "85978b7eb94738f516824341213d5e94060f5284"
1239 "0d118i52m3a0vfjhfci81a2kc4qvnj23gs02hrvdrfpd1q92fyii")
1240 ("Newtonsoft.Json" "471c3e0803a9f40a0acc8aeceb31de6ff93a52c4"
1241 "0dgngd5hqk6yhlg40kabn6qdnknm32zcx9q6bm2w31csnsk5978s")
1242 (("NuGet.BuildTasks" "nuget-buildtasks")
1243 "8d307472ea214f2b59636431f771894dbcba7258"
1244 "1h1frnj0x8k7b29ic4jisch0vlpmsmghjw554pz277f2nxaidljj")
1245 (("NUnitLite" "nunit-lite") "690603bea98aae69fca9a65130d88591bc6cabee"
1246 "1f845ysjzs3yd9gcyww66dnkx484z5fknb8l0xz74sjmxk2mngwc")
1247 ;; ("roslyn-binaries" "dcb0a0534d5104eaf945d3d1f319dc33044b7bbe"
1248 ;; "")
1249 ("rx" "b29a4b0fda609e0af33ff54ed13652b6ccf0e05e"
1250 "1n1jwhmsbkcv2d806immcpzkb72rz04xy98myw355a8w5ah25yiv")
1251 ;; ("xunit-binaries" "b8e20d265b368dd6252703d5afd038d0b028e388"
1252 ;; "")
1253 ))
1254
1255(define-public mono-5.2.0
1256 (package
1257 (inherit mono-5.1.0)
1258 (version "5.2.0.224")
1259 (name "mono")
1260 (source (origin
1261 (method git-fetch)
1262 (uri (git-reference
1263 (url "https://gitlab.winehq.org/mono/mono.git")
1264 (commit (string-append "mono-" version))))
1265 (file-name (git-file-name name version))
1266 (sha256
1267 (base32
1268 "0zsgfqyjkpix05gvgvhqyyqcwcjp5xlvcyv471q32qf307dccbfa"))
1269 (modules '((guix build utils)
1270 (ice-9 string-fun)))
1271 (snippet #~(begin
1272 #$(add-external-repos
1273 mono-5.2.0-external-repo-specs)
1274 #$@prepare-mono-source-0))))
1275 (native-inputs (modify-inputs (package-native-inputs mono-5.1.0)
1276 (replace "mono" mono-5.1.0)))))
1277
1278(define mono-5.4.0-external-repo-specs
1279 '(("aspnetwebstack" "e77b12e6cc5ed260a98447f609e887337e44e299"
1280 "0rks344qr4fmp3fs1264d2qkmm348m8d1kjd7z4l94iiirwn1fq1")
1281 ("api-doc-tools" "d03e819838c6241f92f90655cb448cc47c9e8791"
1282 "1riki79f3ig3cxigviss81dz601hn92a1gifglm0mzjbs76sf3fj"
1283 #:recursive? #t)
1284 ("api-snapshot" "b09033be33ab25113743151c644c831158c54042"
1285 "0z67iqd1brib6ni36pklrp7rlxyhri5nk3px37fm1aacgrnsk7ck")
1286 (("reference-assemblies" "binary-reference-assemblies")
1287 "142cbeb62ffabf1dd9c1414d8dd76f93bcbed0c2"
1288 "1wkd589hgb16m5zvmp9yb57agyyryaa1jj8vhl4w20i2hp22wad9")
1289 ("bockbuild" "0efdb371e6d79abc54c0e3bb3689fa1646f4394e"
1290 "10qr1m2wa3zb2i3j16i0cq49higjm451bhlqhqd4rlisqn0w8nrv")
1291 ("boringssl" "3e0770e18835714708860ba9fe1af04a932971ff"
1292 "139a0gl91a52k2r6na6ialzkqykaj1rk88zjrkaz3sdxx7nmmg6y")
1293 ("cecil" "c0eb983dac62519d3ae93a689312076aacecb723"
1294 "02i3pwpaf6q00pklfmwxhz0lgp83854dyqnvf4c1ys07cs8y1pdk")
1295 (("cecil" "cecil-legacy") "33d50b874fd527118bc361d83de3d494e8bb55e1"
1296 "1p4hl1796ib26ykyf5snl6cj0lx0v7mjh0xqhjw6qdh753nsjyhb")
1297 ("corefx" "9ad53d674e31327abcc60f35c14387700f50cc68"
1298 "0ap4g2fj8wsar4xvbc6dkd2l67qalxlcw5laplq3an5nvj2ld65w"
1299 #:patches ("corefx-mono-5.4.0-patches.patch"))
1300 ("corert" "48dba73801e804e89f00311da99d873f9c550278"
1301 "1zw47jf4cwqmaixylisxi73xf6cap41bwf9vlmpxanzxaqklzsvk")
1302 ("ikdasm" "1d7d43603791e0236b56d076578657bee44fef6b"
1303 "1kw8ykkad55qhapg6jbvqim7vainqlpz8469flm083lpz7pks3sg")
1304 (("ikvm-fork" "ikvm") "847e05fced5c9a41ff0f24f1f9d40d5a8a5772c1"
1305 "1fl9bm3lmzf8iqv3x4iqkz9fc54mwdvrxisxg2nvwwcsi4saffpi")
1306 ("linker" "99354bf5c13b8055209cb082cddc50c8047ab088"
1307 "05zlajnqf83xfvn2whh9nql6j85sq12aw26sqmyqz7zcpml171mj")
1308 ("Newtonsoft.Json" "471c3e0803a9f40a0acc8aeceb31de6ff93a52c4"
1309 "0dgngd5hqk6yhlg40kabn6qdnknm32zcx9q6bm2w31csnsk5978s")
1310 (("NuGet.BuildTasks" "nuget-buildtasks")
1311 "b58ba4282377bcefd48abdc2d62ce6330e079abe"
1312 "1say03fnqkjsx97zacany3sa5j4mhfk827hkwp23ib02q18f7lvp")
1313 (("NUnitLite" "nunit-lite") "690603bea98aae69fca9a65130d88591bc6cabee"
1314 "1f845ysjzs3yd9gcyww66dnkx484z5fknb8l0xz74sjmxk2mngwc")
1315 ;; ("roslyn-binaries" "1904c7d0682a878e2d25b4d49f3475d12fbb9cc6"
1316 ;; "")
1317 ("rx" "b29a4b0fda609e0af33ff54ed13652b6ccf0e05e"
1318 "1n1jwhmsbkcv2d806immcpzkb72rz04xy98myw355a8w5ah25yiv")
1319 ;; ("xunit-binaries" "d4433b0972f40cb3efaa3fbba52869bde5df8fa8"
1320 ;; "")
1321 ))
1322
1323(define-public mono-5.4.0
1324 (package
1325 (inherit mono-5.2.0)
1326 (version "5.4.0.212")
1327 (name "mono")
1328 (source (origin
1329 (method git-fetch)
1330 (uri
1331 (git-reference
1332 (url "https://gitlab.winehq.org/mono/mono.git")
1333 (commit
1334 ;; 5.4.0.135 and before have a bug that makes mono not
1335 ;; self-hosting (fails to compile self, example error:
1336 ;; System.Data.SqlClient/SqlTransaction.cs(39,22): error
1337 ;; CS0738: `System.Data.SqlClient.SqlTransaction' does not
1338 ;; implement interface member
1339 ;; `System.Data.IDbTransaction.Connection.get' and the best
1340 ;; implementing candidate
1341 ;; `System.Data.SqlClient.SqlTransaction.Connection.get'
1342 ;; return type `System.Data.SqlClient.SqlConnection' does not
1343 ;; match interface member return type
1344 ;; `System.Data.IDbConnection'
1345
1346 ;; Note: in above example, SqlConnection implements
1347 ;; IDbConnection. My understanding is that for this to
1348 ;; compile properly, we need covariant return types, which is
1349 ;; a C# 9.0 feature, but somehow the same code has been
1350 ;; compiled just fine by previous versions of mono, and is
1351 ;; compiled fine by this version, but not specific 5.4.0.XXX
1352 ;; versions.
1353 "mono-5.4.0.212")))
1354 (file-name (git-file-name name version))
1355 (sha256
1356 (base32
1357 "0gx3fxz1wlq5fkj7iphv32vg9m78ia74m9pgn9rab4fyq2k9an2y"))
1358 (modules '((guix build utils)
1359 (ice-9 string-fun)))
1360 (snippet #~(begin
1361 #$(add-external-repos
1362 mono-5.4.0-external-repo-specs)
1363 #$@prepare-mono-source-0))
1364 (patches (search-patches "mono-5.4.0-patches.patch"))))
1365 (native-inputs (modify-inputs (package-native-inputs mono-5.2.0)
1366 (replace "mono" mono-5.2.0)))))
1367
1368(define mono-pre-5.8.0-external-repo-specs
1369 '(("api-doc-tools" "d03e819838c6241f92f90655cb448cc47c9e8791"
1370 "1riki79f3ig3cxigviss81dz601hn92a1gifglm0mzjbs76sf3fj"
1371 #:recursive? #t)
1372 ("api-snapshot" "e790a9b77031ef1d8ebf093ef88840edea11ed73"
1373 "1c4np2fqd9mpc1i1x8bsxnypacp58vkvgdwpnmvmlyjdvbj5ax6q")
1374 ("aspnetwebstack" "e77b12e6cc5ed260a98447f609e887337e44e299"
1375 "0rks344qr4fmp3fs1264d2qkmm348m8d1kjd7z4l94iiirwn1fq1")
1376 (("reference-assemblies" "binary-reference-assemblies")
1377 "142cbeb62ffabf1dd9c1414d8dd76f93bcbed0c2"
1378 "1wkd589hgb16m5zvmp9yb57agyyryaa1jj8vhl4w20i2hp22wad9")
1379 ("bockbuild" "b445017309aac741a26d8c51bb0636234084bf23"
1380 "1jzhvavd1j0n7sy1waczgjv0kmrbr35gkzd76fhlmqvsy0sr9695")
1381 ("boringssl" "3e0770e18835714708860ba9fe1af04a932971ff"
1382 "139a0gl91a52k2r6na6ialzkqykaj1rk88zjrkaz3sdxx7nmmg6y")
1383 ("cecil" "c76ba7b410447fa37093150cb7bc772cba28a0ae"
1384 "0ydi7rn8ajqyvnj9agyn74llb4qgd9kgdcg3gajdfyb2klxx6za8")
1385 (("cecil" "cecil-legacy") "33d50b874fd527118bc361d83de3d494e8bb55e1"
1386 "1p4hl1796ib26ykyf5snl6cj0lx0v7mjh0xqhjw6qdh753nsjyhb")
1387 ("corefx" "74ccd8aa00d7d271191ca3b9c4f818268dc36c28"
1388 "0nm41qdpvj62r8bxnf92m7kimjm1i544ygdqz5a7pgc6zf99as6j"
1389 #:patches ("corefx-mono-pre-5.8.0-patches.patch"))
1390 ("corert" "48dba73801e804e89f00311da99d873f9c550278"
1391 "1zw47jf4cwqmaixylisxi73xf6cap41bwf9vlmpxanzxaqklzsvk")
1392 ("ikdasm" "3aef9cdd6013fc0620a1817f0b11d8fb90ed2e0f"
1393 "078cai33x8c71969iwi7hmbqdfwpicpmam2ag3k2bklpva2vnszv")
1394 (("ikvm-fork" "ikvm") "847e05fced5c9a41ff0f24f1f9d40d5a8a5772c1"
1395 "1fl9bm3lmzf8iqv3x4iqkz9fc54mwdvrxisxg2nvwwcsi4saffpi")
1396 ("linker" "21e445c26c69ac3a2e1441befa02d0bd105ff849"
1397 "1hx3ik0sg70ysc2y8jdjxm2ljql0069i05i8fp1lakx7s7z7bywc")
1398 ("Newtonsoft.Json" "471c3e0803a9f40a0acc8aeceb31de6ff93a52c4"
1399 "0dgngd5hqk6yhlg40kabn6qdnknm32zcx9q6bm2w31csnsk5978s")
1400 (("NuGet.BuildTasks" "nuget-buildtasks")
1401 "8d307472ea214f2b59636431f771894dbcba7258"
1402 "1h1frnj0x8k7b29ic4jisch0vlpmsmghjw554pz277f2nxaidljj")
1403 (("NUnitLite" "nunit-lite") "690603bea98aae69fca9a65130d88591bc6cabee"
1404 "1f845ysjzs3yd9gcyww66dnkx484z5fknb8l0xz74sjmxk2mngwc")
1405 ;; ("roslyn-binaries" "80b86f340b7f6fb7afe84443214e1cbd7ff70620"
1406 ;; "")
1407 ("rx" "b29a4b0fda609e0af33ff54ed13652b6ccf0e05e"
1408 "1n1jwhmsbkcv2d806immcpzkb72rz04xy98myw355a8w5ah25yiv")
1409 ;; ("xunit-binaries" "d4433b0972f40cb3efaa3fbba52869bde5df8fa8"
1410 ;; "")
1411 ))
1412
1413(define-public mono-pre-5.8.0
1414 (let ((commit "d0f51b4e834042cfa593748ada942033b458cc40")
1415 (version "5.4.0.201")
1416 (revision "0"))
1417 (package
1418 (inherit mono-5.4.0)
1419 (version (git-version version revision commit))
1420 (name "mono")
1421 (source (origin
1422 (method git-fetch)
1423 (uri (git-reference
1424 (url "https://gitlab.winehq.org/mono/mono.git")
1425 (commit commit)))
1426 (file-name (git-file-name name version))
1427 (sha256
1428 (base32
1429 "0az5syk1nn9gd5imkbmpb13qm9q6ibr2d2ksdzpwsarkfyp4ic53"))
1430 (modules '((guix build utils)
1431 (ice-9 string-fun)))
1432 (snippet #~(begin
1433 #$(add-external-repos
1434 mono-pre-5.8.0-external-repo-specs)
1435 #$@prepare-mono-source-0))
1436 (patches (search-patches "mono-5.4.0-patches.patch"))))
1437 (native-inputs (modify-inputs (package-native-inputs mono-5.4.0)
1438 (replace "mono" mono-5.4.0)))
1439 (arguments
1440 (substitute-keyword-arguments (package-arguments mono-5.4.0)
1441 ((#:phases phases #~%standard-phases)
1442 #~(modify-phases #$phases
1443 (delete 'patch-sub-autogen.sh-shebang))))))))
1444
1445(define mono-5.8.0-external-repo-specs
1446 '(("api-doc-tools" "d03e819838c6241f92f90655cb448cc47c9e8791"
1447 "1riki79f3ig3cxigviss81dz601hn92a1gifglm0mzjbs76sf3fj"
1448 #:recursive? #t)
1449 ("api-snapshot" "6668c80a9499218c0b8cc41f48a9e242587df756"
1450 "0vbwbwa1hr4jlj7283w8bk3v5i8s43h8413r2pkh4hf38b2rks7d")
1451 ("aspnetwebstack" "e77b12e6cc5ed260a98447f609e887337e44e299"
1452 "0rks344qr4fmp3fs1264d2qkmm348m8d1kjd7z4l94iiirwn1fq1")
1453 (("reference-assemblies" "binary-reference-assemblies")
1454 "e048fe4a88d237d105ae02fe0363a68296099362"
1455 "0i87i3x694f4g8s2flflv0ah88blxds7gbiyrwrmscqdjsifhy49")
1456 ("bockbuild" "cb4545409dafe16dfe86c7d8e6548a69c369e2a2"
1457 "0svdfv61d6ppwd4zgki129r9prf75fnsqihna253zfwfpzpingx7")
1458 ("boringssl" "3e0770e18835714708860ba9fe1af04a932971ff"
1459 "139a0gl91a52k2r6na6ialzkqykaj1rk88zjrkaz3sdxx7nmmg6y")
1460 ("cecil" "76ffcdabae660e9586273c9b40db180a0dc8d4c8"
1461 "0f3bsfri28pxmnb0m6074bnmmjgsr7cjixv9fhnp6aimhvy4l5p4")
1462 (("cecil" "cecil-legacy") "33d50b874fd527118bc361d83de3d494e8bb55e1"
1463 "1p4hl1796ib26ykyf5snl6cj0lx0v7mjh0xqhjw6qdh753nsjyhb")
1464 ("corefx" "b965d1f8b5281712c4400ef28ed97670ffd4880d"
1465 "0r9hr0bs3j3agqi2pq4n1km9jfycaqvxf6756y7r5l3ykqsd6wsr")
1466 ("corert" "48dba73801e804e89f00311da99d873f9c550278"
1467 "1zw47jf4cwqmaixylisxi73xf6cap41bwf9vlmpxanzxaqklzsvk")
1468 ("ikdasm" "465c0815558fd43c0110f8d00fc186ac0044ac6a"
1469 "0xir7pcgq04hb7s8g9wsqdrypb6l29raj3iz5rcqzdm0056k75w2")
1470 (("ikvm-fork" "ikvm") "847e05fced5c9a41ff0f24f1f9d40d5a8a5772c1"
1471 "1fl9bm3lmzf8iqv3x4iqkz9fc54mwdvrxisxg2nvwwcsi4saffpi")
1472 ("linker" "c62335c350f3902ff0459112f7efc8b926f4f15d"
1473 "015191sdw9i7vnhlsycv65pw8nnfpkd65k11jw1y9bikb4x3aj8x")
1474 ("Newtonsoft.Json" "471c3e0803a9f40a0acc8aeceb31de6ff93a52c4"
1475 "0dgngd5hqk6yhlg40kabn6qdnknm32zcx9q6bm2w31csnsk5978s")
1476 (("NuGet.BuildTasks" "nuget-buildtasks")
1477 "b2c30bc81b2a7733a4eeb252a55f6b4d50cfc3a1"
1478 "01vajrfx6y12f525xdiwfbn9qzmym2s65rbiqpy9d9xw0pnq7gbl")
1479 (("NUnitLite" "nunit-lite") "764656cdafdb3acd25df8cb52a4e0ea14760fccd"
1480 "0pc7lk3p916is8cn4ngaqvjlmlzv3vvjpyksy4pvb3qb5iiaw0vq")
1481 ;; ("roslyn-binaries" "e484c75e2edd3c3f1870a2468a71a56220cf1f7f"
1482 ;; "")
1483 ("rx" "b29a4b0fda609e0af33ff54ed13652b6ccf0e05e"
1484 "1n1jwhmsbkcv2d806immcpzkb72rz04xy98myw355a8w5ah25yiv")
1485 ;; ("xunit-binaries" "d4433b0972f40cb3efaa3fbba52869bde5df8fa8"
1486 ;; "")
1487 ))
1488
1489(define-public mono-5.8.0
1490 (package
1491 (inherit mono-pre-5.8.0)
1492 (version "5.8.0.129")
1493 (name "mono")
1494 (source (origin
1495 (method git-fetch)
1496 (uri (git-reference
1497 (url "https://gitlab.winehq.org/mono/mono.git")
1498 (commit (string-append "mono-" version))))
1499 (file-name (git-file-name name version))
1500 (sha256
1501 (base32
1502 "0130vd33yzp4w7570qw9xjq2g7b2xmacjbpkmzrpbhy8as5hy4z6"))
1503 (modules '((guix build utils)
1504 (ice-9 string-fun)))
1505 (snippet #~(begin
1506 #$(add-external-repos
1507 mono-5.8.0-external-repo-specs)
1508 #$@prepare-mono-source-0))
1509 (patches (search-patches "mono-5.8.0-patches.patch"))))
1510 (native-inputs (modify-inputs (package-native-inputs mono-pre-5.8.0)
1511 (replace "mono" mono-pre-5.8.0)))
1512 (arguments
1513 (substitute-keyword-arguments (package-arguments mono-pre-5.8.0)
1514 ((#:phases phases #~%standard-phases)
1515 #~(modify-phases #$phases
1516 (replace 'build-reference-assemblies
1517 ;; More references need updating this time...
1518 (lambda* (#:key make-flags parallel-build? #:allow-other-keys)
1519 (let ((top (getcwd))
1520 ;; parallel-build? needs to be false for mono's build
1521 ;; phase, but it should work here.
1522 (parallel-build? #t))
1523 (with-directory-excursion
1524 "external/binary-reference-assemblies"
1525 (substitute* (find-files "." "^Makefile$")
1526 (("CSC_COMMON_ARGS := " all)
1527 (string-append all "-delaysign+ "))
1528 (("IBM\\.Data\\.DB2_REFS := " all)
1529 (string-append all "System.Xml "))
1530 (("Mono\\.Data\\.Sqlite_REFS := " all)
1531 (string-append all "System.Xml "))
1532 (("System\\.Data\\.DataSetExtensions_REFS := " all)
1533 (string-append all "System.Xml "))
1534 (("System\\.Data\\.OracleClient_REFS := " all)
1535 (string-append all "System.Xml "))
1536 (("System\\.IdentityModel_REFS := " all)
1537 (string-append all "System.Configuration "))
1538 (("System\\.Design_REFS := " all)
1539 (string-append all "Accessibility "))
1540 (("System\\.Web\\.Extensions\\.Design_REFS := " all)
1541 (string-append all "System.Windows.Forms System.Web "))
1542 (("System\\.ServiceModel\\.Routing_REFS := " all)
1543 (string-append all "System.Xml "))
1544 (("System\\.Web\\.Abstractions_REFS := " all)
1545 (string-append all "System "))
1546 (("System\\.Reactive\\.Windows\\.Forms_REFS := " all)
1547 (string-append all "System "))
1548 (("System\\.Windows\\.Forms\\.DataVisualization_REFS := " all)
1549 (string-append all "Accessibility "))
1550 (("Facades/System\\.ServiceModel\\.Primitives_REFS := " all)
1551 (string-append all "System.Xml "))
1552 (("Facades/System\\.Dynamic\\.Runtime_REFS := " all)
1553 (string-append all "System "))
1554 (("Facades/System\\.Xml\\.XDocument_REFS := " all)
1555 (string-append all "System.Xml "))
1556 (("Facades/System\\.Runtime\\.Serialization.Xml_REFS := " all)
1557 (string-append all "System.Xml "))
1558 (("Facades/System\\.Data\\.Common_REFS := " all)
1559 (string-append all "System System.Xml ")))
1560 (apply invoke "make"
1561 `(,@(if parallel-build?
1562 `("-j" ,(number->string
1563 (parallel-job-count)))
1564 '())
1565 ,(string-append "CSC=MONO_PATH="
1566 top "/mcs/class/lib/build"
1567 " "
1568 top "/runtime/mono-wrapper"
1569 " "
1570 top "/mcs/class/lib/build/mcs.exe")
1571 ,@make-flags))))))))))))
1572
1573(define mono-pre-5.10.0-external-repo-specs
1574 '(("api-doc-tools" "d03e819838c6241f92f90655cb448cc47c9e8791"
1575 "1riki79f3ig3cxigviss81dz601hn92a1gifglm0mzjbs76sf3fj"
1576 #:recursive? #t)
1577 ("api-snapshot" "627333cae84f02a36ee9ca605c96dac4557d9f35"
1578 "0p9c6brxiwx38yvaf55jd0l1mxfj3b5ah0xas2hv6frkz80yrqdl")
1579 ("aspnetwebstack" "e77b12e6cc5ed260a98447f609e887337e44e299"
1580 "0rks344qr4fmp3fs1264d2qkmm348m8d1kjd7z4l94iiirwn1fq1")
1581 (("reference-assemblies" "binary-reference-assemblies")
1582 "9c5cc7f051a0bba2e41341a5baebfc4d2c2133ef"
1583 "14bfn1qvni8gyfxjwmvykyjjy3j5ng4fnbljdadi9dm4b9al0wg1")
1584 ("bockbuild" "29022af5d8a94651b2eece93f910559b254ec3f0"
1585 "0lclc1smmrj6xw32dll073mxw4ddiixv9arv02yw3w5h135ay7w4")
1586 ("boringssl" "3e0770e18835714708860ba9fe1af04a932971ff"
1587 "139a0gl91a52k2r6na6ialzkqykaj1rk88zjrkaz3sdxx7nmmg6y")
1588 ("cecil" "bc11f472954694ebd92ae4956f110c1036a7c2e0"
1589 "122nnp5pcnw18pj6amnqkqxlrmapd4vy9xs65hd0bqyqjh56bwnd")
1590 (("cecil" "cecil-legacy") "33d50b874fd527118bc361d83de3d494e8bb55e1"
1591 "1p4hl1796ib26ykyf5snl6cj0lx0v7mjh0xqhjw6qdh753nsjyhb")
1592 ("corefx" "cb1b049c95227465c1791b857cb5ba86385d9f29"
1593 "1pr0qjlgxf63zs1g80gqd6x3qhlgb0wlcc8zm8z8am5aywrvgb53")
1594 ("corert" "48dba73801e804e89f00311da99d873f9c550278"
1595 "1zw47jf4cwqmaixylisxi73xf6cap41bwf9vlmpxanzxaqklzsvk")
1596 ("ikdasm" "465c0815558fd43c0110f8d00fc186ac0044ac6a"
1597 "0xir7pcgq04hb7s8g9wsqdrypb6l29raj3iz5rcqzdm0056k75w2")
1598 (("ikvm-fork" "ikvm") "847e05fced5c9a41ff0f24f1f9d40d5a8a5772c1"
1599 "1fl9bm3lmzf8iqv3x4iqkz9fc54mwdvrxisxg2nvwwcsi4saffpi")
1600 ("linker" "99354bf5c13b8055209cb082cddc50c8047ab088"
1601 "05zlajnqf83xfvn2whh9nql6j85sq12aw26sqmyqz7zcpml171mj")
1602 ("Newtonsoft.Json" "471c3e0803a9f40a0acc8aeceb31de6ff93a52c4"
1603 "0dgngd5hqk6yhlg40kabn6qdnknm32zcx9q6bm2w31csnsk5978s")
1604 (("NuGet.BuildTasks" "nuget-buildtasks")
1605 "b58ba4282377bcefd48abdc2d62ce6330e079abe"
1606 "1say03fnqkjsx97zacany3sa5j4mhfk827hkwp23ib02q18f7lvp")
1607 (("NUnitLite" "nunit-lite") "764656cdafdb3acd25df8cb52a4e0ea14760fccd"
1608 "0pc7lk3p916is8cn4ngaqvjlmlzv3vvjpyksy4pvb3qb5iiaw0vq")
1609 ;; ("roslyn-binaries" "1904c7d0682a878e2d25b4d49f3475d12fbb9cc6"
1610 ;; "")
1611 ("rx" "b29a4b0fda609e0af33ff54ed13652b6ccf0e05e"
1612 "1n1jwhmsbkcv2d806immcpzkb72rz04xy98myw355a8w5ah25yiv")
1613 ;; ("xunit-binaries" "d4433b0972f40cb3efaa3fbba52869bde5df8fa8"
1614 ;; "")
1615 ))
1616
1617(define-public mono-pre-5.10.0
1618 (let ((commit "3e9d7d6e9cf8dc33eb29c497c350a1cd7df3a057")
1619 (version "5.8.0.129")
1620 (revision "0"))
1621 (package
1622 (inherit mono-5.8.0)
1623 (version (git-version version revision commit))
1624 (name "mono")
1625 (source (origin
1626 (method git-fetch)
1627 (uri (git-reference
1628 (url "https://gitlab.winehq.org/mono/mono.git")
1629 (commit commit)))
1630 (file-name (git-file-name name version))
1631 (sha256
1632 (base32
1633 "0m8i0zgzh0fgb3ssy95v9czk1c0rl76q0jj7834s5fjnkdj8l4jb"))
1634 (modules '((guix build utils)
1635 (ice-9 string-fun)))
1636 (snippet #~(begin
1637 #$(add-external-repos
1638 mono-pre-5.10.0-external-repo-specs)
1639 #$@prepare-mono-source-0))
1640 (patches (search-patches "mono-mcs-patches-from-5.10.0.patch"))))
1641 (native-inputs (modify-inputs (package-native-inputs mono-5.8.0)
1642 (replace "mono" mono-5.8.0))))))
1643
1644(define mono-5.10.0-external-repo-specs
1645 '(("api-doc-tools" "d03e819838c6241f92f90655cb448cc47c9e8791"
1646 "1riki79f3ig3cxigviss81dz601hn92a1gifglm0mzjbs76sf3fj"
1647 #:recursive? #t)
1648 ("api-snapshot" "da8bb8c7b970383ce26c9b09ce3689d843a6222e"
1649 "00kxw09yirdh0bzkvs0v3h6bkdjv9d4g9agn3b8640awvpym3yqw")
1650 ("aspnetwebstack" "e77b12e6cc5ed260a98447f609e887337e44e299"
1651 "0rks344qr4fmp3fs1264d2qkmm348m8d1kjd7z4l94iiirwn1fq1")
1652 (("reference-assemblies" "binary-reference-assemblies")
1653 "e048fe4a88d237d105ae02fe0363a68296099362"
1654 "0i87i3x694f4g8s2flflv0ah88blxds7gbiyrwrmscqdjsifhy49")
1655 ("bockbuild" "1908d43ec630544189bd11630a59ec4ef571db28"
1656 "1h13lgic2dwnbzc58nqhjhagn0f100nl5mhzryjdmypgrf3cr1b3")
1657 ("boringssl" "3e0770e18835714708860ba9fe1af04a932971ff"
1658 "139a0gl91a52k2r6na6ialzkqykaj1rk88zjrkaz3sdxx7nmmg6y")
1659 ("cecil" "dfee11e80d59e1a3d6d9c914c3f277c726bace52"
1660 "1y2f59v988y2llqpqi0zl9ly0lkym8zw0a4vkav7cpp6m5mkq208")
1661 (("cecil" "cecil-legacy") "33d50b874fd527118bc361d83de3d494e8bb55e1"
1662 "1p4hl1796ib26ykyf5snl6cj0lx0v7mjh0xqhjw6qdh753nsjyhb")
1663 ("corefx" "e327d2855ed74dac96f684797e4820345297a690"
1664 "11pinnn8zwf4hi0gfj98cyqkmh7wrmd5mhcdm84gkl9s2g18iaq0")
1665 ("corert" "aa64b376c1a2238b1a768e158d1b11dac77d722a"
1666 "1gg4m49s0ry5yx96dwjary7r395ypzzg4ssz1ajld2x5g7ggvwgg")
1667 ("ikdasm" "465c0815558fd43c0110f8d00fc186ac0044ac6a"
1668 "0xir7pcgq04hb7s8g9wsqdrypb6l29raj3iz5rcqzdm0056k75w2")
1669 (("ikvm-fork" "ikvm") "847e05fced5c9a41ff0f24f1f9d40d5a8a5772c1"
1670 "1fl9bm3lmzf8iqv3x4iqkz9fc54mwdvrxisxg2nvwwcsi4saffpi")
1671 ("linker" "84d37424cde6e66bbf997110a4dbdba7e60038e9"
1672 "07ffkc9ijzsdvbkrc1fn5sb25sgxyabs54kzyblwkzparwj047qr")
1673 ("Newtonsoft.Json" "471c3e0803a9f40a0acc8aeceb31de6ff93a52c4"
1674 "0dgngd5hqk6yhlg40kabn6qdnknm32zcx9q6bm2w31csnsk5978s")
1675 (("NuGet.BuildTasks" "nuget-buildtasks")
1676 "b2c30bc81b2a7733a4eeb252a55f6b4d50cfc3a1"
1677 "01vajrfx6y12f525xdiwfbn9qzmym2s65rbiqpy9d9xw0pnq7gbl")
1678 (("NUnitLite" "nunit-lite") "70bb70b0ffd0109aadaa6e4ea178972d4fb63ea3"
1679 "0ln7rn1960cdwmfqcscp2d2ncpwnknhq9rf8v53ay8g2c3g6gh4q")
1680 ;; ("roslyn-binaries" "00da53c4746250988a92055ef3ac653ccf84fc40"
1681 ;; "")
1682 ("rx" "b29a4b0fda609e0af33ff54ed13652b6ccf0e05e"
1683 "1n1jwhmsbkcv2d806immcpzkb72rz04xy98myw355a8w5ah25yiv")
1684 ;; ("xunit-binaries" "c5a907be25c201cda38bec99f6c82548ab3d9b5a"
1685 ;; "")
1686 ))
1687
1688(define-public mono-5.10.0
1689 (package
1690 (inherit mono-pre-5.10.0)
1691 (version "5.10.0.179")
1692 (name "mono")
1693 (source (origin
1694 (method git-fetch)
1695 (uri (git-reference
1696 (url "https://gitlab.winehq.org/mono/mono.git")
1697 (commit (string-append "mono-" version))))
1698 (file-name (git-file-name name version))
1699 (sha256
1700 (base32
1701 "1zvib164w4mzrsk06ym9my0208ccdanja2fx6x6mlyib358h3626"))
1702 (modules '((guix build utils)
1703 (ice-9 string-fun)))
1704 (snippet #~(begin
1705 #$(add-external-repos
1706 mono-5.10.0-external-repo-specs)
1707 #$@prepare-mono-source-0))
1708 (patches (search-patches "mono-5.10.0-later-mcs-changes.patch"))))
1709 (native-inputs (modify-inputs (package-native-inputs mono-pre-5.10.0)
1710 (replace "mono" mono-pre-5.10.0)
1711 (append python-minimal-wrapper)))
1712 (arguments
1713 (substitute-keyword-arguments (package-arguments mono-pre-5.10.0)
1714 ((#:phases phases #~%standard-phases)
1715 #~(modify-phases #$phases
1716 ;; Build now relies on these being built before any mcs is built;
1717 ;; have to use the input mcs.
1718 (delete 'build-reference-assemblies)
1719 (add-before 'build 'build-reference-assemblies
1720 (lambda* (#:key make-flags parallel-build? #:allow-other-keys)
1721 (let ((top (getcwd))
1722 ;; parallel-build? needs to be false for mono's build
1723 ;; phase, but it should work here.
1724 (parallel-build? #t))
1725 (with-directory-excursion
1726 "external/binary-reference-assemblies"
1727 (substitute* (find-files "." "^Makefile$")
1728 (("CSC_COMMON_ARGS := " all)
1729 (string-append all "-delaysign+ "))
1730 (("IBM\\.Data\\.DB2_REFS := " all)
1731 (string-append all "System.Xml "))
1732 (("Mono\\.Data\\.Sqlite_REFS := " all)
1733 (string-append all "System.Xml "))
1734 (("System\\.Data\\.DataSetExtensions_REFS := " all)
1735 (string-append all "System.Xml "))
1736 (("System\\.Data\\.OracleClient_REFS := " all)
1737 (string-append all "System.Xml "))
1738 (("System\\.IdentityModel_REFS := " all)
1739 (string-append all "System.Configuration "))
1740 (("System\\.Design_REFS := " all)
1741 (string-append all "Accessibility "))
1742 (("System\\.Web\\.Extensions\\.Design_REFS := " all)
1743 (string-append all "System.Windows.Forms System.Web "))
1744 (("System\\.ServiceModel\\.Routing_REFS := " all)
1745 (string-append all "System.Xml "))
1746 (("System\\.Web\\.Abstractions_REFS := " all)
1747 (string-append all "System "))
1748 (("System\\.Reactive\\.Windows\\.Forms_REFS := " all)
1749 (string-append all "System "))
1750 (("System\\.Windows\\.Forms\\.DataVisualization_REFS := " all)
1751 (string-append all "Accessibility "))
1752 (("Facades/System\\.ServiceModel\\.Primitives_REFS := " all)
1753 (string-append all "System.Xml "))
1754 (("Facades/System\\.Dynamic\\.Runtime_REFS := " all)
1755 (string-append all "System "))
1756 (("Facades/System\\.Xml\\.XDocument_REFS := " all)
1757 (string-append all "System.Xml "))
1758 (("Facades/System\\.Runtime\\.Serialization.Xml_REFS := " all)
1759 (string-append all "System.Xml "))
1760 (("Facades/System\\.Data\\.Common_REFS := " all)
1761 (string-append all "System System.Xml ")))
1762 (apply invoke "make"
1763 `(,@(if parallel-build?
1764 `("-j" ,(number->string
1765 (parallel-job-count)))
1766 '())
1767 "CSC=mcs"
1768 ,@make-flags))))))))))))
1769
1770(define-public libgdiplus
1771 (package
1772 (name "libgdiplus")
1773 (version "6.2")
1774 (source
1775 (origin
1776 (method git-fetch)
1777 (uri (git-reference
1778 (url "https://gitlab.winehq.org/mono/libgdiplus.git")
1779 (commit version)))
1780 (file-name (git-file-name name version))
1781 (sha256
1782 (base32 "0m3pcl5hx35r7kwrr1hzqdrhw5bw29bl4w5fnsvcynmz4hg9vmd2"))
1783 (modules '((guix build utils)))
1784 (snippet #~(substitute* "./Makefile.am"
1785 (("\\./update_submodules\\.sh")
1786 ":")))))
1787 (build-system gnu-build-system)
1788 (native-inputs
1789 (list automake
1790 autoconf
1791 googletest-1.8
1792 libtool
1793 pkg-config
1794 which))
1795 (inputs (list cairo
1796 freetype
1797 fontconfig
1798 gettext-minimal
1799 giflib
1800 glib
1801 libexif
1802 libjpeg-turbo
1803 libpng
1804 libtiff
1805 libx11))
1806 (synopsis "Open Source implementation of the GDI+ API")
1807 (description "Libgdiplus is the Mono library that provides a
1808GDI+-compatible API on non-Windows operating systems. It uses Cairo to do
1809most of the heavy lifting.")
1810 (home-page "https://gitlab.winehq.org/mono/libgdiplus")
1811 (license license:expat)))
1812
1813(define mono-6.12.0-external-repo-specs
1814 '(("api-doc-tools" "5da8127af9e68c9d58a90aa9de21f57491d81261"
1815 "0rq8dxmy5av36nd298k60d8s386zhqlw63yn2ywc0416xsflscg4"
1816 #:recursive? #t)
1817 ("api-snapshot" "808e8a9e4be8d38e097d2b0919cac37bc195844a"
1818 "1i5migdw649bmxqii99q2hd6vka11wlcphfrm98kb7pprz4k401a")
1819 ("aspnetwebstack" "e77b12e6cc5ed260a98447f609e887337e44e299"
1820 "0rks344qr4fmp3fs1264d2qkmm348m8d1kjd7z4l94iiirwn1fq1")
1821 ;; (("https://github.com/Unity-Technologies/bdwgc" "bdwgc")
1822 ;; "a27eddb837d613cb4cf436405c23ce39ed16a86d"
1823 ;; "")
1824 (("reference-assemblies" "binary-reference-assemblies")
1825 "e68046d5106aa0349c23f95821456955fc15b96b"
1826 "1mqpz274qdhl84y6x8bazrfmajcf6qagiks2g0gyg4qyqwgrp490")
1827 ("bockbuild" "3bd44f6784b85b1ece8b00b13d12cf416f5a87e7"
1828 "0z3d8qylfwnlklpcvsmsgy5n248gcff5vmzqjzalfj7d1h7vcjxs")
1829 ("boringssl" "296137cf989688b03ed89f72cd7bfd86d470441e"
1830 "11ghdayfcvysnh1617bj478hxrg7b43jpk7vgafm6jb7ykpxl8fa")
1831 ("cecil" "8021f3fbe75715a1762e725594d8c00cce3679d8"
1832 "0j19lwbs30y2xz8myk0fbxs4hbal1p8vqjmnkvn301v0xxacynxm")
1833 (("cecil" "cecil-legacy") "33d50b874fd527118bc361d83de3d494e8bb55e1"
1834 "1p4hl1796ib26ykyf5snl6cj0lx0v7mjh0xqhjw6qdh753nsjyhb")
1835 ("corefx" "c4eeab9fc2faa0195a812e552cd73ee298d39386"
1836 "03530pf6dddqlihvb83m9z34bark8mzrffnrclq726gndfg4vqs8")
1837 ("corert" "11136ad55767485063226be08cfbd32ed574ca43"
1838 "1g0q83fff13237nwsfcmk7fmzwx0kv93zsqqybcigwip5x6ani8f")
1839 ("helix-binaries" "64b3a67631ac8a08ff82d61087cfbfc664eb4af8"
1840 "1f6kkpbzj3bx9p1hb36kzjq0ppckk4rpmjnr82hyq7y18fwikfd7")
1841 ("ikdasm" "f0fd66ea063929ef5d51aafdb10832164835bb0f"
1842 "0313pvmmjh01h9b306jd6cd6fcbnbxaglaj81m0l0acf4yn7zb10")
1843 (("ikvm-fork" "ikvm") "08266ac8c0b620cc929ffaeb1f23ac37629ce825"
1844 "1g0v1v8nvxkwq7w9qyqhf9kgmxq3qm6rsw4al8x0w3dmbgxjhqjv")
1845 ("illinker-test-assets" "ec9eb51af2eb07dbe50a2724db826bf3bfb930a6"
1846 "1b4vq4jbgnl4lzffg02n5w1sppg2k6bfks0150pj403sbnml85gl")
1847 ("linker" "ed4a9413489aa29a70e41f94c3dac5621099f734"
1848 "16rdpch9anarnhczi441a9zna4rz93jwpb31x0dzrb4j03cxajg2")
1849 ;; (("https://github.com/dotnet/llvm-project" "llvm-project")
1850 ;; "7dfdea1267f0a40955e02567dcbcd1bcb987e825"
1851 ;; "")
1852 ("Newtonsoft.Json" "471c3e0803a9f40a0acc8aeceb31de6ff93a52c4"
1853 "0dgngd5hqk6yhlg40kabn6qdnknm32zcx9q6bm2w31csnsk5978s")
1854 (("NuGet.BuildTasks" "nuget-buildtasks")
1855 "99558479578b1d6af0f443bb411bc3520fcbae5c"
1856 "1434m6z9sb7bvki9ba6iinqpmh4a4iyld76jz10qz07sycklflq3")
1857 (("NUnitLite" "nunit-lite") "a977ca57572c545e108b56ef32aa3f7ff8287611"
1858 "02zwdfpw8pazllwbp4hkzqwfql98g4854diykqdb9wa0vrb8w4sj")
1859 ;; ("roslyn-binaries" "1c6482470cd219dcc7503259a20f26a1723f20ec"
1860 ;; "")
1861 ("rx" "b29a4b0fda609e0af33ff54ed13652b6ccf0e05e"
1862 "1n1jwhmsbkcv2d806immcpzkb72rz04xy98myw355a8w5ah25yiv")
1863 ;; ("xunit-binaries" "8f6e62e1c016dfb15420852e220e07091923734a"
1864 ;; "")
1865 ))
1866
1867(define mono-bootstrap
1868 (package
1869 (inherit mono-5.10.0)
1870 (version "6.12.0.206")
1871 (name "mono")
1872 (source (origin
1873 (method git-fetch)
1874 (uri (git-reference
1875 (url "https://gitlab.winehq.org/mono/mono.git")
1876 (commit (string-append "mono-" version))))
1877 (file-name (git-file-name name version))
1878 (sha256
1879 (base32
1880 "1cw9v53bgbc6v7xmp5ij76y6inb6sz1g1zx2jk825rxshq96alvk"))
1881 (modules '((guix build utils)
1882 (ice-9 string-fun)))
1883 (snippet #~(begin
1884 #$(add-external-repos
1885 mono-6.12.0-external-repo-specs)
1886 #$@prepare-mono-source-0))
1887 (patches (search-patches "mono-6.12.0-fix-ConditionParser.patch"
1888 "mono-6.12.0-add-runpath.patch"
1889 "mono-6.12.0-emit-ref-readonly-return-modreq.patch"
1890 "mono-6.12.0-fix-AssemblyResolver.patch"))))
1891 (native-inputs (modify-inputs (package-native-inputs mono-5.10.0)
1892 (replace "mono" mono-5.10.0)))
1893 (inputs (modify-inputs (package-inputs mono-5.10.0)
1894 (append libgdiplus unixodbc)))
1895 (arguments
1896 (substitute-keyword-arguments
1897 (strip-keyword-arguments (list #:parallel-build?)
1898 (package-arguments mono-5.10.0))
1899 ((#:modules modules '((guix build gnu-build-system)
1900 (guix build utils)))
1901 `((sxml simple)
1902 ,@modules))
1903 ((#:make-flags make-flags #~'())
1904 #~(append #$make-flags
1905 (list
1906 (string-append "PLATFORM_DISABLED_TESTS="
1907 ;; segfaults (!), reason unknown
1908 "safehandle.2.exe"
1909 ;; unclear why these fail
1910 "bug-10834.exe"
1911 "bug-60848.exe"
1912 ;; these are tests of microsoft
1913 ;; telemetry. They fail because
1914 ;; microsoft telemetry is only
1915 ;; enabled on OSX. No idea why
1916 ;; these tests are run by default.
1917 "merp-crash-test.exe"
1918 "merp-json-valid.exe"))))
1919 ((#:phases phases #~%standard-phases)
1920 #~(modify-phases #$phases
1921 (delete 'patch-sgen-linking)
1922 (delete 'patch-sub-autogen.sh-shebang)
1923 ;; Our 5.10.0 compiler has been rather souped up.
1924 (add-after 'unpack 'disable-profile-version-check
1925 (lambda _
1926 (substitute* "mcs/build/common/basic-profile-check.cs"
1927 (("min_mono_version = .*")
1928 "min_mono_version = new Version (0, 0);\n"))))
1929 (add-after 'unpack 'disable-c#-8.0-tests
1930 ;; These aren't compilable by mcs
1931 (lambda _
1932 (substitute* "mono/mini/Makefile.am.in"
1933 (("-langversion:8\\.0")
1934 ""))
1935 (substitute* "mono/tests/Makefile.am"
1936 ((" (dim-generic|dim-issue-18917|interface-2|delegate18|generic-unmanaged-constraint|async-generic-enum)\\.cs.*")
1937 ""))))
1938 (add-after 'unpack 'disable-verification-error
1939 (lambda _
1940 ;; For some reason verification fails complaining about a bunch
1941 ;; of missing icalls.
1942 (substitute* "runtime/Makefile.am"
1943 ((" fi; done; done;")
1944 " fi; done; done; ok=:;"))))
1945 ;; This requires binary blobs to be used, it doesn't provide a
1946 ;; clear way to regenerate them and no corresponding source is
1947 ;; linked, plus from what little I know of it it sounds like it's
1948 ;; not something we need at all?
1949 (add-after 'unpack 'disable-helix-client
1950 (lambda _
1951 (substitute* "mcs/tools/Makefile"
1952 (("mono-helix-client")
1953 ""))))
1954 (replace 'build-reference-assemblies
1955 (lambda* (#:key make-flags #:allow-other-keys)
1956 (let ((top (getcwd)))
1957 (with-directory-excursion
1958 "external/binary-reference-assemblies"
1959 (substitute* (find-files "." "^Makefile$")
1960 (("CSC_COMMON_ARGS := " all)
1961 (string-append all "-delaysign+ "))
1962 (("IBM\\.Data\\.DB2_REFS := " all)
1963 (string-append all "System.Xml "))
1964 (("Mono\\.Data\\.Sqlite_REFS := " all)
1965 (string-append all "System.Xml "))
1966 (("System\\.Data\\.DataSetExtensions_REFS := " all)
1967 (string-append all "System.Xml "))
1968 (("System\\.Data\\.OracleClient_REFS := " all)
1969 (string-append all "System.Xml "))
1970 (("System\\.IdentityModel_REFS := " all)
1971 (string-append all "System.Configuration "))
1972 (("System\\.Design_REFS := " all)
1973 (string-append all "Accessibility "))
1974 (("System\\.Web\\.Extensions\\.Design_REFS := " all)
1975 (string-append all "System.Windows.Forms System.Web "))
1976 (("System\\.ServiceModel\\.Routing_REFS := " all)
1977 (string-append all "System.Xml "))
1978 (("System\\.Web\\.Abstractions_REFS := " all)
1979 (string-append all "System "))
1980 (("System\\.Reactive\\.Windows\\.Forms_REFS := " all)
1981 (string-append all "System "))
1982 (("System\\.Windows\\.Forms\\.DataVisualization_REFS := " all)
1983 (string-append all "Accessibility "))
1984 (("Facades/System\\.ServiceModel\\.Primitives_REFS := " all)
1985 (string-append all "System.Xml "))
1986 (("Facades/System\\.Dynamic\\.Runtime_REFS := " all)
1987 (string-append all "System "))
1988 (("Facades/System\\.Xml\\.XDocument_REFS := " all)
1989 (string-append all "System.Xml "))
1990 (("Facades/System\\.Runtime\\.Serialization.Xml_REFS := " all)
1991 (string-append all "System.Xml "))
1992 (("Facades/System\\.Data\\.Common_REFS := " all)
1993 (string-append all "System System.Xml ")))
1994 (substitute* "build/monodroid/Makefile"
1995 (("ECMA_KEY := \\.\\./\\.\\./\\.\\./\\.\\./\\.\\./mono/")
1996 ;; it should only be 4 directories up, and it's in
1997 ;; mcs/, not mono/mcs/
1998 "ECMA_KEY := ../../../../"))
1999 (apply invoke "make" "-j" (number->string
2000 (parallel-job-count))
2001 "CSC=mcs" make-flags)))))
2002 (add-after 'unpack 'enable-resx2sr-installation
2003 (lambda* (#:key make-flags #:allow-other-keys)
2004 (substitute* "mcs/tools/resx2sr/Makefile"
2005 (("^NO_INSTALL = .*")
2006 "NO_INSTALL = \n"))))
2007 (replace 'check
2008 (lambda* (#:key tests? (make-flags '()) #:allow-other-keys)
2009 (when tests?
2010 ;; There are more tests than these, but they depend on
2011 ;; external/xunit-binaries, so we limit ourselves to the
2012 ;; tests that debian runs.
2013 (with-directory-excursion "mono/mini"
2014 (apply invoke "make" "check" make-flags))
2015 (with-directory-excursion "mono/tests"
2016 (apply invoke "make" "check" make-flags)))))
2017 (add-after 'install 'configure-external-libs
2018 (lambda* (#:key inputs #:allow-other-keys)
2019 (let ((gac (string-append #$output
2020 "/lib/mono/gac"))
2021 (libgdiplus (search-input-file inputs "/lib/libgdiplus.so.0"))
2022 (libx11 (search-input-file inputs "/lib/libX11.so.6"))
2023 (unixodbc (search-input-file inputs "/lib/libodbc.so.2")))
2024 ;;; gamin purposefully not fixed since nowadays mono can
2025 ;;; just use inotify--and does.
2026 (for-each
2027 (lambda (name)
2028 (call-with-output-file (string-append name ".config")
2029 (lambda (port)
2030 (sxml->xml
2031 `(configuration
2032 (dllmap (@ (dll "libodbc.so.2")
2033 (target ,unixodbc))))
2034 port))))
2035 (find-files gac "^System[.]Data[.]dll$"))
2036 (for-each
2037 (lambda (name)
2038 (call-with-output-file (string-append name ".config")
2039 (lambda (port)
2040 (sxml->xml
2041 `(configuration (dllmap (@ (dll "gdiplus")
2042 (target ,libgdiplus))))
2043 port))))
2044 (find-files gac "^System[.]Drawing[.]dll$"))
2045 (for-each
2046 (lambda (name)
2047 (call-with-output-file (string-append name ".config")
2048 (lambda (port)
2049 (sxml->xml
2050 `(configuration (dllmap (@ (dll "libX11")
2051 (target ,libx11))))
2052 port))))
2053 (find-files gac "^System[.]Windows[.]Forms[.]dll$")))))))))))
2054
2055(define-public mono-system-collections-immutable-bootstrap
2056 (hidden-package
2057 (package
2058 (name "mono-system-collections-immutable-bootstrap")
2059 (version
2060 (package-version mono-bootstrap))
2061 (source
2062 (package-source mono-bootstrap))
2063 (build-system gnu-build-system)
2064 (native-inputs
2065 (list mono-bootstrap))
2066 (arguments
2067 (list #:tests? #f ; tests would require xunit which is not in the bootstrap path.
2068 #:phases
2069 #~(modify-phases %standard-phases
2070 (add-after 'unpack 'prepare
2071 (lambda _
2072 (chdir "external/corefx/src/System.Collections.Immutable/src")
2073 (substitute* "../../Common/src/System/SR.cs"
2074 ;; I don't want to drag System.Security.AccessControl into the bootstrap path.
2075 (("new ResourceManager[(]ResourceType[)]")
2076 "new ResourceManager(\"System.Collections.Immutable\", typeof(SR).Assembly)"))))
2077 (delete 'configure) ; no "configure" script exists
2078 (replace 'build
2079 (lambda* (#:key inputs #:allow-other-keys)
2080 (invoke "resx2sr" "-o" "SR.cs" "-n" "System.SR"
2081 "--warn-mismatch"
2082 "Resources/Strings.resx")
2083 (apply invoke "mcs"
2084 "-target:library"
2085 "-langversion:7.2"
2086 ;;; mono can't do it: "-d:FEATURE_ITEMREFAPI"
2087 "-out:System.Collections.Immutable.dll"
2088 "../../Common/src/System/Runtime/Versioning/NonVersionableAttribute.cs"
2089 "../../Common/src/System/SR.cs"
2090 (find-files "." "\\.cs$"))))
2091 (replace 'install
2092 (lambda* (#:key outputs #:allow-other-keys)
2093 (let* ((lib-dir (string-append #$output "/lib/mono/4.5")))
2094 (mkdir-p lib-dir)
2095 (install-file "System.Collections.Immutable.dll"
2096 lib-dir)))))))
2097 (synopsis "System.Collections.Immutable library for bootstrapping")
2098 (description "This package builds the System.Collections.Immutable library from
2099the source code included within the Mono source tree.")
2100 (home-page "https://dot.net/")
2101 (license license:expat))))
2102
2103(define-public mono-system-reflection-metadata-bootstrap
2104 (hidden-package
2105 (package
2106 (name "mono-system-reflection-metadata-bootstrap")
2107 ;; Upstream version 1.4.2; but for bootstrap packages it's more useful to have the mono version here.
2108 (version
2109 (package-version mono-bootstrap))
2110 (source
2111 (package-source mono-bootstrap))
2112 (build-system gnu-build-system)
2113 (inputs
2114 (list mono-system-collections-immutable-bootstrap)) ; not required: mono-system-buffers-bootstrap
2115 (native-inputs
2116 (list mono-bootstrap))
2117 (arguments
2118 (list #:tests? #f ; would require xunit which is not in the bootstrap path
2119 #:phases
2120 #~(modify-phases %standard-phases
2121 (add-after 'unpack 'chdir
2122 (lambda _
2123 (chdir "external/corefx/src/System.Reflection.Metadata/src")
2124 (substitute* "../../Common/src/System/SR.cs"
2125 ;; I don't want to drag System.Security.AccessControl into the bootstrap path.
2126 (("new ResourceManager[(]ResourceType[)]")
2127 "new ResourceManager(\"System.Collections.Immutable\", typeof(SR).Assembly)"))))
2128 (add-after 'chdir 'prepare
2129 (lambda* (#:key inputs #:allow-other-keys)
2130 (for-each
2131 (lambda (name)
2132 (if (file-exists? name)
2133 (delete-file name)
2134 (format #t "Warning: File ~s doesn't exist~%" name)))
2135 ;; We don't need those since they would be for different .NET standards.
2136 '("./System/Reflection/Internal/Utilities/CriticalDisposableObject.netstandard1.1.cs"
2137 "./System/Reflection/Internal/Utilities/EncodingHelper.netcoreapp.cs"
2138 "./System/Reflection/Internal/Utilities/FileStreamReadLightUp.netstandard1.1.cs"
2139 "./System/Reflection/Internal/Utilities/MemoryMapLightUp.netstandard1.1.cs"))))
2140 (delete 'configure) ; no "configure" script exists
2141 (replace 'build
2142 (lambda* (#:key inputs outputs #:allow-other-keys)
2143 (invoke "resx2sr" "-o" "SR.cs" "-n" "System.SR" "--warn-mismatch"
2144 "Resources/Strings.resx")
2145 (apply invoke "mcs"
2146 "-target:library"
2147 "-langversion:7.2"
2148 "-unsafe"
2149 "-out:System.Reflection.Metadata.dll"
2150 (string-append "-r:"
2151 (search-input-file inputs
2152 "/lib/mono/4.5/System.Collections.Immutable.dll"))
2153 "../../Common/src/System/SR.cs"
2154 (find-files "." "\\.cs$"))))
2155 (replace 'install
2156 (lambda* (#:key outputs #:allow-other-keys)
2157 (let* ((lib-dir (string-append #$output "/lib/mono/4.5")))
2158 (install-file "System.Reflection.Metadata.dll" lib-dir)))))))
2159 (synopsis "System.Reflection.Metadata library for bootstrapping")
2160 (description "This package builds the System.Reflection.Metadata library from
2161the source code included within the Mono source tree.")
2162 (home-page "https://dot.net/")
2163 (license license:expat))))
2164
2165;;;
2166;;; Bootstrap chain: mcs -> csc 2.0 (C# 7.0) -> csc 2.3 (C# 7.1) -> csc 2.8 (C# 7.2)
2167;;;
2168
2169(define %srm-source-dir
2170 (file-append (package-source mono-bootstrap)
2171 "/external/corefx/src/System.Reflection.Metadata/src"))
2172
2173(define %roslyn-stale-files
2174 '("src/Compilers/Core/Portable/TextLineSpan.cs"
2175 "src/Compilers/Core/Portable/Serialization/SimpleRecordingObjectBinder.cs"
2176 "src/Compilers/Core/Portable/System/Reflection/BlobBuilder.cs"
2177 "src/Compilers/Core/Portable/System/Reflection/BlobWriter.cs"
2178 "src/Compilers/Core/Portable/System/Reflection/Internal/Utilities/BlobUtilities.cs"
2179 "src/Compilers/Core/Portable/System/Reflection/Metadata/Ecma335/MetadataBuilder.Tables.cs"
2180 "src/Compilers/Core/Portable/System/Reflection/Metadata/Ecma335/MetadataBuilder.Heaps.cs"
2181 "src/Compilers/Core/Portable/NativePdbWriter/IUnsafeComStream.cs"
2182 "src/Compilers/Core/Portable/NativePdbWriter/ComMemoryStream.cs"
2183 "src/Compilers/CSharp/Portable/FlowAnalysis/AbstractFlowPass.AbstractLocalState.cs"
2184 "src/Compilers/CSharp/Portable/Compiler/Compiler.cs"
2185 "src/Compilers/CSharp/Portable/Lowering/TempHelpers.cs"
2186 "src/Compilers/CSharp/Portable/Lowering/StateMachineRewriter/StateMachineHoistedLocalSymbol.cs"))
2187
2188
2189;;;
2190;;; roslyn-2.0: bootstrapped from Mono's mcs
2191;;;
2192
2193(define-public roslyn-2.0
2194 (package
2195 (name "roslyn")
2196 (version "2.0.0")
2197 (source
2198 (origin
2199 (method git-fetch)
2200 (uri (git-reference
2201 (url "https://github.com/dotnet/roslyn")
2202 (commit (string-append "version-" version))))
2203 (file-name (git-file-name name version))
2204 (sha256
2205 (base32
2206 "1gimga04ripx5znkh6gxr9k7179n032mcvl9w7wc2rfx7wrnly4a"))
2207 (patches
2208 (search-patches "roslyn-2.0.0-bootstrap-with-mono.patch"))))
2209 (build-system gnu-build-system)
2210 (inputs (list bash-minimal
2211 mono-bootstrap
2212 mono-system-collections-immutable-bootstrap))
2213 (arguments
2214 (list
2215 #:tests? #f
2216 #:modules '((guix build gnu-build-system)
2217 (guix build utils)
2218 (ice-9 rdelim))
2219 #:phases
2220 #~(modify-phases %standard-phases
2221 ;; mcs-specific workarounds.
2222 (add-after 'unpack 'fix-compiler-compat
2223 (lambda _
2224 ;; mcs crashes on "is null" at emit time in yield methods.
2225 (for-each
2226 (lambda (file)
2227 (substitute* file ((" is null")
2228 " == null")))
2229 (append
2230 (find-files "src/Compilers/Core/Portable" "\\.cs$")
2231 (find-files "src/Compilers/Core/AnalyzerDriver" "\\.cs$")
2232 (find-files "src/Compilers/CSharp/Portable" "\\.cs$")
2233 (find-files "src/Compilers/Shared" "\\.cs$")
2234 (find-files "src/Dependencies" "\\.cs$")))
2235 ;; mcs crashes emitting "out var" inside yield methods.
2236 (substitute*
2237 "src/Dependencies/CodeAnalysis.Metadata/CustomDebugInfoReader.cs"
2238 (("out var globalVersion, out var globalCount")
2239 "out byte globalVersion, out byte globalCount")
2240 (("out var version, out var kind, out var size, out var alignmentSize")
2241 "out byte version, out CustomDebugInfoKind kind, out int size, out int alignmentSize")
2242 (("out var tempMethodToken")
2243 "out int tempMethodToken"))
2244 (substitute* "src/Dependencies/PooledObjects/ArrayBuilder.cs"
2245 (("out var bucket") "out ArrayBuilder<T> bucket"))
2246 ;; mcs does not track definite assignment through "?.".
2247 (substitute*
2248 "src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs"
2249 (("GlobalExpressionVariable field;")
2250 "GlobalExpressionVariable field = null;"))))
2251
2252 ;; Mono mscorlib compatibility (shared by all versions).
2253 (add-after 'fix-compiler-compat 'fix-mono-compat
2254 (lambda _
2255 (substitute*
2256 "src/Compilers/Core/Portable/InternalUtilities/KeyValuePair.cs"
2257 (("static class KeyValuePair")
2258 "static class KeyValuePairUtil"))
2259 (for-each
2260 (lambda (file)
2261 (substitute* file
2262 (("KeyValuePair\\.Create") "KeyValuePairUtil.Create")))
2263 (append
2264 (find-files "src/Compilers/Core/Portable" "\\.cs$")
2265 (find-files "src/Compilers/CSharp/Portable" "\\.cs$")))
2266 (substitute* "src/Compilers/Core/Portable/EncodedStringText.cs"
2267 (("if \\(CodePagesEncodingProvider\\.Instance != null\\)")
2268 "if (false)")
2269 (("Encoding\\.RegisterProvider\\(CodePagesEncodingProvider\\.Instance\\);")
2270 "// not available in Mono"))))
2271
2272 ;; SRM inline compilation conflicts (shared by all versions).
2273 (add-after 'fix-mono-compat 'fix-srm-inline
2274 (lambda _
2275 (substitute*
2276 "src/Compilers/Core/Portable/Emit/EditAndContinue/DeltaMetadataWriter.cs"
2277 (("var writer = PooledBlobBuilder")
2278 "var writer = Microsoft.Cci.PooledBlobBuilder"))
2279 (substitute* (list
2280 "src/Compilers/Core/Portable/Compilation/Compilation.cs"
2281 "src/Compilers/Core/Portable/StrongName/StrongNameProvider.cs")
2282 (("\\bPathUtilities\\.")
2283 "Roslyn.Utilities.PathUtilities."))
2284 (substitute* "src/Compilers/Core/Portable/PEWriter/PeWriter.cs"
2285 (("protected override void Serialize\\(BlobBuilder builder, SectionLocation location\\)")
2286 "protected internal override void Serialize(BlobBuilder builder, SectionLocation location)"))))
2287
2288 (add-after 'fix-srm-inline 'remove-stale-files
2289 (lambda _
2290 (for-each
2291 (lambda (f) (when (file-exists? f) (delete-file f)))
2292 '#$%roslyn-stale-files)))
2293
2294 ;; ComMemoryStream is used by the Windows native PDB writer.
2295 ;; On Linux we never write native PDBs, but the type must
2296 ;; exist for compilation.
2297 (add-after 'remove-stale-files 'create-com-memory-stream-stub
2298 (lambda _
2299 (call-with-output-file
2300 "src/Compilers/Core/Portable/NativePdbWriter/ComMemoryStream.cs"
2301 (lambda (port)
2302 (display
2303 "using System; using System.IO;
2304namespace Roslyn.Utilities
2305{
2306 internal sealed class ComMemoryStream : Stream
2307 {
2308 public override bool CanRead => false;
2309 public override bool CanSeek => true;
2310 public override bool CanWrite => true;
2311 public override long Length => _length;
2312 public override long Position { get; set; }
2313 private long _length;
2314 public override void Flush() {}
2315 public override int Read(byte[] b, int o, int c)
2316 => throw new NotSupportedException();
2317 public override long Seek(long o, SeekOrigin so) => 0;
2318 public override void SetLength(long v) { _length = v; }
2319 public override void Write(byte[] b, int o, int c) {}
2320 internal byte[] GetChunks() => Array.Empty<byte>();
2321 }
2322}
2323" port)))))
2324
2325 (delete 'configure)
2326
2327 ;; Create a compiler wrapper so the build phase can use "csc"
2328 ;; uniformly. Inherited versions replace this phase to point
2329 ;; at the previously-built csc instead of mcs.
2330 (add-before 'build 'create-csc-wrapper
2331 (lambda _
2332 (mkdir-p "bootstrap-bin")
2333 (call-with-output-file "bootstrap-bin/csc"
2334 (lambda (port)
2335 (format port "#!~a~%exec mcs -langversion:7.2 \"$@\"~%"
2336 (which "bash"))))
2337 (chmod "bootstrap-bin/csc" #o755)
2338 (setenv "PATH"
2339 (string-append (getcwd) "/bootstrap-bin:"
2340 (getenv "PATH")))))
2341
2342 ;; Response file for additional compiler flags. Empty by
2343 ;; default; roslyn-2.8 replaces this to add -langversion:7.1.
2344 (add-before 'build 'create-csc-rsp
2345 (lambda _
2346 (call-with-output-file "csc.rsp"
2347 (lambda (port) #t))))
2348
2349 ;; Generate bootstrap support files (SR class, IVT, .resources).
2350 (replace 'build
2351 (lambda _
2352 ;; Bootstrap SR class from SRM string resources.
2353 (invoke "resx2sr" "-o" "srm-strings.cs" "-n" "System.SR"
2354 "--warn-mismatch"
2355 (string-append #$%srm-source-dir "/Resources/Strings.resx"))
2356 (call-with-output-file "bootstrap-sr.cs"
2357 (lambda (port)
2358 (display
2359 "namespace System
2360{
2361 internal class SR
2362 {
2363 internal static string Format(string f, object a0) => string.Format(f, a0);
2364 internal static string Format(string f, object a0, object a1) => string.Format(f, a0, a1);
2365 internal static string Format(string f, object a0, object a1, object a2) => string.Format(f, a0, a1, a2);
2366 internal static string Format(string f, params object[] args) => string.Format(f, args);
2367" port)
2368 (call-with-input-file "srm-strings.cs"
2369 (lambda (in)
2370 (let loop ()
2371 (let ((line (read-line in)))
2372 (unless (eof-object? line)
2373 (when (string-contains line "public const")
2374 (display line port)
2375 (newline port))
2376 (loop))))))
2377 (display " }\n}\n" port)))
2378 ;; InternalsVisibleTo attributes.
2379 (call-with-output-file "bootstrap-ivt.cs"
2380 (lambda (port)
2381 (display
2382 "using System.Runtime.CompilerServices;
2383[assembly: InternalsVisibleTo(\"Microsoft.CodeAnalysis.CSharp\")]
2384[assembly: InternalsVisibleTo(\"csc\")]
2385[assembly: InternalsVisibleTo(\"Microsoft.CodeAnalysis.CompilerServer\")]
2386[assembly: InternalsVisibleTo(\"VBCSCompiler\")]
2387" port)))
2388 (call-with-output-file "bootstrap-csharp-ivt.cs"
2389 (lambda (port)
2390 (format port
2391 "using System.Runtime.CompilerServices;
2392using System.Reflection;
2393[assembly: InternalsVisibleTo(\"csc\")]
2394[assembly: AssemblyVersion(\"~a.0\")]
2395[assembly: AssemblyFileVersion(\"~a.0\")]
2396[assembly: AssemblyInformationalVersion(\"~a\")]
2397" #$(package-version this-package) #$(package-version this-package) #$(package-version this-package))))
2398 ;; .resources from .resx.
2399 (invoke "resgen"
2400 "src/Compilers/Core/Portable/CodeAnalysisResources.resx"
2401 "Microsoft.CodeAnalysis.CodeAnalysisResources.resources")
2402 (invoke "resgen"
2403 "src/Compilers/CSharp/Portable/CSharpResources.resx"
2404 "Microsoft.CodeAnalysis.CSharp.CSharpResources.resources")))
2405
2406 ;; Build code generators from XML and run them.
2407 ;; roslyn-2.8 deletes this phase (uses checked-in generated files).
2408 (add-after 'build 'generate-source
2409 (lambda _
2410 (mkdir-p "generated")
2411 (apply invoke "csc" "@csc.rsp"
2412 "-out:generated/CSharpSyntaxGenerator.exe"
2413 "-r:System.dll" "-r:System.Core.dll"
2414 "-r:System.Xml.dll" "-r:System.Xml.Linq.dll"
2415 (find-files
2416 "src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator"
2417 "\\.cs$"))
2418 (invoke "mono" "generated/CSharpSyntaxGenerator.exe"
2419 "src/Compilers/CSharp/Portable/Syntax/Syntax.xml"
2420 "generated/")
2421 (apply invoke "csc" "@csc.rsp"
2422 "-out:generated/BoundTreeGenerator.exe"
2423 "-r:System.dll" "-r:System.Core.dll"
2424 "-r:System.Xml.dll" "-r:System.Xml.Linq.dll"
2425 (find-files
2426 "src/Tools/Source/CompilerGeneratorTools/Source/BoundTreeGenerator"
2427 "\\.cs$"))
2428 (invoke "mono" "generated/BoundTreeGenerator.exe" "CSharp"
2429 "src/Compilers/CSharp/Portable/BoundTree/BoundNodes.xml"
2430 "generated/BoundNodes.xml.Generated.cs")
2431 (apply invoke "csc" "@csc.rsp"
2432 "-out:generated/CSharpErrorFactsGenerator.exe"
2433 "-r:System.dll" "-r:System.Core.dll"
2434 (find-files
2435 "src/Tools/Source/CompilerGeneratorTools/Source/CSharpErrorFactsGenerator"
2436 "\\.cs$"))
2437 (invoke "mono" "generated/CSharpErrorFactsGenerator.exe"
2438 "src/Compilers/CSharp/Portable/Errors/ErrorCode.cs"
2439 "generated/ErrorFacts.Generated.cs")))
2440
2441 ;; Prepare SRM source for inline compilation.
2442 ;; roslyn-2.0 uses the original source (mcs handles C# 7.2).
2443 ;; roslyn-2.3 and roslyn-2.8 replace this to copy+patch for
2444 ;; C# 7.2 -> 7.0/7.1 downgrades.
2445 (add-after 'generate-source 'prepare-srm-source
2446 (lambda _ #t))
2447
2448 ;; Compile the three assemblies.
2449 (add-after 'prepare-srm-source 'compile
2450 (lambda* (#:key inputs #:allow-other-keys)
2451 (let* ((sci-dll
2452 (search-input-file
2453 inputs "/lib/mono/4.5/System.Collections.Immutable.dll"))
2454 (srm-dir
2455 (if (file-exists? "srm-src-patched")
2456 "srm-src-patched"
2457 #$%srm-source-dir))
2458 (srm-source-files
2459 (filter
2460 (lambda (f)
2461 (not (or (string-contains f "netstandard")
2462 (string-contains f "netcoreapp")
2463 (string-contains f "AssemblyInfo")
2464 (string-suffix? "/SR.cs" f))))
2465 (find-files srm-dir "\\.cs$")))
2466 (deps-dir
2467 (if (file-exists? "src/Dependencies/CodeAnalysis.Metadata")
2468 "src/Dependencies/CodeAnalysis.Metadata"
2469 "src/Dependencies/CodeAnalysis.Debugging")))
2470
2471 ;; 1. Microsoft.CodeAnalysis.dll
2472 (apply invoke "csc" "@csc.rsp" "-target:library" "-unsafe"
2473 "-out:Microsoft.CodeAnalysis.dll"
2474 (string-append
2475 "-resource:Microsoft.CodeAnalysis.CodeAnalysisResources.resources"
2476 ",Microsoft.CodeAnalysis.CodeAnalysisResources.resources")
2477 "-r:System.dll" "-r:System.Core.dll"
2478 "-r:System.Xml.dll" "-r:System.Xml.Linq.dll"
2479 "-r:System.Numerics.dll" "-r:System.IO.Compression.dll"
2480 "-r:System.Security.dll"
2481 "-r:System.Runtime.Serialization.dll"
2482 (string-append "-r:" sci-dll)
2483 "-d:COMPILERCORE" "-d:SRM"
2484 "bootstrap-sr.cs" "bootstrap-ivt.cs"
2485 "src/Compilers/Shared/CoreClrShim.cs"
2486 "src/Compilers/Shared/DesktopShim.cs"
2487 (append
2488 (find-files "src/Compilers/Core/Portable" "\\.cs$")
2489 (find-files "src/Compilers/Core/AnalyzerDriver" "\\.cs$")
2490 (find-files deps-dir "\\.cs$")
2491 (find-files "src/Dependencies/PooledObjects" "\\.cs$")
2492 srm-source-files))
2493
2494 ;; 2. Microsoft.CodeAnalysis.CSharp.dll
2495 (apply invoke "csc" "@csc.rsp" "-target:library" "-unsafe"
2496 "-out:Microsoft.CodeAnalysis.CSharp.dll"
2497 (string-append
2498 "-resource:Microsoft.CodeAnalysis.CSharp.CSharpResources.resources"
2499 ",Microsoft.CodeAnalysis.CSharp.CSharpResources.resources")
2500 "-r:System.dll" "-r:System.Core.dll"
2501 "-r:System.Xml.dll" "-r:System.Xml.Linq.dll"
2502 "-r:System.Numerics.dll" "-r:System.IO.Compression.dll"
2503 (string-append "-r:" sci-dll)
2504 "-r:Microsoft.CodeAnalysis.dll"
2505 "bootstrap-csharp-ivt.cs"
2506 "src/Compilers/CSharp/CSharpAnalyzerDriver/CSharpDeclarationComputer.cs"
2507 (append
2508 (find-files "src/Compilers/CSharp/Portable" "\\.cs$")
2509 ;; Generated source files (from generate-source phase
2510 ;; or checked into the source tree).
2511 (if (file-exists? "generated")
2512 (find-files "generated" "\\.cs$")
2513 '())))
2514
2515 ;; 3. csc.exe
2516 (invoke "csc" "@csc.rsp" "-out:csc.exe"
2517 "-r:System.dll" "-r:System.Core.dll"
2518 (string-append "-r:" sci-dll)
2519 "-r:Microsoft.CodeAnalysis.dll"
2520 "-r:Microsoft.CodeAnalysis.CSharp.dll"
2521 "src/Compilers/CSharp/csc/Program.cs"
2522 "src/Compilers/Shared/Csc.cs"
2523 "src/Compilers/Shared/BuildClient.cs"
2524 "src/Compilers/Shared/BuildServerConnection.cs"
2525 "src/Compilers/Shared/DesktopBuildClient.cs"
2526 "src/Compilers/Shared/DesktopAnalyzerAssemblyLoader.cs"
2527 "src/Compilers/Shared/ExitingTraceListener.cs"
2528 "src/Compilers/Shared/CoreClrShim.cs"
2529 "src/Compilers/Shared/DesktopShim.cs"
2530 "src/Compilers/Core/CommandLine/BuildProtocol.cs"
2531 "src/Compilers/Core/CommandLine/NativeMethods.cs"
2532 "src/Compilers/Core/CommandLine/ConsoleUtil.cs"
2533 "src/Compilers/Core/CommandLine/CompilerServerLogger.cs"))))
2534
2535 (replace 'install
2536 (lambda* (#:key inputs outputs #:allow-other-keys)
2537 (let* ((out (assoc-ref outputs "out"))
2538 (lib (string-append out "/lib/roslyn"))
2539 (bin (string-append out "/bin"))
2540 (sci-dll (search-input-file
2541 inputs
2542 "/lib/mono/4.5/System.Collections.Immutable.dll")))
2543 (mkdir-p lib)
2544 (mkdir-p bin)
2545 (install-file "csc.exe" lib)
2546 (install-file "Microsoft.CodeAnalysis.dll" lib)
2547 (install-file "Microsoft.CodeAnalysis.CSharp.dll" lib)
2548 (symlink sci-dll
2549 (string-append lib "/System.Collections.Immutable.dll"))
2550 (call-with-output-file (string-append bin "/csc")
2551 (lambda (port)
2552 (format port "#!~a~%exec ~a ~a/csc.exe \"$@\"~%"
2553 (search-input-file inputs "/bin/bash")
2554 (search-input-file inputs "/bin/mono")
2555 lib)))
2556 (chmod (string-append bin "/csc") #o755)))))))
2557 (home-page "https://github.com/dotnet/roslyn")
2558 (synopsis "C# 7.0 compiler bootstrapped from source with Mono")
2559 (description
2560 "This package provides the Roslyn C# compiler (@command{csc}), built
2561entirely from source using Mono's @command{mcs}. It produces a C# 7.0
2562compiler that can be used to bootstrap newer Roslyn versions.")
2563 (license license:asl2.0)
2564 (properties '((hidden? #t)))))
2565
2566
2567;;;
2568;;; roslyn-2.3: inherits roslyn-2.0, built with csc 2.0
2569;;;
2570
2571(define-public roslyn-2.3
2572 (package
2573 (inherit roslyn-2.0)
2574 (version "2.3.0")
2575 (source
2576 (origin
2577 (method git-fetch)
2578 (uri (git-reference
2579 (url "https://github.com/dotnet/roslyn")
2580 (commit (string-append "version-" version))))
2581 (file-name (git-file-name "roslyn" version))
2582 (sha256
2583 (base32
2584 "1hr7lh7vm8lbj73a63xwlwwgmwm068mll1rcihn2cmg5bi5jkzp6"))
2585 (patches
2586 (search-patches "roslyn-2.3.0-default-literal-for-csc-2.0.patch"))))
2587 (native-inputs (list roslyn-2.0))
2588 (arguments
2589 (substitute-keyword-arguments arguments
2590 ((#:phases phases '())
2591 #~(modify-phases #$phases
2592 ;; Replace mcs-specific fixes with csc-2.0-specific fixes.
2593 (replace 'fix-compiler-compat
2594 (lambda _
2595 ;; csc 2.0 does not support "= default)" (C# 7.1).
2596 (substitute* "src/Compilers/Core/Portable/AdditionalTextFile.cs"
2597 (("CancellationToken cancellationToken = default\\)")
2598 "CancellationToken cancellationToken = default(CancellationToken))"))
2599 (substitute* "src/Compilers/Core/Portable/FileSystemExtensions.cs"
2600 (("CancellationToken cancellationToken = default\\)")
2601 "CancellationToken cancellationToken = default(CancellationToken))"))))
2602
2603 ;; Delete pre-generated files; we regenerate from XML.
2604 (add-after 'remove-stale-files 'delete-generated-files
2605 (lambda _
2606 (for-each delete-file
2607 (find-files "src/Compilers/CSharp/Portable/Generated"
2608 "\\.cs$"))))
2609
2610 ;; Replace the mcs wrapper with one that calls roslyn-2.0's csc.
2611 ;; Mono's /bin/csc is broken (points at nonexistent csc.exe),
2612 ;; so we must ensure our wrapper is found first.
2613 (replace 'create-csc-wrapper
2614 (lambda* (#:key inputs #:allow-other-keys)
2615 (mkdir-p "bootstrap-bin")
2616 (call-with-output-file "bootstrap-bin/csc"
2617 (lambda (port)
2618 (format port "#!~a~%exec mono ~a \"$@\"~%"
2619 (which "bash")
2620 (string-append (assoc-ref inputs "roslyn") "/lib/roslyn/csc.exe"))))
2621 (chmod "bootstrap-bin/csc" #o755)
2622 (setenv "PATH"
2623 (string-append (getcwd) "/bootstrap-bin:"
2624 (getenv "PATH")))))
2625
2626 ;; SRM source needs C# 7.2 -> 7.0 downgrades for csc 2.0.
2627 (replace 'prepare-srm-source
2628 (lambda _
2629 (copy-recursively #$%srm-source-dir "srm-src-patched")
2630 (for-each make-file-writable
2631 (find-files "srm-src-patched"))
2632 (for-each
2633 (lambda (file)
2634 (substitute* file
2635 (("readonly partial struct") "partial struct")
2636 (("readonly struct") "struct")))
2637 (find-files "srm-src-patched" "\\.cs$"))
2638 (for-each
2639 (lambda (file)
2640 (substitute* file
2641 (("\\bin MemoryBlock ") "MemoryBlock ")
2642 (("metadataTableStream = default;")
2643 "metadataTableStream = default(MemoryBlock);")
2644 (("standalonePdbStream = default;")
2645 "standalonePdbStream = default(MemoryBlock);")))
2646 (find-files "srm-src-patched" "MetadataReader\\.cs$"))
2647 (substitute*
2648 "srm-src-patched/System/Reflection/Metadata/Ecma335/Encoding/ControlFlowBuilder.cs"
2649 (("label: default, opCode: default\\)")
2650 "label: default(LabelHandle), opCode: default(ILOpCode))"))
2651 (for-each
2652 (lambda (file)
2653 (substitute* file
2654 (("StandaloneSignatureHandle localVariablesSignature = default,")
2655 "StandaloneSignatureHandle localVariablesSignature = default(StandaloneSignatureHandle),")
2656 (("\\) : default;")
2657 ") : default(ExceptionRegionEncoder);")))
2658 (find-files "srm-src-patched/System/Reflection/Metadata/Ecma335/Encoding"
2659 "\\.cs$"))
2660 (for-each
2661 (lambda (file)
2662 (substitute* file
2663 (("type: ") "") (("version: ") "") (("stamp: ") "")))
2664 (find-files "srm-src-patched/System/Reflection/PortableExecutable/DebugDirectory"
2665 "\\.cs$"))))))))
2666 (synopsis "C# 7.1 compiler bootstrapped from source")
2667 (description
2668 "This package provides the Roslyn C# compiler (@command{csc}), built
2669from source using @code{roslyn-2.0} as the bootstrap compiler. It produces
2670a C# 7.1 compiler that supports default literals, which is needed to build
2671newer Roslyn versions.")))
2672
2673;;;
2674;;; roslyn-2.8: inherits roslyn-2.3, built with csc 2.3
2675;;;
2676
2677(define-public roslyn-2.8
2678 (package
2679 (inherit roslyn-2.3)
2680 (version "2.8.2")
2681 (source
2682 (origin
2683 (method git-fetch)
2684 (uri (git-reference
2685 (url "https://github.com/dotnet/roslyn")
2686 (commit (string-append "version-" version))))
2687 (file-name (git-file-name "roslyn" version))
2688 (sha256
2689 (base32
2690 "0xf30h91wf96gj7n2azqplzybzcllfni6cjkibyrr6pr7sv9an1x"))
2691 (patches
2692 (search-patches "roslyn-2.8.2-csharp-7.2-for-csc-2.3.patch"))))
2693 (native-inputs (list roslyn-2.3))
2694 (arguments
2695 (substitute-keyword-arguments (package-arguments roslyn-2.3)
2696 ((#:phases phases '())
2697 #~(modify-phases #$phases
2698 ;; No compiler-compat fixes needed; the patch handles everything.
2699 (replace 'fix-compiler-compat (lambda _ #t))
2700
2701 ;; 2.8.2 also has DiaSymReader COM files to replace.
2702 (replace 'remove-stale-files
2703 (lambda _
2704 ;; Rename file with trailing space in its name.
2705 (rename-file
2706 "src/Compilers/Core/Portable/Operations/IConstructorBodyOperation .cs"
2707 "src/Compilers/Core/Portable/Operations/IConstructorBodyOperation.cs")
2708 (for-each
2709 (lambda (f) (when (file-exists? f) (delete-file f)))
2710 (append
2711 '#$%roslyn-stale-files
2712 '("src/Compilers/Core/Portable/DiaSymReader/Utilities/IUnsafeComStream.cs"
2713 "src/Compilers/Core/Portable/DiaSymReader/Utilities/ComMemoryStream.cs")))))
2714
2715 ;; 2.8.2 also needs DiaSymReader COM stubs.
2716 (add-after 'create-com-memory-stream-stub 'create-diasymreader-stubs
2717 (lambda _
2718 (call-with-output-file
2719 "src/Compilers/Core/Portable/DiaSymReader/Utilities/ComMemoryStream.cs"
2720 (lambda (port)
2721 (display
2722 "using System; using System.Collections.Generic; using System.IO;
2723namespace Microsoft.DiaSymReader
2724{
2725 internal sealed class ComMemoryStream : Stream
2726 {
2727 public override bool CanRead => false;
2728 public override bool CanSeek => true;
2729 public override bool CanWrite => true;
2730 public override long Length => _length;
2731 public override long Position { get; set; }
2732 private long _length;
2733 public override void Flush() {}
2734 public override int Read(byte[] b, int o, int c)
2735 => throw new NotSupportedException();
2736 public override long Seek(long o, SeekOrigin so) => 0;
2737 public override void SetLength(long v) { _length = v; }
2738 public override void Write(byte[] b, int o, int c) {}
2739 public IEnumerable<ArraySegment<byte>> GetChunks()
2740 => Array.Empty<ArraySegment<byte>>();
2741 }
2742}
2743" port)))
2744 (call-with-output-file
2745 "src/Compilers/Core/Portable/DiaSymReader/Utilities/IUnsafeComStream.cs"
2746 (lambda (port)
2747 (display
2748 "namespace Microsoft.DiaSymReader { internal interface IUnsafeComStream {} }\n"
2749 port)))))
2750
2751 ;; Not needed; 2.8.2 has generated files checked in.
2752 (delete 'delete-generated-files)
2753
2754 ;; Point at roslyn-2.3's csc explicitly.
2755 (replace 'create-csc-wrapper
2756 (lambda* (#:key inputs #:allow-other-keys)
2757 (mkdir-p "bootstrap-bin")
2758 (call-with-output-file "bootstrap-bin/csc"
2759 (lambda (port)
2760 (format port "#!~a~%exec mono ~a \"$@\"~%"
2761 (which "bash")
2762 (string-append (assoc-ref inputs "roslyn") "/lib/roslyn/csc.exe"))))
2763 (chmod "bootstrap-bin/csc" #o755)
2764 (setenv "PATH"
2765 (string-append (getcwd) "/bootstrap-bin:"
2766 (getenv "PATH")))))
2767
2768 ;; 2.8.2 source uses C# 7.1 features (default literals).
2769 ;; -d:NET46 selects Mono-compatible code paths in csc.exe.
2770 (replace 'create-csc-rsp
2771 (lambda _
2772 (call-with-output-file "csc.rsp"
2773 (lambda (port)
2774 (display "-langversion:7.1\n-d:NET46\n" port)))))
2775
2776 ;; 2.8.2 has generated files checked in; skip regeneration.
2777 (delete 'generate-source)
2778
2779 ;; prepare-srm-source, build, compile, and install are all
2780 ;; inherited from roslyn-2.3.
2781 ))))
2782 (synopsis "C# 7.2 compiler bootstrapped from source")
2783 (description
2784 "This package provides the Roslyn C# compiler (@command{csc}), built
2785from source using @code{roslyn-2.3} as the bootstrap compiler. It produces
2786a C# 7.2 compiler.")))
2787
2788;;;
2789;;; roslyn-3.0: inherits roslyn-2.8, built with csc 2.8
2790;;;
2791
2792(define-public roslyn-3.0
2793 (package
2794 (inherit roslyn-2.8)
2795 (version "3.0.0")
2796 (source
2797 (origin
2798 (method git-fetch)
2799 (uri (git-reference
2800 (url "https://github.com/dotnet/roslyn")
2801 (commit (string-append "version-" version))))
2802 (file-name (git-file-name "roslyn" version))
2803 (sha256
2804 (base32
2805 "17x9bapqaaapa7jsb2sz9pm20swgj40naxlgci4nc9xh7brahcqw"))
2806 (patches
2807 (search-patches "roslyn-3.0.0-bootstrap-with-csc-2.8.patch"))))
2808 (native-inputs (list roslyn-2.8))
2809 (arguments
2810 (substitute-keyword-arguments (package-arguments roslyn-2.8)
2811 ((#:phases phases '())
2812 #~(modify-phases #$phases
2813 ;; No compiler-compat or mono-compat fixes needed for 3.0;
2814 ;; the patch handles ReadOnlySpan and other changes.
2815 ;; KeyValuePair helper was removed in 3.0.
2816 (replace 'fix-compiler-compat
2817 (lambda _ #t))
2818 (replace 'fix-mono-compat
2819 (lambda _
2820 ;; Only CodePagesEncodingProvider remains.
2821 (substitute* "src/Compilers/Core/Portable/EncodedStringText.cs"
2822 (("if \\(CodePagesEncodingProvider\\.Instance != null\\)")
2823 "if (false)")
2824 (("Encoding\\.RegisterProvider\\(CodePagesEncodingProvider\\.Instance\\);")
2825 "// not available in Mono"))))
2826
2827 ;; 3.0 has more files with PathUtilities ambiguity.
2828 (add-after 'fix-srm-inline 'fix-srm-inline-3.0
2829 (lambda _
2830 (substitute* (list
2831 "src/Compilers/Core/Portable/StrongName/DesktopStrongNameProvider.cs"
2832 "src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerFileReference.cs")
2833 (("\\bPathUtilities\\.")
2834 "Roslyn.Utilities.PathUtilities."))))
2835
2836 ;; 3.0 has no stale files from 2.x. Only DiaSymReader COM
2837 ;; files need stubbing (inherited from create-diasymreader-stubs).
2838 ;; Rename file with trailing space in its name.
2839 (replace 'remove-stale-files
2840 (lambda _
2841 (rename-file
2842 "src/Compilers/Core/Portable/Operations/IConstructorBodyOperation .cs"
2843 "src/Compilers/Core/Portable/Operations/IConstructorBodyOperation.cs")
2844 (for-each
2845 (lambda (f) (when (file-exists? f) (delete-file f)))
2846 '("src/Compilers/Core/Portable/DiaSymReader/Utilities/IUnsafeComStream.cs"
2847 "src/Compilers/Core/Portable/DiaSymReader/Utilities/ComMemoryStream.cs"))))
2848
2849 ;; csc.rsp: C# 7.3 langversion, NET472 define (was NET46 in 2.8).
2850 (replace 'create-csc-rsp
2851 (lambda _
2852 (call-with-output-file "csc.rsp"
2853 (lambda (port)
2854 (display "-langversion:7.3\n-d:NET472\n" port)))))
2855
2856 ;; Point at roslyn-2.8's csc.
2857 (replace 'create-csc-wrapper
2858 (lambda* (#:key inputs #:allow-other-keys)
2859 (mkdir-p "bootstrap-bin")
2860 (call-with-output-file "bootstrap-bin/csc"
2861 (lambda (port)
2862 (format port "#!~a~%exec mono ~a \"$@\"~%"
2863 (which "bash")
2864 (string-append (assoc-ref inputs "roslyn") "/lib/roslyn/csc.exe"))))
2865 (chmod "bootstrap-bin/csc" #o755)
2866 (setenv "PATH"
2867 (string-append (getcwd) "/bootstrap-bin:"
2868 (getenv "PATH")))))
2869
2870 ;; 3.0 csc.exe needs additional shared files.
2871 (replace 'compile
2872 (lambda* (#:key inputs #:allow-other-keys)
2873 (let* ((sci-dll
2874 (search-input-file
2875 inputs "/lib/mono/4.5/System.Collections.Immutable.dll"))
2876 (srm-dir
2877 (if (file-exists? "srm-src-patched")
2878 "srm-src-patched"
2879 #$%srm-source-dir))
2880 (srm-source-files
2881 (filter
2882 (lambda (f)
2883 (not (or (string-contains f "netstandard")
2884 (string-contains f "netcoreapp")
2885 (string-contains f "AssemblyInfo")
2886 (string-suffix? "/SR.cs" f))))
2887 (find-files srm-dir "\\.cs$")))
2888 (deps-dir
2889 (if (file-exists? "src/Dependencies/CodeAnalysis.Metadata")
2890 "src/Dependencies/CodeAnalysis.Metadata"
2891 "src/Dependencies/CodeAnalysis.Debugging")))
2892
2893 ;; 1. Microsoft.CodeAnalysis.dll
2894 (apply invoke "csc" "@csc.rsp" "-target:library" "-unsafe"
2895 "-out:Microsoft.CodeAnalysis.dll"
2896 (string-append
2897 "-resource:Microsoft.CodeAnalysis.CodeAnalysisResources.resources"
2898 ",Microsoft.CodeAnalysis.CodeAnalysisResources.resources")
2899 "-r:System.dll" "-r:System.Core.dll"
2900 "-r:System.Xml.dll" "-r:System.Xml.Linq.dll"
2901 "-r:System.Numerics.dll" "-r:System.IO.Compression.dll"
2902 "-r:System.Security.dll"
2903 "-r:System.Runtime.Serialization.dll"
2904 (string-append "-r:" sci-dll)
2905 "-d:COMPILERCORE" "-d:SRM"
2906 "bootstrap-sr.cs" "bootstrap-ivt.cs"
2907 "src/Compilers/Shared/CoreClrShim.cs"
2908 "src/Compilers/Shared/DesktopShim.cs"
2909 (append
2910 (find-files "src/Compilers/Core/Portable" "\\.cs$")
2911 (find-files "src/Compilers/Core/AnalyzerDriver" "\\.cs$")
2912 (find-files deps-dir "\\.cs$")
2913 (find-files "src/Dependencies/PooledObjects" "\\.cs$")
2914 srm-source-files))
2915
2916 ;; 2. Microsoft.CodeAnalysis.CSharp.dll
2917 (apply invoke "csc" "@csc.rsp" "-target:library" "-unsafe"
2918 "-out:Microsoft.CodeAnalysis.CSharp.dll"
2919 (string-append
2920 "-resource:Microsoft.CodeAnalysis.CSharp.CSharpResources.resources"
2921 ",Microsoft.CodeAnalysis.CSharp.CSharpResources.resources")
2922 "-r:System.dll" "-r:System.Core.dll"
2923 "-r:System.Xml.dll" "-r:System.Xml.Linq.dll"
2924 "-r:System.Numerics.dll" "-r:System.IO.Compression.dll"
2925 (string-append "-r:" sci-dll)
2926 "-r:Microsoft.CodeAnalysis.dll"
2927 "bootstrap-csharp-ivt.cs"
2928 "src/Compilers/CSharp/CSharpAnalyzerDriver/CSharpDeclarationComputer.cs"
2929 (append
2930 (find-files "src/Compilers/CSharp/Portable" "\\.cs$")
2931 (if (file-exists? "generated")
2932 (find-files "generated" "\\.cs$")
2933 '())))
2934
2935 ;; 3. csc.exe - 3.0 added RuntimeHostInfo and NamedPipeUtil.
2936 (invoke "csc" "@csc.rsp" "-out:csc.exe"
2937 "-r:System.dll" "-r:System.Core.dll"
2938 (string-append "-r:" sci-dll)
2939 "-r:Microsoft.CodeAnalysis.dll"
2940 "-r:Microsoft.CodeAnalysis.CSharp.dll"
2941 "src/Compilers/CSharp/csc/Program.cs"
2942 "src/Compilers/Shared/Csc.cs"
2943 "src/Compilers/Shared/BuildClient.cs"
2944 "src/Compilers/Shared/BuildServerConnection.cs"
2945 "src/Compilers/Shared/DesktopBuildClient.cs"
2946 "src/Compilers/Shared/DesktopAnalyzerAssemblyLoader.cs"
2947 "src/Compilers/Shared/ExitingTraceListener.cs"
2948 "src/Compilers/Shared/CoreClrShim.cs"
2949 "src/Compilers/Shared/DesktopShim.cs"
2950 "src/Compilers/Shared/RuntimeHostInfo.cs"
2951 "src/Compilers/Shared/NamedPipeUtil.cs"
2952 "src/Compilers/Core/CommandLine/BuildProtocol.cs"
2953 "src/Compilers/Core/CommandLine/NativeMethods.cs"
2954 "src/Compilers/Core/CommandLine/ConsoleUtil.cs"
2955 "src/Compilers/Core/CommandLine/CompilerServerLogger.cs"))))))))
2956 (synopsis "C# 8.0 compiler bootstrapped from source")
2957 (description
2958 "This package provides the Roslyn C# compiler (@command{csc}), built
2959from source using @code{roslyn-2.8} as the bootstrap compiler. It produces
2960a C# 8.0 compiler.")))
2961
2962
2963;;;
2964;;; roslyn-3.2: inherits roslyn-3.0, built with csc 3.0
2965;;; Adds 'notnull' constraint support needed by roslyn 3.8+.
2966;;;
2967
2968(define-public roslyn-3.2
2969 (package
2970 (inherit roslyn-3.0)
2971 (version "3.2.0")
2972 (source
2973 (origin
2974 (method git-fetch)
2975 (uri (git-reference
2976 (url "https://github.com/dotnet/roslyn")
2977 (commit (string-append "version-" version))))
2978 (file-name (git-file-name "roslyn" version))
2979 (sha256
2980 (base32
2981 "0brx9i0jrx2j3zircalgyabc24qqy8ghd8hcjazga8w58a0gmvpc"))
2982 (patches
2983 (search-patches "roslyn-3.2.0-bootstrap-with-csc-3.0.patch"))))
2984 (native-inputs (list roslyn-3.0))
2985 (arguments
2986 (substitute-keyword-arguments (package-arguments roslyn-3.0)
2987 ((#:phases phases '())
2988 #~(modify-phases #$phases
2989 ;; 3.2 uses static local functions (C# 8 preview in csc 3.0).
2990 (replace 'create-csc-rsp
2991 (lambda _
2992 (call-with-output-file "csc.rsp"
2993 (lambda (port)
2994 (display "-langversion:preview\n-d:NET472\n" port)))))
2995 ;; Point at roslyn-3.0's csc.
2996 (replace 'create-csc-wrapper
2997 (lambda* (#:key inputs #:allow-other-keys)
2998 (mkdir-p "bootstrap-bin")
2999 (call-with-output-file "bootstrap-bin/csc"
3000 (lambda (port)
3001 (format port "#!~a~%exec mono ~a \"$@\"~%"
3002 (which "bash")
3003 (string-append (assoc-ref inputs "roslyn") "/lib/roslyn/csc.exe"))))
3004 (chmod "bootstrap-bin/csc" #o755)
3005 (setenv "PATH"
3006 (string-append (getcwd) "/bootstrap-bin:"
3007 (getenv "PATH")))))))))
3008 (synopsis "C# 8.0 compiler with notnull constraint support")
3009 (description
3010 "This package provides the Roslyn C# compiler (@command{csc}), built
3011from source using @code{roslyn-3.0} as the bootstrap compiler. It adds
3012support for the @code{notnull} generic constraint, which is needed to build
3013newer Roslyn versions.")))
3014
3015
3016;;;
3017;;; roslyn-3.8: inherits roslyn-3.2, built with csc 3.2
3018;;; This is the target version for Mono 6.12 compatibility.
3019;;;
3020
3021(define-public roslyn-3.8
3022 (package
3023 (inherit roslyn-3.2)
3024 (version "3.8.0")
3025 (source
3026 (origin
3027 (method git-fetch)
3028 (uri (git-reference
3029 (url "https://github.com/dotnet/roslyn")
3030 (commit (string-append "v" version))))
3031 (file-name (git-file-name "roslyn" version))
3032 (sha256
3033 (base32
3034 "0z003zysqbd35dmw5dby3rs4471cb8qh5jlswyibc4qffh0dkfx4"))
3035 (patches
3036 (search-patches "roslyn-3.8.0-bootstrap-with-csc-3.2.patch"))))
3037 (native-inputs (list roslyn-3.2))
3038 (arguments
3039 (substitute-keyword-arguments (package-arguments roslyn-3.2)
3040 ((#:phases phases '())
3041 #~(modify-phases #$phases
3042 (replace 'create-csc-rsp
3043 (lambda _
3044 (call-with-output-file "csc.rsp"
3045 (lambda (port)
3046 (display "-langversion:preview\n-d:NET472\n" port)))))
3047
3048 ;; Point at roslyn-3.2's csc.
3049 (replace 'create-csc-wrapper
3050 (lambda* (#:key inputs #:allow-other-keys)
3051 (mkdir-p "bootstrap-bin")
3052 (call-with-output-file "bootstrap-bin/csc"
3053 (lambda (port)
3054 (format port "#!~a~%exec mono ~a \"$@\"~%"
3055 (which "bash")
3056 (string-append (assoc-ref inputs "roslyn") "/lib/roslyn/csc.exe"))))
3057 (chmod "bootstrap-bin/csc" #o755)
3058 (setenv "PATH"
3059 (string-append (getcwd) "/bootstrap-bin:"
3060 (getenv "PATH")))))
3061
3062 ;; 3.8 has more files with PathUtilities ambiguity
3063 ;; between SRM's and Roslyn's PathUtilities classes.
3064 ;; PathUtilities ambiguity already handled by the patch.
3065 (delete 'fix-srm-inline)
3066 (delete 'fix-srm-inline-3.0)
3067
3068 ;; Mono 6.12's mscorlib provides NotNullWhenAttribute etc.
3069 ;; (backported from .NET Core 3.0), but NOT MemberNotNullAttribute
3070 ;; or MemberNotNullWhenAttribute (added in .NET 5).
3071 ;; Replace the polyfill file: remove types that conflict with
3072 ;; mscorlib, keep the two that Mono lacks.
3073 (replace 'remove-stale-files
3074 (lambda _
3075 (for-each
3076 (lambda (f) (when (file-exists? f) (delete-file f)))
3077 '("src/Compilers/Core/Portable/DiaSymReader/Utilities/IUnsafeComStream.cs"
3078 "src/Compilers/Core/Portable/DiaSymReader/Utilities/ComMemoryStream.cs"
3079 ;; Index/Range polyfills are internal and shadow
3080 ;; Mono 6.12's public mscorlib types. Delete so
3081 ;; csc finds the mscorlib versions.
3082 "src/Compilers/Core/Portable/InternalUtilities/Index.cs"
3083 "src/Compilers/Core/Portable/InternalUtilities/Range.cs"))
3084 (call-with-output-file
3085 "src/Compilers/Core/Portable/InternalUtilities/NullableAttributes.cs"
3086 (lambda (port)
3087 (display
3088"namespace System.Diagnostics.CodeAnalysis
3089{
3090 [System.AttributeUsage(System.AttributeTargets.Method | System.AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
3091 internal sealed class MemberNotNullAttribute : System.Attribute
3092 {
3093 public MemberNotNullAttribute(string member) => Members = new[] { member };
3094 public MemberNotNullAttribute(params string[] members) => Members = members;
3095 public string[] Members { get; }
3096 }
3097
3098 [System.AttributeUsage(System.AttributeTargets.Method | System.AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
3099 internal sealed class MemberNotNullWhenAttribute : System.Attribute
3100 {
3101 public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new[] { member }; }
3102 public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; }
3103 public bool ReturnValue { get; }
3104 public string[] Members { get; }
3105 }
3106}
3107" port)))))
3108
3109 ;; 3.8 removed DesktopShim, DesktopBuildClient, and
3110 ;; DesktopAnalyzerAssemblyLoader source files. The inherited
3111 ;; compile phase still references them; create empty stubs.
3112 (add-before 'compile 'create-desktop-stubs
3113 (lambda _
3114 (for-each
3115 (lambda (f)
3116 (unless (file-exists? f)
3117 (call-with-output-file f
3118 (lambda (port) (newline port)))))
3119 '("src/Compilers/Shared/DesktopShim.cs"
3120 "src/Compilers/Shared/DesktopBuildClient.cs"
3121 "src/Compilers/Shared/DesktopAnalyzerAssemblyLoader.cs"))))
3122
3123 ;; Core IVT needs Scripting and VB assembly names so they
3124 ;; can access internal APIs.
3125 (replace 'build
3126 (lambda _
3127 ;; Bootstrap SR class from SRM string resources.
3128 ;; Roslyn 2.0-3.2: resx at src/Dependencies/.../Strings.resx
3129 ;; Roslyn 3.8+: resx at %srm-source-dir/Resources/Strings.resx
3130 (invoke "resx2sr" "-o" "srm-strings.cs" "-n" "System.SR"
3131 "--warn-mismatch"
3132 (string-append #$%srm-source-dir "/Resources/Strings.resx"))
3133 (invoke "resx2sr" "-o" "bootstrap-sr.cs" "-n"
3134 "Microsoft.CodeAnalysis.CodeAnalysisResources"
3135 "src/Compilers/Core/Portable/CodeAnalysisResources.resx")
3136 ;; SR.Format wrappers (resx2sr only generates constants;
3137 ;; SRM code calls SR.Format for string interpolation).
3138 (call-with-output-file "srm-strings-format.cs"
3139 (lambda (port)
3140 (display
3141"namespace System {
3142partial class SR {
3143 internal static string Format(string f, object a0) => string.Format(f, a0);
3144 internal static string Format(string f, object a0, object a1) => string.Format(f, a0, a1);
3145 internal static string Format(string f, object a0, object a1, object a2) => string.Format(f, a0, a1, a2);
3146 internal static string Format(string f, params object[] args) => string.Format(f, args);
3147}
3148}
3149" port)))
3150 ;; CodeAnalysisResources.ResourceManager property
3151 ;; (needed by diagnostic message formatting).
3152 (call-with-output-file "bootstrap-resourcemanager.cs"
3153 (lambda (port)
3154 (display
3155"namespace Microsoft.CodeAnalysis {
3156partial class CodeAnalysisResources {
3157 static System.Resources.ResourceManager _rm;
3158 public static System.Resources.ResourceManager ResourceManager {
3159 get {
3160 if (_rm == null)
3161 _rm = new System.Resources.ResourceManager(
3162 \"Microsoft.CodeAnalysis.CodeAnalysisResources\",
3163 typeof(CodeAnalysisResources).Assembly);
3164 return _rm;
3165 }
3166 }
3167}
3168}
3169" port)))
3170 ;; Core IVT: allow CSharp, VB, Scripting, csc, csi, vbc.
3171 (call-with-output-file "bootstrap-ivt.cs"
3172 (lambda (port)
3173 (for-each
3174 (lambda (asm)
3175 (format port
3176 "[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(~s)]~%"
3177 asm))
3178 '("Microsoft.CodeAnalysis.CSharp"
3179 "Microsoft.CodeAnalysis.VisualBasic"
3180 "Microsoft.CodeAnalysis.Scripting"
3181 "Microsoft.CodeAnalysis.CSharp.Scripting"
3182 "csc" "csi" "vbc" "VBCSCompiler"))))
3183 ;; CSharp IVT: allow csc, csi, CSharp.Scripting.
3184 (call-with-output-file "bootstrap-csharp-ivt.cs"
3185 (lambda (port)
3186 (format port "using System.Runtime.CompilerServices;
3187using System.Reflection;
3188[assembly: InternalsVisibleTo(\"csc\")]
3189[assembly: InternalsVisibleTo(\"csi\")]
3190[assembly: InternalsVisibleTo(\"Microsoft.CodeAnalysis.CSharp.Scripting\")]
3191[assembly: AssemblyVersion(\"~a.0\")]
3192[assembly: AssemblyFileVersion(\"~a.0\")]
3193[assembly: AssemblyInformationalVersion(\"~a\")]
3194" #$(package-version this-package)
3195 #$(package-version this-package)
3196 #$(package-version this-package))))
3197 ;; Scripting IVT: allow CSharp.Scripting, csi.
3198 (call-with-output-file "bootstrap-scripting-ivt.cs"
3199 (lambda (port)
3200 (display "using System.Runtime.CompilerServices;
3201[assembly: InternalsVisibleTo(\"Microsoft.CodeAnalysis.CSharp.Scripting\")]
3202[assembly: InternalsVisibleTo(\"csi\")]
3203" port)))
3204 ;; .resources from .resx for all assemblies.
3205 (invoke "resgen"
3206 "src/Compilers/Core/Portable/CodeAnalysisResources.resx"
3207 "Microsoft.CodeAnalysis.CodeAnalysisResources.resources")
3208 (invoke "resgen"
3209 "src/Compilers/CSharp/Portable/CSharpResources.resx"
3210 "Microsoft.CodeAnalysis.CSharp.CSharpResources.resources")
3211 ;; CSharpResources.Designer.cs for string constants.
3212 (invoke "resx2sr" "-o"
3213 "src/Compilers/CSharp/Portable/CSharpResources.Designer.cs"
3214 "-n" "Microsoft.CodeAnalysis.CSharp.CSharpResources"
3215 "src/Compilers/CSharp/Portable/CSharpResources.resx")
3216 ;; ScriptingResources.Designer.cs.
3217 (invoke "resx2sr" "-o"
3218 "src/Scripting/Core/ScriptingResources.Designer.cs"
3219 "-n" "Microsoft.CodeAnalysis.Scripting.ScriptingResources"
3220 "src/Scripting/Core/ScriptingResources.resx")
3221 ;; CSharpScriptingResources.Designer.cs.
3222 (invoke "resx2sr" "-o"
3223 "src/Scripting/CSharp/CSharpScriptingResources.Designer.cs"
3224 "-n" "Microsoft.CodeAnalysis.CSharp.Scripting.CSharpScriptingResources"
3225 "src/Scripting/CSharp/CSharpScriptingResources.resx")))
3226
3227 ;; Build CSharpSyntaxGenerator from source and regenerate
3228 ;; the three Syntax.xml.*.Generated.cs files. The generator
3229 ;; reads Syntax.xml and produces C# 8 compatible output
3230 ;; (patched SourceWriter.cs emits casts for switch expressions
3231 ;; and removes TResult?/where TResult : default).
3232 (add-before 'compile 'generate-source
3233 (lambda* (#:key inputs #:allow-other-keys)
3234 (mkdir-p "generated")
3235 ;; Delete checked-in generated files; we regenerate them
3236 ;; with C# 8 compatible output from patched generators.
3237 (for-each delete-file
3238 (find-files "src/Compilers/CSharp/Portable/Generated"
3239 "\\.cs$"))
3240 ;; CSharpSyntaxGenerator needs 4 source files from the
3241 ;; compiler tree (enum/constant definitions only).
3242 ;; -d:NETCOREAPP is harmless here (no code gated on it
3243 ;; in 3.8) but needed by 3.9 where the CLI entry point
3244 ;; moved behind #if NETCOREAPP. Passing it here lets
3245 ;; 3.9 inherit this phase unchanged.
3246 (apply invoke "csc" "@csc.rsp" "-d:NETCOREAPP"
3247 "-out:generated/CSharpSyntaxGenerator.exe"
3248 "-r:System.dll" "-r:System.Core.dll"
3249 "-r:System.Xml.dll" "-r:System.Xml.Linq.dll"
3250 (string-append
3251 "-r:" (search-input-file
3252 inputs
3253 "/lib/mono/4.5/System.Collections.Immutable.dll"))
3254 (append
3255 (find-files
3256 "src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator"
3257 "\\.cs$")
3258 (list
3259 "src/Compilers/CSharp/Portable/Syntax/SyntaxKind.cs"
3260 "src/Compilers/CSharp/Portable/Syntax/SyntaxKindFacts.cs"
3261 "src/Compilers/CSharp/Portable/Declarations/DeclarationModifiers.cs"
3262 "src/Compilers/Core/Portable/Symbols/WellKnownMemberNames.cs")))
3263 (invoke "mono" "generated/CSharpSyntaxGenerator.exe"
3264 "src/Compilers/CSharp/Portable/Syntax/Syntax.xml"
3265 "generated/")
3266 ;; BoundTreeGenerator.
3267 (apply invoke "csc" "@csc.rsp"
3268 "-out:generated/BoundTreeGenerator.exe"
3269 "-r:System.dll" "-r:System.Core.dll"
3270 "-r:System.Xml.dll" "-r:System.Xml.Linq.dll"
3271 (find-files
3272 "src/Tools/Source/CompilerGeneratorTools/Source/BoundTreeGenerator"
3273 "\\.cs$"))
3274 (invoke "mono" "generated/BoundTreeGenerator.exe" "CSharp"
3275 "src/Compilers/CSharp/Portable/BoundTree/BoundNodes.xml"
3276 "generated/BoundNodes.xml.Generated.cs")
3277 ;; CSharpErrorFactsGenerator.
3278 (apply invoke "csc" "@csc.rsp"
3279 "-out:generated/CSharpErrorFactsGenerator.exe"
3280 "-r:System.dll" "-r:System.Core.dll"
3281 (find-files
3282 "src/Tools/Source/CompilerGeneratorTools/Source/CSharpErrorFactsGenerator"
3283 "\\.cs$"))
3284 (invoke "mono" "generated/CSharpErrorFactsGenerator.exe"
3285 "src/Compilers/CSharp/Portable/Errors/ErrorCode.cs"
3286 "generated/ErrorFacts.Generated.cs")
3287 ;; CoreAssemblyLoaderImpl stub: the real implementation
3288 ;; uses .NET Core's AssemblyLoadContext; on Mono the
3289 ;; Desktop loader is used instead.
3290 (call-with-output-file "CoreAssemblyLoaderImpl_stub.cs"
3291 (lambda (port)
3292 (display
3293"namespace Microsoft.CodeAnalysis.Scripting.Hosting {
3294 internal sealed class CoreAssemblyLoaderImpl : AssemblyLoaderImpl {
3295 internal CoreAssemblyLoaderImpl(InteractiveAssemblyLoader loader) : base(loader)
3296 { throw new System.PlatformNotSupportedException(); }
3297 public override System.Reflection.Assembly LoadFromStream(System.IO.Stream peStream, System.IO.Stream pdbStream)
3298 { throw new System.PlatformNotSupportedException(); }
3299 public override AssemblyAndLocation LoadFromPath(string assemblyFilePath)
3300 { throw new System.PlatformNotSupportedException(); }
3301 public override void Dispose() { }
3302 }
3303}
3304" port)))))
3305
3306 ;; Compile all assemblies: Core, CSharp, Scripting,
3307 ;; CSharp.Scripting, and csc.exe.
3308 (replace 'compile
3309 (lambda* (#:key inputs #:allow-other-keys)
3310 (let* ((sci-dll
3311 (search-input-file
3312 inputs "/lib/mono/4.5/System.Collections.Immutable.dll"))
3313 (srm-dir
3314 (if (file-exists? "srm-src-patched")
3315 "srm-src-patched"
3316 #$%srm-source-dir))
3317 (srm-source-files
3318 (filter
3319 (lambda (f)
3320 (not (or (string-contains f "netstandard")
3321 (string-contains f "netcoreapp")
3322 (string-contains f "AssemblyInfo")
3323 (string-suffix? "/SR.cs" f))))
3324 (find-files srm-dir "\\.cs$")))
3325 (deps-dir
3326 (if (file-exists? "src/Dependencies/CodeAnalysis.Metadata")
3327 "src/Dependencies/CodeAnalysis.Metadata"
3328 "src/Dependencies/CodeAnalysis.Debugging")))
3329
3330 ;; 1. Microsoft.CodeAnalysis.dll (Core)
3331 (apply invoke "csc" "@csc.rsp" "-target:library" "-unsafe"
3332 "-out:Microsoft.CodeAnalysis.dll"
3333 (string-append
3334 "-resource:Microsoft.CodeAnalysis.CodeAnalysisResources.resources"
3335 ",Microsoft.CodeAnalysis.CodeAnalysisResources.resources")
3336 "-r:System.dll" "-r:System.Core.dll"
3337 "-r:System.Xml.dll" "-r:System.Xml.Linq.dll"
3338 "-r:System.Numerics.dll" "-r:System.IO.Compression.dll"
3339 "-r:System.Security.dll"
3340 "-r:System.Runtime.Serialization.dll"
3341 (string-append "-r:" sci-dll)
3342 "-d:COMPILERCORE" "-d:SRM"
3343 "srm-strings.cs" "srm-strings-format.cs"
3344 "bootstrap-sr.cs" "bootstrap-resourcemanager.cs"
3345 "bootstrap-ivt.cs"
3346 "src/Compilers/Shared/CoreClrShim.cs"
3347 "src/Compilers/Shared/DesktopShim.cs"
3348 (append
3349 (find-files "src/Compilers/Core/Portable" "\\.cs$")
3350 (find-files "src/Compilers/Core/AnalyzerDriver" "\\.cs$")
3351 (find-files deps-dir "\\.cs$")
3352 (find-files "src/Dependencies/PooledObjects" "\\.cs$")
3353 srm-source-files))
3354
3355 ;; 2. Microsoft.CodeAnalysis.CSharp.dll
3356 (apply invoke "csc" "@csc.rsp" "-target:library" "-unsafe"
3357 "-out:Microsoft.CodeAnalysis.CSharp.dll"
3358 (string-append
3359 "-resource:Microsoft.CodeAnalysis.CSharp.CSharpResources.resources"
3360 ",Microsoft.CodeAnalysis.CSharp.CSharpResources.resources")
3361 "-r:System.dll" "-r:System.Core.dll"
3362 "-r:System.Xml.dll" "-r:System.Xml.Linq.dll"
3363 "-r:System.Numerics.dll" "-r:System.IO.Compression.dll"
3364 (string-append "-r:" sci-dll)
3365 "-r:Microsoft.CodeAnalysis.dll"
3366 "bootstrap-csharp-ivt.cs"
3367 "src/Compilers/CSharp/CSharpAnalyzerDriver/CSharpDeclarationComputer.cs"
3368 (append
3369 (find-files "src/Compilers/CSharp/Portable" "\\.cs$")
3370 (if (file-exists? "generated")
3371 (find-files "generated" "\\.cs$")
3372 '())))
3373
3374 ;; 3. Microsoft.CodeAnalysis.Scripting.dll
3375 (apply invoke "csc" "@csc.rsp" "-target:library" "-unsafe"
3376 "-d:SCRIPTING"
3377 "-out:Microsoft.CodeAnalysis.Scripting.dll"
3378 "-r:System.dll" "-r:System.Core.dll"
3379 "-r:System.Runtime.Serialization.dll"
3380 (string-append "-r:" sci-dll)
3381 "-r:Microsoft.CodeAnalysis.dll"
3382 "bootstrap-scripting-ivt.cs"
3383 "CoreAssemblyLoaderImpl_stub.cs"
3384 (append
3385 (filter
3386 ;; Exclude .NET Core-only assembly loader.
3387 (lambda (f)
3388 (not (string-suffix? "CoreAssemblyLoaderImpl.cs" f)))
3389 (find-files "src/Scripting/Core" "\\.cs$"))
3390 (find-files
3391 "src/Compilers/Shared/GlobalAssemblyCacheHelpers"
3392 "\\.cs$")))
3393
3394 ;; 4. Microsoft.CodeAnalysis.CSharp.Scripting.dll
3395 (apply invoke "csc" "@csc.rsp" "-target:library"
3396 "-out:Microsoft.CodeAnalysis.CSharp.Scripting.dll"
3397 "-r:System.dll" "-r:System.Core.dll"
3398 (string-append "-r:" sci-dll)
3399 "-r:Microsoft.CodeAnalysis.dll"
3400 "-r:Microsoft.CodeAnalysis.CSharp.dll"
3401 "-r:Microsoft.CodeAnalysis.Scripting.dll"
3402 (find-files "src/Scripting/CSharp" "\\.cs$"))
3403
3404 ;; 5. csc.exe
3405 (invoke "csc" "@csc.rsp" "-out:csc.exe"
3406 "-r:System.dll" "-r:System.Core.dll"
3407 (string-append "-r:" sci-dll)
3408 "-r:Microsoft.CodeAnalysis.dll"
3409 "-r:Microsoft.CodeAnalysis.CSharp.dll"
3410 "src/Compilers/CSharp/csc/Program.cs"
3411 "src/Compilers/Shared/Csc.cs"
3412 "src/Compilers/Shared/BuildClient.cs"
3413 "src/Compilers/Shared/BuildServerConnection.cs"
3414 "src/Compilers/Shared/DesktopBuildClient.cs"
3415 "src/Compilers/Shared/DesktopAnalyzerAssemblyLoader.cs"
3416 "src/Compilers/Shared/ExitingTraceListener.cs"
3417 "src/Compilers/Shared/CoreClrShim.cs"
3418 "src/Compilers/Shared/DesktopShim.cs"
3419 "src/Compilers/Shared/NamedPipeUtil.cs"
3420 "src/Compilers/Shared/RuntimeHostInfo.cs"
3421 "src/Compilers/Core/CommandLine/BuildProtocol.cs"
3422 "src/Compilers/Core/CommandLine/NativeMethods.cs"
3423 "src/Compilers/Core/CommandLine/ConsoleUtil.cs"
3424 "src/Compilers/Core/CommandLine/CompilerServerLogger.cs"))))
3425
3426 ;; Install all assemblies.
3427 (replace 'install
3428 (lambda* (#:key inputs outputs #:allow-other-keys)
3429 (let* ((out (assoc-ref outputs "out"))
3430 (lib (string-append out "/lib/roslyn"))
3431 (bin (string-append out "/bin"))
3432 (sci-dll (search-input-file
3433 inputs
3434 "/lib/mono/4.5/System.Collections.Immutable.dll")))
3435 (mkdir-p lib)
3436 (mkdir-p bin)
3437 (for-each
3438 (lambda (f) (install-file f lib))
3439 '("csc.exe"
3440 "Microsoft.CodeAnalysis.dll"
3441 "Microsoft.CodeAnalysis.CSharp.dll"
3442 "Microsoft.CodeAnalysis.Scripting.dll"
3443 "Microsoft.CodeAnalysis.CSharp.Scripting.dll"))
3444 (symlink sci-dll
3445 (string-append lib "/System.Collections.Immutable.dll"))
3446 (call-with-output-file (string-append bin "/csc")
3447 (lambda (port)
3448 (format port "#!~a~%exec mono ~a/csc.exe \"$@\"~%"
3449 (search-input-file inputs "/bin/bash") lib)))
3450 (chmod (string-append bin "/csc") #o755))))))))
3451 (synopsis "C# 9.0 compiler and scripting libraries, bootstrapped from source")
3452 (description
3453 "This package provides the Roslyn C# compiler (@command{csc}) and
3454scripting libraries, built from source using @code{roslyn-3.2} as the
3455bootstrap compiler. It produces a C# 9.0 compiler matching Mono 6.12.")))
3456
3457;; roslyn-3.9: inherits roslyn-3.8, built with csc 3.8.
3458;; Upstream mono 6.12.0.206 ships 3.9.0 (roslyn-binaries commit
3459;; 1c6482470c). Both 3.8 and 3.9 implement C# 9. The only
3460;; 3.9-specific change is project-wide nullable enable (was per-file
3461;; in 3.8), plus a few new Mono-compat fixes in the patch
3462;; (CodePagesEncodingProvider in BuildClient.cs, Unsafe.As in
3463;; ImmutableArrayExtensions.cs).
3464(define-public roslyn-3.9
3465 (package
3466 (inherit roslyn-3.8)
3467 (version "3.9.0")
3468 (source
3469 (origin
3470 (method git-fetch)
3471 (uri (git-reference
3472 (url "https://github.com/dotnet/roslyn")
3473 (commit (string-append "v" version))))
3474 (file-name (git-file-name "roslyn" version))
3475 (sha256
3476 (base32
3477 "1kgm9aq5kd3cb8hw7nrmdyxlxw0blxvhdayyc0f28dzns2ph6v58"))
3478 (patches
3479 (search-patches "roslyn-3.9.0-bootstrap-with-csc-3.8.patch"))))
3480 (native-inputs (list roslyn-3.8))
3481 (arguments
3482 (substitute-keyword-arguments (package-arguments roslyn-3.8)
3483 ((#:phases phases '())
3484 #~(modify-phases #$phases
3485 ;; Point at roslyn-3.8's csc.
3486 (replace 'create-csc-wrapper
3487 (lambda* (#:key inputs #:allow-other-keys)
3488 (mkdir-p "bootstrap-bin")
3489 (call-with-output-file "bootstrap-bin/csc"
3490 (lambda (port)
3491 (format port "#!~a~%exec mono ~a \"$@\"~%"
3492 (which "bash")
3493 (string-append (assoc-ref inputs "roslyn")
3494 "/lib/roslyn/csc.exe"))))
3495 (chmod "bootstrap-bin/csc" #o755)
3496 (setenv "PATH"
3497 (string-append (getcwd) "/bootstrap-bin:"
3498 (getenv "PATH")))))
3499
3500 ;; 3.9 uses project-wide nullable enable instead of
3501 ;; per-file #nullable enable directives.
3502 (replace 'create-csc-rsp
3503 (lambda _
3504 (call-with-output-file "csc.rsp"
3505 (lambda (port)
3506 (display
3507 "-langversion:preview\n-d:NET472\n-nullable:enable\n"
3508 port)))))
3509
3510 ;; Broad Mono workarounds that are impractical in a patch
3511 ;; (too many files). Targeted fixes are in the patch.
3512 (add-after 'unpack 'fix-mono-compat-3.9
3513 (lambda _
3514 ;; SignatureCallingConvention.Unmanaged (value 9) not
3515 ;; in Mono's SRM. The enum initializer in Members.cs
3516 ;; is handled by the patch; sweep remaining uses.
3517 (for-each
3518 (lambda (file)
3519 (substitute* file
3520 (("SignatureCallingConvention\\.Unmanaged")
3521 "(SignatureCallingConvention)9")))
3522 (append
3523 (find-files "src/Compilers/Core/Portable" "\\.cs$")
3524 (find-files "src/Compilers/CSharp/Portable" "\\.cs$")))
3525 ;; PathUtilities ambiguity with SRM (too many files
3526 ;; to patch individually).
3527 (for-each
3528 (lambda (file)
3529 (substitute* file
3530 (("\\bPathUtilities\\.")
3531 "Roslyn.Utilities.PathUtilities.")))
3532 (append
3533 (find-files "src/Compilers/Core/Portable" "\\.cs$")
3534 (find-files "src/Scripting" "\\.cs$")))
3535 ;; Index/Range polyfills are internal and shadow Mono's
3536 ;; public mscorlib types. Delete so csc finds the
3537 ;; mscorlib versions.
3538 (delete-file
3539 "src/Compilers/Core/Portable/InternalUtilities/Index.cs")
3540 (delete-file
3541 "src/Compilers/Core/Portable/InternalUtilities/Range.cs")))))))
3542 (synopsis "C# 9.0 compiler and scripting libraries, bootstrapped from source")
3543 (description
3544 "This package provides the Roslyn C# compiler (@command{csc}) and
3545scripting libraries, built from source using @code{roslyn-3.8} as the
3546bootstrap compiler. This is the version shipped by upstream Mono 6.12.")))
3547
3548(define roslyn roslyn-3.9)
3549
3550(define-public mono
3551 (package
3552 (name "mono")
3553 (version (package-version mono-bootstrap))
3554 (source
3555 #f)
3556 (build-system trivial-build-system)
3557 (inputs
3558 `(("roslyn-bootstrap" ,roslyn)
3559 ("mono-bootstrap" ,mono-bootstrap)))
3560 (arguments
3561 (list
3562 #:modules '((guix build utils))
3563 #:builder
3564 #~(begin
3565 (use-modules (guix build utils)
3566 (ice-9 ftw))
3567 ;; Symlink tree of mono-bootstrap.
3568 (copy-recursively (assoc-ref %build-inputs "mono-bootstrap")
3569 #$output
3570 #:copy-file (lambda (s d)
3571 (symlink s d)))
3572 ;; Replace Roslyn assemblies in lib/mono/4.5/.
3573 (let ((bootstrap (assoc-ref %build-inputs "mono-bootstrap"))
3574 (bin (string-append #$output "/bin"))
3575 (mono45 (string-append #$output "/lib/mono/4.5"))
3576 (roslyn
3577 (string-append (assoc-ref %build-inputs "roslyn-bootstrap")
3578 "/lib/roslyn")))
3579 (define (script-wrapper? file)
3580 (and (eq? 'symlink (stat:type (lstat file)))
3581 (call-with-input-file file
3582 (lambda (port)
3583 (let ((c1 (read-char port))
3584 (c2 (read-char port)))
3585 (and (char? c1)
3586 (char? c2)
3587 (char=? c1 #\#)
3588 (char=? c2 #\!)))))))
3589 (define (rewrite-wrapper file)
3590 (let ((source (readlink file)))
3591 (delete-file file)
3592 (copy-file source file)
3593 (substitute* file
3594 ((bootstrap) #$output))
3595 (chmod file #o755)))
3596 (for-each (lambda (name)
3597 (let ((target (string-append mono45 "/" name)))
3598 (false-if-exception (delete-file target))
3599 (symlink (string-append roslyn "/" name) target)))
3600 '("csc.exe" "Microsoft.CodeAnalysis.dll"
3601 "Microsoft.CodeAnalysis.CSharp.dll"
3602 "Microsoft.CodeAnalysis.Scripting.dll"
3603 "Microsoft.CodeAnalysis.CSharp.Scripting.dll"
3604 ;; VB compiler is written in VB; needs separate bootstrap.
3605 ;; TODO: Microsoft.CodeAnalysis.VisualBasic.dll
3606 "System.Collections.Immutable.dll"))
3607 ;; Materialize inherited shell wrappers so they no longer point
3608 ;; back into mono-bootstrap.
3609 (for-each (lambda (name)
3610 (let ((target (string-append bin "/" name)))
3611 (when (script-wrapper? target)
3612 (rewrite-wrapper target))))
3613 (scandir bin (lambda (name)
3614 (not (member name '("." ".."))))))))))
3615 (synopsis "Mono with Roslyn C# compiler built from source")
3616 (description "This package provides Mono with the Roslyn C# compiler
3617(@command{csc}) replacing the binary blob.")
3618 (home-page "https://www.mono-project.com/")
3619 (license (package-license mono-bootstrap))))
3620
3621;; too new version: 15.9.21.664
3622;; too old (no support for mono) version: 14.0
3623(define-public msbuild
3624 (package
3625 (name "msbuild")
3626 (version "15.7.179")
3627 (source
3628 (origin
3629 (method git-fetch)
3630 (uri (git-reference
3631 (url "https://github.com/dotnet/msbuild")
3632 (commit (string-append "v" version))))
3633 (file-name (git-file-name name version))
3634 (sha256
3635 (base32
3636 "1fhd4z9575lwgy6l3wisih7g6qd6j3wb99kz246028dzm0rh3cfh"))
3637 (patches
3638 (search-patches
3639 "mono-msbuild-15.7.179-fix-build.patch"
3640 "mono-msbuild-15.7.179-fix-resources.patch"))))
3641 (build-system gnu-build-system)
3642 (inputs
3643 (list bash-minimal
3644 mono-bootstrap mono-system-reflection-metadata-bootstrap
3645 mono-system-collections-immutable-bootstrap))
3646 (arguments
3647 (list #:tests? #f ; would require xunit which is not in the bootstrap path
3648 #:phases
3649 #~(modify-phases %standard-phases
3650 (replace 'configure
3651 (lambda _
3652 (define (generate-version-file filename version-str internals-list)
3653 (call-with-output-file filename
3654 (lambda (port)
3655 (format port
3656 "[assembly: System.Reflection.AssemblyVersion(\"~a\")]~%"
3657 version-str)
3658 (format port
3659 "[assembly: System.Reflection.AssemblyFileVersion(\"~a\")]~%"
3660 version-str)
3661 ;; TODO: and commit id, if any.
3662 (format port
3663 "[assembly: System.Reflection.AssemblyInformationalVersion(\"~a\")]~%"
3664 version-str)
3665 (for-each
3666 (lambda (internal-name)
3667 (format port
3668 "[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(\"~a\")]~%"
3669 internal-name))
3670 internals-list))))
3671 (let ((version #$(package-version this-package)))
3672 (substitute* "src/Build/Resources/AssemblyResources.cs"
3673 ;; There's a caller that has a caller that checks for null.
3674 ;;
3675 ;; But if this check is here, the high-level fallback will
3676 ;; not work since it only falls back on null, not on
3677 ;; exception.
3678 ;;
3679 ;; So what's this about?! Remove it.
3680 (("ErrorUtilities.VerifyThrow[(]resource != null, .*")
3681 "\n"))
3682 (substitute* "src/Shared/AssemblyNameExtension.cs"
3683 (("\\<ISerializable\\>")
3684 "System.Runtime.Serialization.ISerializable")
3685 (("\\<StreamingContext\\>")
3686 "System.Runtime.Serialization.StreamingContext")
3687 (("\\<SerializationInfo\\>")
3688 "System.Runtime.Serialization.SerializationInfo"))
3689 ;; ThisAssembly would have been generated by MSBuild--which we don't have yet.
3690 (substitute* '("src/Shared/CommunicationsUtilities.cs"
3691 "src/Tasks/StronglyTypedResourceBuilder.cs")
3692 (("ThisAssembly[.]AssemblyInformationalVersion")
3693 (string-append "\"" version "\""))
3694 (("ThisAssembly[.]Version")
3695 (string-append "\"" version "\"")))
3696 (substitute* "src/Shared/FrameworkLocationHelper.cs"
3697 ;; That is unused anyway.
3698 (("^using Microsoft.Build.Evaluation;")
3699 ""))
3700 (substitute* '("src/Tasks/AspNetCompiler.cs"
3701 "src/Tasks/AxTlbBaseTask.cs"
3702 "src/Tasks/AxImp.cs"
3703 "src/Tasks/TlbImp.cs"
3704 "src/Tasks/Exec.cs"
3705 "src/Tasks/ResGen.cs"
3706 "src/Tasks/LC.cs"
3707 "src/Tasks/SGen.cs"
3708 "src/Tasks/WinMDExp.cs")
3709 (("protected override bool ValidateParameters")
3710 "protected internal override bool ValidateParameters")
3711 (("override protected bool ValidateParameters") ; SGen.cs
3712 "protected internal override bool ValidateParameters"))
3713 (substitute* "src/Shared/Modifiers.cs"
3714 (("^using Microsoft.Build.Internal;")
3715 ""))
3716 (substitute* "src/MSBuild/OutOfProcTaskHostNode.cs"
3717 (("^using Microsoft.Build.BackEnd;")
3718 "using Microsoft.Build.BackEnd;
3719using Microsoft.Build.BackEnd.Components.Caching;"))
3720 (generate-version-file "Version-Framework.cs" version
3721 '("Microsoft.Build.Utilities.Core"
3722 "Microsoft.Build.Tasks.Core"
3723 "Microsoft.Build.Tasks"
3724 "Microsoft.Build"))
3725 (generate-version-file "Version-Utilities.cs" version
3726 '("Microsoft.Build"
3727 "Microsoft.Build.Tasks.Core"
3728 "Microsoft.Build.Tasks"
3729 "MSBuild"))
3730 (generate-version-file "Version.cs" version
3731 '("MSBuild"))
3732 (generate-version-file "Version-exe.cs" version
3733 '()))))
3734 (replace 'build
3735 (lambda* (#:key inputs #:allow-other-keys)
3736 (let* ((mcs-flags '("-langversion:7.2" "-unsafe" "-d:NET472" "-d:STRONG_NAME"
3737 "-d:MONO" "-d:STANDALONEBUILD"
3738 ;; Otherwise the build would fail.
3739 "-d:FEATURE_COM_INTEROP"
3740 ;; Otherwise it would try to load shell32.
3741 "-d:FEATURE_SPECIAL_FOLDERS"
3742 ;"-d:FEATURE_BINARY_SERIALIZATION"
3743 ;"-d:FEATURE_ASSEMBLY_LOADFROM"
3744 ;"-d:FEATURE_RESX_RESOURCE_READER"
3745 "-d:FEATURE_RESGENCACHE"
3746 "-d:FEATURE_CODEDOM"
3747 ;"-d:FEATURE_SYSTEM_CONFIGURATION"
3748 "-d:FEATURE_APPDOMAIN"
3749 ;"-d:FEATURE_APM" ; ?
3750 "-d:FEATURE_TYPE_INVOKEMEMBER"
3751 "-d:FEATURE_APPDOMAIN_UNHANDLED_EXCEPTION")))
3752 (mkdir "artifacts")
3753
3754 ;;; --- 1. Build Microsoft.Build.Framework.dll
3755
3756 ;;; Note: No generating SR.cs for now.
3757
3758 (invoke "resgen" "src/Shared/Resources/Strings.shared.resx"
3759 "artifacts/Microsoft.Build.Framework.Strings.shared.resources")
3760
3761 (apply invoke "mcs"
3762 (append mcs-flags
3763 '("-target:library" "-out:artifacts/Microsoft.Build.Framework.dll"
3764 "-resource:artifacts/Microsoft.Build.Framework.Strings.shared.resources"
3765 "-r:System.Xaml.dll"
3766 "Version-Framework.cs")
3767 (find-files "src/Framework" "\\.cs$")
3768 (list "src/Shared/Constants.cs"
3769 "src/Shared/BinaryWriterExtensions.cs")))
3770
3771 ;;; --- 2. Build Microsoft.Build.Utilities.Core.dll
3772
3773 ;; No resx2sr since src/Utilities/AssemblyResources.cs is hand-written.
3774 (invoke "resgen" "src/Shared/Resources/Strings.shared.resx"
3775 "artifacts/Microsoft.Build.Utilities.Core.Strings.shared.resources")
3776 (invoke "resgen" "src/Utilities/Resources/Strings.resx"
3777 "artifacts/Microsoft.Build.Utilities.Core.Strings.resources")
3778 (apply invoke "mcs"
3779 (append mcs-flags
3780 '("-target:library" "-out:artifacts/Microsoft.Build.Utilities.Core.dll"
3781 "-resource:artifacts/Microsoft.Build.Utilities.Core.Strings.shared.resources"
3782 "-resource:artifacts/Microsoft.Build.Utilities.Core.Strings.resources"
3783 "-r:System.Runtime.Serialization.dll"
3784 "-r:artifacts/Microsoft.Build.Framework.dll"
3785 "src/Utilities/AssemblyResources.cs"
3786 "Version-Utilities.cs")
3787 (map (lambda (f) (string-append "src/Utilities/" f))
3788 '("SDKManifest.cs"
3789 "ApiContract.cs"
3790 "SDKType.cs"
3791 "Logger.cs"
3792 "TrackedDependencies/FlatTrackingData.cs"
3793 "TrackedDependencies/CanonicalTrackedOutputFiles.cs"
3794 "TrackedDependencies/CanonicalTrackedInputFiles.cs"
3795 "TrackedDependencies/CanonicalTrackedFilesHelper.cs"
3796 "TrackedDependencies/FileTracker.cs"
3797 "TrackedDependencies/DependencyTableCache.cs"
3798 "AssemblyFolders/AssemblyFoldersExInfo.cs"
3799 "AssemblyFolders/AssemblyFoldersFromConfigInfo.cs"
3800 "AssemblyInfo.cs"
3801 "ProcessorArchitecture.cs"
3802 "FxCopExclusions/Microsoft.Build.Utilities.Suppressions.cs"
3803 "PlatformManifest.cs"
3804 "ExtensionSDK.cs"
3805 "CommandLineBuilder.cs"
3806 "TaskItem.cs"
3807 "ToolTask.cs"
3808 "TargetPlatformSDK.cs"
3809 "AppDomainIsolatedTask.cs"
3810 "Task.cs"
3811 "ProcessExtensions.cs"
3812 "MuxLogger.cs"))
3813 (map (lambda (f) (string-append "src/Shared/" f))
3814 '("FxCopExclusions/Microsoft.Build.Shared.Suppressions.cs"
3815 "EncodingStringWriter.cs"
3816 "EncodingUtilities.cs"
3817 "CopyOnWriteDictionary.cs"
3818 "Tracing.cs"
3819 "TaskLoggingHelper.cs"
3820 "TaskLoggingHelperExtension.cs"
3821 "EventArgsFormatting.cs"
3822 "FileDelegates.cs" ; req by tasks
3823 "NativeMethodsShared.cs" ; again ???
3824 "MSBuildNameIgnoreCaseComparer.cs"
3825 "BuildEventFileInfo.cs"
3826 "ErrorUtilities.cs"
3827 "EscapingUtilities.cs"
3828 "FileUtilities.cs"
3829 "FileUtilities.GetFolderPath.cs"
3830 "TempFileUtilities.cs"
3831 "Modifiers.cs"
3832 "FileUtilitiesRegex.cs"
3833 "HybridDictionary.cs"
3834 "IConstrainedEqualityComparer.cs"
3835 "ResourceUtilities.cs"
3836 "StringBuilderCache.cs"
3837 "Traits.cs"
3838 "IElementLocation.cs"
3839 "INodePacket.cs"
3840 "INodePacketFactory.cs"
3841 "INodePacketHandler.cs"
3842 "INodePacketTranslatable.cs"
3843 "INodePacketTranslator.cs"
3844 "ExceptionHandling.cs"
3845 "ReadOnlyEmptyCollection.cs"
3846 "OpportunisticIntern.cs"
3847 "AssemblyUtilities.cs"
3848 "ReadOnlyEmptyDictionary.cs"
3849 "CanonicalError.cs"
3850 "VisualStudioLocationHelper.cs"
3851 "AssemblyFolders/Serialization/AssemblyFolderItem.cs"
3852 "AssemblyFolders/Serialization/AssemblyFolderCollection.cs"
3853 "BuildEnvironmentHelper.cs"
3854 "EnvironmentUtilities.cs"
3855 "VersionUtilities.cs"
3856 "InternalErrorException.cs"))))
3857
3858 ;;; --- 3. Build Microsoft.Build.Tasks.Core.dll
3859
3860 ;; No resx2sr since src/Tasks/AssemblyResources.cs is
3861 ;; hand-written.
3862 (invoke "resgen" "src/Tasks/Resources/Strings.resx"
3863 "artifacts/Microsoft.Build.Tasks.Core.Strings.resources")
3864 (apply invoke "mcs"
3865 (append mcs-flags
3866 `("-d:MICROSOFT_BUILD_TASKS"
3867 "-target:library"
3868 "-out:artifacts/Microsoft.Build.Tasks.Core.dll"
3869 "-resource:artifacts/Microsoft.Build.Tasks.Core.Strings.resources,Microsoft.Build.Tasks.Core.Strings"
3870 "-r:System.Xml.Linq.dll"
3871 "-r:artifacts/Microsoft.Build.Framework.dll"
3872 ;; This should contain ToolLocationHelper--but it's impossible.
3873 "-r:artifacts/Microsoft.Build.Utilities.Core.dll"
3874 "-r:System.Windows.Forms.dll" ; ResXDataNode
3875 ,(string-append "-r:"
3876 (search-input-file inputs
3877 "/lib/mono/4.5/System.Reflection.Metadata.dll"))
3878 ,(string-append "-r:"
3879 (search-input-file inputs
3880 "lib/mono/4.5/System.Collections.Immutable.dll"))
3881 "Version.cs")
3882 (map (lambda (f) (string-append "src/Tasks/" f))
3883 '(;; Otherwise impossible to use since it requires weird things.
3884 "../Utilities/ToolLocationHelper.cs"
3885 "Delegate.cs"
3886 "StrongNameUtils.cs"
3887 "AssemblyRegistrationCache.cs"
3888 "StateFileBase.cs"
3889 "AppDomainIsolatedTaskExtension.cs"
3890 "SdkToolsPathUtility.cs"
3891 "StronglyTypedResourceBuilder.cs"
3892 "Al.cs" "AppConfig/AppConfig.cs"
3893 "AppConfig/AppConfigException.cs"
3894 "AppConfig/BindingRedirect.cs"
3895 "AppConfig/DependentAssembly.cs"
3896 "AppConfig/RuntimeSection.cs"
3897 "AspNetCompiler.cs"
3898 "AssignCulture.cs"
3899 "AssignLinkMetadata.cs"
3900 "AssignProjectConfiguration.cs"
3901 "AssignTargetPath.cs"
3902 "AssemblyDependency/AssemblyFoldersExResolver.cs"
3903 "AssemblyDependency/AssemblyFoldersFromConfig/AssemblyFoldersFromConfigCache.cs"
3904 "AssemblyDependency/AssemblyFoldersFromConfig/AssemblyFoldersFromConfigResolver.cs"
3905 "AssemblyDependency/AssemblyFoldersResolver.cs"
3906 "AssemblyDependency/AssemblyInformation.cs"
3907 "AssemblyDependency/AssemblyNameReference.cs"
3908 "AssemblyDependency/AssemblyNameReferenceAscendingVersionComparer.cs"
3909 "AssemblyDependency/AssemblyResolution.cs"
3910 "AssemblyDependency/AssemblyResolutionConstants.cs"
3911 "AssemblyDependency/BadImageReferenceException.cs"
3912 "AssemblyDependency/CandidateAssemblyFilesResolver.cs"
3913 "AssemblyDependency/ConflictLossReason.cs"
3914 "AssemblyDependency/CopyLocalState.cs"
3915 "AssemblyDependency/DependencyResolutionException.cs"
3916 "AssemblyDependency/DirectoryResolver.cs"
3917 "AssemblyDependency/DisposableBase.cs"
3918 "AssemblyDependency/FrameworkPathResolver.cs"
3919 "AssemblyDependency/GacResolver.cs"
3920 "AssemblyDependency/GlobalAssemblyCache.cs"
3921 "AssemblyDependency/HintPathResolver.cs"
3922 "AssemblyDependency/InstalledAssemblies.cs"
3923 "AssemblyDependency/InvalidReferenceAssemblyNameException.cs"
3924 "AssemblyDependency/NoMatchReason.cs"
3925 "AssemblyDependency/RawFilenameResolver.cs"
3926 "AssemblyDependency/Reference.cs"
3927 "AssemblyDependency/ReferenceResolutionException.cs"
3928 "AssemblyDependency/ReferenceTable.cs"
3929 "AssemblyDependency/ResolutionSearchLocation.cs"
3930 "AssemblyDependency/Resolver.cs"
3931 "AssemblyDependency/ResolveAssemblyReference.cs"
3932 "AssemblyDependency/TaskItemSpecFilenameComparer.cs"
3933 "AssemblyDependency/UnificationReason.cs"
3934 "AssemblyDependency/UnificationVersion.cs"
3935 "AssemblyDependency/UnifiedAssemblyName.cs"
3936 "AssemblyDependency/WarnOrErrorOnTargetArchitectureMismatchBehavior.cs"
3937 "AssemblyDependency/GenerateBindingRedirects.cs"
3938 "AssemblyFolder.cs" "AssemblyInfo.cs" "AssemblyRemapping.cs"
3939 "AxImp.cs"
3940 "AxTlbBaseTask.cs"
3941 "BuildCacheDisposeWrapper.cs"
3942 "CallTarget.cs"
3943 "CodeTaskFactory.cs"
3944 "CombinePath.cs"
3945 "CommandLineBuilderExtension.cs"
3946 "ComReferenceResolutionException.cs"
3947 "ComReferenceTypes.cs"
3948 "ComReferenceWrapperInfo.cs"
3949 "ConvertToAbsolutePath.cs"
3950 "Copy.cs"
3951 "CreateCSharpManifestResourceName.cs"
3952 "CreateItem.cs"
3953 "CreateManifestResourceName.cs"
3954 "CreateProperty.cs"
3955 "CreateVisualBasicManifestResourceName.cs"
3956 "CSharpParserUtilities.cs"
3957 "Culture.cs"
3958 "CultureInfoCache.cs"
3959 "Delete.cs"
3960 "Dependencies.cs"
3961 "DependencyFile.cs"
3962 "Error.cs"
3963 "ErrorFromResources.cs"
3964 "Exec.cs"
3965 "ExtractedClassName.cs"
3966 "FileIO/ReadLinesFromFile.cs"
3967 "FileIO/WriteLinesToFile.cs"
3968 "FileState.cs"
3969 "FindAppConfigFile.cs"
3970 "FindInList.cs"
3971 "FindInvalidProjectReferences.cs"
3972 "FormatUrl.cs"
3973 "FormatVersion.cs"
3974 "FxCopExclusions/Microsoft.Build.Tasks.Suppressions.cs"
3975 "GenerateResource.cs"
3976 "GetAssemblyIdentity.cs"
3977 "GetFrameworkPath.cs"
3978 "GetFrameworkSDKPath.cs"
3979 "GetInstalledSDKLocations.cs"
3980 "GetReferenceAssemblyPaths.cs"
3981 "GetSDKReferenceFiles.cs"
3982 "Hash.cs"
3983 "IAnalyzerHostObject.cs"
3984 "ICscHostObject.cs"
3985 "ICscHostObject2.cs"
3986 "ICscHostObject3.cs"
3987 "ICscHostObject4.cs"
3988 "IComReferenceResolver.cs"
3989 "IVbcHostObject.cs"
3990 "IVbcHostObject2.cs"
3991 "IVbcHostObject3.cs"
3992 "IVbcHostObject4.cs"
3993 "IVbcHostObject5.cs"
3994 "IVbcHostObjectFreeThreaded.cs"
3995 "InstalledSDKResolver.cs"
3996 "InvalidParameterValueException.cs"
3997 "LC.cs"
3998 "ListOperators/FindUnderPath.cs"
3999 "ListOperators/RemoveDuplicates.cs"
4000 "LockCheck.cs" "MakeDir.cs"
4001 "ManifestUtil/ApplicationIdentity.cs"
4002 "ManifestUtil/AssemblyIdentity.cs"
4003 "ManifestUtil/AssemblyReference.cs"
4004 "ManifestUtil/AssemblyReferenceCollection.cs"
4005 "ManifestUtil/BaseReference.cs"
4006 "ManifestUtil/CngLightup.cs"
4007 "ManifestUtil/ComImporter.cs"
4008 "ManifestUtil/CompatibleFramework.cs"
4009 "ManifestUtil/CompatibleFrameworkCollection.cs"
4010 "ManifestUtil/Constants.cs"
4011 "ManifestUtil/ConvertUtil.cs"
4012 "ManifestUtil/EmbeddedManifestReader.cs"
4013 "ManifestUtil/FileAssociation.cs"
4014 "ManifestUtil/FileAssociationCollection.cs"
4015 "ManifestUtil/FileReference.cs"
4016 "ManifestUtil/FileReferenceCollection.cs"
4017 "ManifestUtil/ManifestFormatter.cs"
4018 "ManifestUtil/MetadataReader.cs"
4019 "ManifestUtil/NativeMethods.cs"
4020 "ManifestUtil/OutputMessage.cs"
4021 "ManifestUtil/PathUtil.cs"
4022 "ManifestUtil/RSAPKCS1SHA256SignatureDescription.cs"
4023 "ManifestUtil/Util.cs"
4024 "ManifestUtil/XmlNamespaces.cs"
4025 "ManifestUtil/XmlUtil.cs"
4026 "ManifestUtil/XPaths.cs"
4027 "Message.cs"
4028 "Move.cs"
4029 "MSBuild.cs"
4030 "NativeMethods.cs"
4031 "ParserState.cs"
4032 "RCWForCurrentContext.cs"
4033 "RedistList.cs"
4034 "RegisterAssembly.cs"
4035 "RemoveDir.cs"
4036 "RequiresFramework35SP1Assembly.cs"
4037 "ResGen.cs"
4038 "ResGenDependencies.cs"
4039 "ResolveCodeAnalysisRuleSet.cs"
4040 "ResolveKeySource.cs"
4041 "ResolveManifestFiles.cs"
4042 "ResolveNonMSBuildProjectOutput.cs"
4043 "ResolveProjectBase.cs"
4044 "ResolveSDKReference.cs"
4045 "SGen.cs"
4046 "StrongNameException.cs"
4047 "System.Design.cs"
4048 "TaskExtension.cs"
4049 "Telemetry.cs"
4050 "TlbImp.cs"
4051 "ToolTaskExtension.cs"
4052 "Touch.cs"
4053 "UnregisterAssembly.cs"
4054 "VisualBasicParserUtilities.cs"
4055 "Warning.cs"
4056 "WinMDExp.cs"
4057 "WriteCodeFragment.cs"
4058 "XmlPeek.cs"
4059 "XmlPoke.cs"
4060 "XslTransformation.cs"
4061 "AssemblyDependency/AssemblyMetadata.cs"))
4062 (append
4063 (map (lambda (f) (string-append "src/Shared/LanguageParser/" f))
4064 '("CSharptokenCharReader.cs"
4065 "CSharptokenizer.cs"
4066 "tokenChar.cs"
4067 "token.cs"
4068 "VisualBasictokenCharReader.cs"
4069 "VisualBasictokenizer.cs"
4070 "CSharptokenEnumerator.cs"
4071 "StreamMappedString.cs"
4072 "tokenCharReader.cs"
4073 "tokenEnumerator.cs"
4074 "VisualBasictokenEnumerator.cs"))
4075 '("src/Shared/AssemblyNameExtension.cs"
4076 "src/Shared/Constants.cs"
4077 "src/Shared/NGen.cs"
4078 "src/Shared/PropertyParser.cs"
4079 "src/Shared/ConversionUtilities.cs"
4080 "src/Shared/MetadataConversionUtilities.cs"
4081 "src/Shared/AssemblyNameComparer.cs"
4082 "src/Shared/AssemblyNameReverseVersionComparer.cs"
4083 "src/Shared/FileMatcher.cs"
4084 "src/Shared/RegistryHelper.cs"
4085 "src/Shared/StrongNameHelpers.cs"
4086 "src/Shared/AssemblyFolders/AssemblyFoldersFromConfig.cs" ; class
4087 ;; Requires Evaluation.
4088 "src/Shared/FrameworkLocationHelper.cs"))))
4089
4090 ;;; --- 4. Build Microsoft.Build.dll (The Main Engine)
4091
4092 ;; src/Build/Resources/AssemblyResources.cs was
4093 ;; hand-written to fall-back to EXE resources,
4094 ;; so no resx2sr here.
4095
4096 (invoke "resgen" "src/Shared/Resources/Strings.shared.resx"
4097 "artifacts/Microsoft.Build.Strings.shared.resources")
4098 (invoke "resgen" "src/Build/Resources/Strings.resx"
4099 "artifacts/Microsoft.Build.Strings.resources")
4100 (invoke "resgen" "src/MSBuild/Resources/Strings.resx"
4101 "artifacts/Microsoft.Build.Strings.commandline.resources")
4102
4103 (apply invoke "mcs"
4104 (append mcs-flags
4105 `("-d:BUILD_ENGINE"
4106 "-d:FEATURE_ASSEMBLY_LOADFROM"
4107 "-d:FEATURE_SYSTEM_CONFIGURATION"
4108 "-target:library"
4109 "-out:artifacts/Microsoft.Build.dll"
4110 "-resource:artifacts/Microsoft.Build.Strings.shared.resources,Microsoft.Build.Strings.shared.resources"
4111 "-resource:artifacts/Microsoft.Build.Strings.resources,Microsoft.Build.Strings.resources"
4112 "-resource:artifacts/Microsoft.Build.Strings.commandline.resources,Microsoft.Build.Strings.commandline.resources"
4113
4114 "-r:System.Configuration.dll"
4115 "-r:System.Threading.Tasks.Dataflow.dll"
4116 "-r:System.IO.Compression.dll"
4117 "-r:artifacts/Microsoft.Build.Framework.dll"
4118 ,(string-append "-r:"
4119 (search-input-file inputs
4120 "/lib/mono/4.5/System.Collections.Immutable.dll"))
4121 "Version.cs")
4122 (filter (lambda (name)
4123 (not (string-contains name "/Originals/")))
4124 (find-files "src/Build" "\\.cs$"))
4125 (map (lambda (f) (string-append "src/Shared/" f))
4126 '("CollectionHelpers.cs"
4127 "Constants.cs"
4128 "EscapingUtilities.cs"
4129 "FileUtilities.cs"
4130 "FileUtilitiesRegex.cs"
4131 "TempFileUtilities.cs"
4132 "FileUtilities.GetFolderPath.cs"
4133 "InterningBinaryReader.cs"
4134 "MSBuildNameIgnoreCaseComparer.cs"
4135 "NativeMethodsShared.cs"
4136 "ResourceUtilities.cs"
4137 "StringBuilderCache.cs"
4138 "Traits.cs"
4139 "IKeyed.cs"
4140 "Pair.cs"
4141 "EscapingStringExtensions/EscapingStringExtensions.cs"
4142 "NodeShutdown.cs"
4143 "NodeEngineShutdownReason.cs"
4144 "NodePacketFactory.cs"
4145 "INodeEndpoint.cs"
4146 "NodeBuildComplete.cs"
4147 "LogMessagePacketBase.cs"
4148 "NodeEndpointOutOfProcBase.cs"
4149 "ProjectFileErrorUtilities.cs"
4150 "TaskHostConfiguration.cs"
4151 "TaskHostTaskCancelled.cs"
4152 "TaskHostTaskComplete.cs"
4153 "ToolsetElement.cs"
4154 "TaskEngineAssemblyResolver.cs"
4155 "RegisteredTaskObjectCacheBase.cs"
4156 "TypeLoader.cs"
4157 "LoadedType.cs"
4158 "AssemblyLoadInfo.cs"
4159 "ReuseableStringBuilder.cs"
4160 "TaskParameter.cs"
4161 "TaskParameterTypeVerifier.cs"
4162 "OutOfProcTaskHostTaskResult.cs"
4163 "VisualStudioConstants.cs"
4164 "CommunicationsUtilities.cs"
4165 "XMakeAttributes.cs"
4166 "XMakeElements.cs"
4167 ;; Yes, again. It has a feature flag check.
4168 "TaskLoggingHelper.cs"
4169 "TaskLoggingHelperExtension.cs"
4170 "AssemblyNameComparer.cs"
4171 "EncodingUtilities.cs"
4172 "BuildEventFileInfo.cs"
4173 "CopyOnWriteDictionary.cs"
4174 "FileDelegates.cs"
4175 "HybridDictionary.cs"
4176 "IConstrainedEqualityComparer.cs"
4177 "IElementLocation.cs"
4178 "INodePacket.cs"
4179 "INodePacketFactory.cs"
4180 "INodePacketHandler.cs"
4181 "INodePacketTranslatable.cs"
4182 "INodePacketTranslator.cs"
4183 "NGen.cs"
4184 "OpportunisticIntern.cs"
4185 "ErrorUtilities.cs"
4186 "ExceptionHandling.cs"
4187 "AssemblyUtilities.cs"
4188 "AwaitExtensions.cs"
4189 "BuildEnvironmentHelper.cs"
4190 "ConversionUtilities.cs"
4191 "EnvironmentUtilities.cs"
4192 "EventArgsFormatting.cs"
4193 "FileMatcher.cs"
4194 "FrameworkLocationHelper.cs"
4195 "NodePacketTranslator.cs"
4196 "ProjectErrorUtilities.cs"
4197 "ProjectWriter.cs"
4198 "PropertyParser.cs"
4199 "ReadOnlyEmptyCollection.cs"
4200 "ReadOnlyEmptyDictionary.cs"
4201 "TaskLoader.cs"
4202 "ThreadPoolExtensions.cs"
4203 "Tracing.cs"
4204 "VersionUtilities.cs"
4205 "XmlUtilities.cs"
4206 "VisualStudioLocationHelper.cs"
4207 "Modifiers.cs"
4208 "ReadOnlyCollection.cs"
4209 "AssemblyNameExtension.cs"
4210 "BufferedReadStream.cs"
4211 "CanonicalError.cs"
4212 "EncodingStringWriter.cs"
4213 "InternalErrorException.cs"))))
4214
4215 ;;; --- 5. Build MSBuild.exe (the executable)
4216
4217 ;; no resx2sr since src/MSBuild/AssemblyResources.cs is hand-written.
4218 (invoke "resgen" "src/MSBuild/Resources/Strings.resx"
4219 "artifacts/MSBuild.Strings.resources")
4220 (invoke "resgen" "src/Shared/Resources/Strings.shared.resx"
4221 "artifacts/MSBuild.Strings.shared.resources")
4222 (apply invoke "mcs"
4223 (append mcs-flags
4224 '("-target:exe"
4225 "-out:artifacts/MSBuild.exe"
4226 ;; Add the correct logical names (RHS) for BOTH resource files.
4227 "-resource:artifacts/MSBuild.Strings.resources,MSBuild.Strings.resources"
4228 "-resource:artifacts/MSBuild.Strings.shared.resources,MSBuild.Strings.shared.resources"
4229 "-r:artifacts/Microsoft.Build.dll"
4230 "-r:artifacts/Microsoft.Build.Framework.dll"
4231 "-r:artifacts/Microsoft.Build.Tasks.Core.dll"
4232 "Version-exe.cs")
4233 (find-files "src/MSBuild" "\\.cs$")
4234 '("src/Shared/QuotingUtilities.cs"
4235 "src/Shared/ExceptionHandling.cs"))))))
4236 (replace 'install
4237 (lambda* (#:key inputs outputs #:allow-other-keys)
4238 (let* ((lib-dir (string-append #$output "/lib/mono/msbuild"))
4239 (bin-dir (string-append #$output "/bin")))
4240 (mkdir-p lib-dir)
4241 (mkdir-p bin-dir)
4242 (for-each (lambda (file)
4243 (install-file file lib-dir))
4244 (find-files "artifacts" "(\\.dll|\\.exe)$"))
4245 (for-each (lambda (file)
4246 (install-file file lib-dir))
4247 (find-files "src/Tasks" "\\.(targets|props|tasks)$"))
4248 (substitute* '("src/MSBuild/app.amd64.config"
4249 "src/MSBuild/app.config")
4250 (("</configuration>")
4251 (string-append "<runpath path=\""
4252 (dirname
4253 (search-input-file inputs
4254 "/lib/mono/4.5/System.Reflection.Metadata.dll"))
4255 ":"
4256 (dirname
4257 (search-input-file inputs
4258 "/lib/mono/4.5/System.Collections.Immutable.dll"))
4259 "\"/></configuration>")))
4260 (copy-file #$(if (target-x86-64? (or (%current-target-system)
4261 (%current-system)))
4262 "src/MSBuild/app.amd64.config"
4263 "src/MSBuild/app.config")
4264 (string-append lib-dir "/MSBuild.exe.config"))
4265 (let* ((msbuild-exe (string-append lib-dir "/MSBuild.exe"))
4266 (wrapper (string-append bin-dir "/msbuild")))
4267 (call-with-output-file wrapper
4268 (lambda (port)
4269 (format port "#!~a
4270exec ~s ~s \"$@\"~%"
4271 (search-input-file inputs "/bin/bash")
4272 (search-input-file inputs "/bin/mono")
4273 msbuild-exe)))
4274 (chmod wrapper #o755))))))))
4275 (synopsis "Microsoft Build Engine (MSBuild) for mono")
4276 (description "This package provides MSBuild, the build tool for .NET.")
4277 (home-page "https://github.com/dotnet/msbuild")
4278 (license license:expat)))