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