This repository has been archived by the owner on Jan 3, 2023. It is now read-only.
/
README.html
executable file
·589 lines (524 loc) · 18.5 KB
/
README.html
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
<html>
<head>
<Attribute>
<title>F# Compiler Source Drop, (3.0, not yet released externally)</title>
<style type="text/css">
TT { font-weight: bold; color: blue; font-size: 10pt; }
PRE { font-weight: bold; color: blue; font-size: 10pt; }
.title_2ndLvl
{
font-family: tahoma;
font-size: 120%;
color: #FFFFFF;
padding-left: 5px;
}
.BODY
{
font-family:verdana;
}
A
{
color: #003399;
}
.VR
{
background-color: #cccccc;
width: 1px;
}
.HR
{
background-color: #cccccc;
height: 1px;
}
.link1
{
font-size:70%;
font-family: verdana;
}
.link2
{
font-size: 70%;
font-family:Verdana;
font-style:italic;
}
.link3
{
font-style: italic;
font-family: Verdana;
color: #000000;
font-weight: bold;
}
.link4
{
font: italic 70% Verdana;
color: #000000;
text-decoration: none;
}
.link5
{
font: 70% Verdana;
color: #003399;
text-decoration: none;
}
.link6
{
font: 70% verdana;
color: #003399;
}
.text1
{
font: 70% Verdana;
}
.text2
{
padding-bottom: 10px;
font: 70% Verdana;
}
.text3
{
font-size: 120%;
font-family:Verdana;
color: #000000;
}
.text3_w_padding
{
font: 120% Verdana;
color: #000000;
padding-left:20px;
}
.text4
{
font-weight: bold;
font-size: 70%;
font-family: Verdana;
color: #000000;
}
.text5
{
padding-left: 5px;
font-weight: bold;
font-size: 70%;
font-family: Verdana;
color: #ffffff;
}
.text6
{
font: 70%;
font-family: verdana;
}
.newsTitle
{
font-family: tahoma;
font-size: 120%;
color: #CCCCCC;
}
.areaTitle
{
font-family: tahoma;
font-size: 120%;
color: #FFFFFF;
}
.newsContentTitle
{
font-family: tahoma;
font-size: 120%;
color: #FFFFFF;
}
.areaContentTitle
{
font-family: verdana;
font-size: 140%;
color: #000000;
}
.areaContentTitle_w_pad
{
font-family: verdana;
font-size: 140%;
color: #000000;
padding-left: 20px;
padding-top: 20px;
}
.newsArchiveTitle
{
font-family: verdana;
font-size: 150%;
color: #000000;
}
.FeatureStoryTitle
{
font-family: verdana;
font-size: 130%;
color: #000000;
}
.FeatureStoryByLine
{
font-family: verdana;
font-size: 80%;
color: #000000;
}
.SideBarLink
{
font-family: verdana;
font-size: 80%;
color: #000000;
}
.newsArchiveSubTitle
{
font-family: verdana;
font-size: 118%;
color: #666666;
}
.newsArchiveYear
{
font: bold 80% Verdana;
color: #000000;
border-bottom: #cccccc 1px solid;
border-top: #cccccc 1px solid;
}
.newsHeadlineTitle
{
font-family: verdana;
font-size: 140%;
color: #000000;
}
.newsPublicationDate
{
font-family: Verdana;
font-size: 60%;
color: #000000;
font-weight: bold;
}
.newsPublicationSource
{
font-family: Verdana;
font-size: 60%;
color: #000000;
font-weight: bold;
}
H1
{
font-family: tahoma;
font-weight: bold;
font-size: 120%;
color: #000000;
}
H3
{
font-family: tahoma;
font-weight: bold;
font-size: 110%;
color: #000000;
}
P
{
font-family: verdana;
font-size: 70%;
color: #000000;
}
P P
{
font-size: 100%;
}
HR
{
color: #cccccc;
height: 1px;
}
.groupheading
{
padding-left: 20px;
padding-top: 40px;
padding-bottom: 10px;
font-size: 1.4em;
color: #0065CF;
font-family:verdana;
}
.GroupTitle
{
padding-left: 20px;
padding-top: 20px;
padding-bottom: 10px;
font-size: 1.4em;
color: #0065CF;
}
LI
{
font-size: 70%;
font-family: Verdana;
}
LI LI
{
font-size: 100%;
}
LI A
{
font-size: 100%;
}
.linkbox
{
margin-left: 20px;
margin-right: 30px;
margin-bottom: 20px;
padding-bottom: 10px;
width: 175px;
float: right;
border-right: #0066CC 1px solid;
background: #f1f1f1;
border-left: #0066CC 1px solid;
border-bottom: #0066CC 1px solid;
}
.outlineDivTitle
{
background-color: #0066CC;
color: #FFFFFF;
padding-left: 15px;
padding-bottom: 2px;
padding-top: 2px;
font: bold 70% Verdana;
color: #ffffff;
}
.outlineDiv
{
padding-left: 20px;
background-image: URL(/images/blueTriangle.gif);
background-repeat: no-repeat;
background-position: 6 8;
font: 70% verdana;
color: #003399;
line-height: 200%;
} </style>
</head>
<body>
<h1>F# 3.0 Compiler + Library Source Code Drop, matching Visual Studio 2012 (R) RTM binary release</h1>
<p>This directory contains a drop of the source code for an F# 3.0 compiler and core library.
The code has been cleaned up "a little" to try to help ensure better stability as
more development is done on the codebase. </p>
<p>The compiler is normally compiled as a set of .NET 4.0 components.
The compiler can also be hosted in a browser to implement websites like <a href="http://www.tryfsharp.org">Try F#</a>.</p>
<p><b>Before we start, are sure you're in the right place?</b></p>
<ul>
<li>To get a free F# environment for Windows, go to <a href="http://fsharp.net">fsharp.net</a> </li>
<li>To get a free F# environment for Linux or Mac, go to <a href="http://fsxplat.codeplex.com/">fsxplat.codeplex.com</a>
<li>To learn what F# is and why it's interesting, go to <a href="http://fsharp.net">fsharp.net</a> or <a href="http://tryfsharp.org">tryfsharp.org</a> </li>
<li>If you want to to use F# in Visual Studio 2010 (R) or Visual Studio 2012 (R), go to <a href="http://fsharp.net">fsharp.net</a>.</li>
<li>Looking for F# coding samples? Go to <a href="http://fsharp.net">fsharp.net</a> or <a href="http://tryfsharp.org">tryfsharp.org</a>
or <a href="http://fssnip.net">fssnip.net</a>. While the code has its nice points, it is not a model F# codebase and should not be used
as guidance for F# coding style - there are plenty of things we would change if
we had all the time in the world.</li>
</ul>
<p>
To emphasize, this distribution should not be seen as a way to "get" an F#
compiler for immediate use. For that you're better going to <a href="http://fsharp.net">fsharp.net</a> or
<a href="http://fsxplat.codeplex.com/">fsxplat.codeplex.com</a>
<p>
<b>License:</b> subject to terms and conditions of the Apache License, Version 2.0. A
copy of the license can be found in the <a href="license.html">License.html</a> file at the root of this distribution.
By using this source code in any fashion, you are agreeing to be bound
by the terms of the Apache License, Version 2.0. You must not remove this notice, or any other, from this software.</p>
<p><b>Questions?</b> If you have questions about the source code, please ask at the <a href="http://groups.google.com/group/fsharp-opensource">F# Open Source Google Group</a>.
Please do not ask the F# team at Microsoft for
help with this source code: they like to be friendly, but they are very busy
working on improving F# and need to focus on that.</p>
<p><b>Updates?</b> The F# team do not do active development in open repositories,
though some changes such as cleanup or additional tools may be submitted. They
aspire to update the code drop when future versions of F# compilers are
released from Microsoft, usually at or around the RTM stage.</p>
<p><b>Copyright:</b> Copyright 2002-2012 (c) Microsoft Corporation.</p>
<h3>What do I get when I compile?</h3>
<p>When you build the compiler using the standard instructions below, you get <tt>fsc.exe</tt>, <tt>fsi.exe</tt>, <tt>FSharp.Core.dll</tt>, <tt>FSharp.Compiler.dll</tt> and some related DLLs.</p>
<p>The compiler binaries produced are "private" and
strong-named signed with a test key (src\fsharp\test.snk). They use CLI assembly version nunmber 2.9.9.999. You can place these components in the GAC but they will not replace
the components used by normal Visual Studio or normal F# programs. </p>
<h3>Steps - Building a Proto Compiler </h3>
<pre>
cd src
gacutil /i ..\lkg\FSharp-2.0.50726.900\bin\FSharp.Core.dll
msbuild fsharp-proto-build.proj /p:TargetFramework=net40
</pre>
<p>Note: Make sure you run the .NET 4.0 msbuild.exe, e.g. <tt>C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</tt>.</p>
<p>Optional: NGEN the Proto Compiler for faster future startup (optional)</p>
<pre>
ngen install ..\Proto\net40\bin\fsc-proto.exe
</pre>
<h3>Steps - Building the F# Core Library</h3>
<p>This uses the proto compiler to build the FSharp.Core library, for Mono/.NET 4.0.</p>
<pre>
msbuild fsharp-library-build.proj /p:TargetFramework=net40
</pre>
<p>Note: Make sure you run the .NET 4.0 msbuild.exe, e.g. <tt>C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</tt>.</p>
<h3>Steps - Building the F# Compiler</h3>
<p>This uses the proto compiler to build the FSharp.Compiler.dll and fsc.exe to run on for Mono/.NET 4.0.</p>
<pre>
msbuild fsharp-compiler-build.proj /p:TargetFramework=net40
</pre>
<p>Note: Make sure you run the .NET 4.0 msbuild.exe, e.g. <tt>C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</tt>.</p>
<h3>Steps - Building a compiler component for hosting in the browser with Silverlight or Moonlight</h3>
<p>This builds <tt>FSharp.Compiler.Silverlight.dll</tt> which is a Silverlight 5.0 component for hosting in the browser.</p>
<pre>
-- Debug configuration for browser-hosted compiler for Silverlight 5.0:
msbuild fsharp-library-build.proj /p:TargetFramework=sl5-compiler
msbuild fsharp-compiler-build.proj /p:TargetFramework=sl5-compiler
-- Release configuration for browser-hosted compiler for Silverlight 5.0:
msbuild fsharp-library-build.proj /p:TargetFramework=sl5-compiler /p:Configuration=Release
msbuild fsharp-compiler-build.proj /p:TargetFramework=sl5-compiler /p:Configuration=Release
</pre>
<p>The binaries are placed in <tt>Debug\sl5-compiler</tt>, <tt>Release\sl5-compiler</tt>, <tt>Debug\sl5-compiler</tt> and/or <tt>Release\sl5-compiler</tt>.
<b>A custom <tt>FSharp.Core.dll</tt> is used for this configuration, be sure to reference it
rather than any other <tt>FSharp.Core.dll</tt> for Silverlight. You may have to edit your project file by hand to ensure
you get exactly the right reference to <tt>FSharp.Core.dll</tt>.</b> </p>
<h3>Building the F# core library for alternative CLI/.NET/CIL implementations</h3>
<pre>
msbuild fsharp-library-build.proj /p:TargetFramework=net20
msbuild fsharp-library-build.proj /p:TargetFramework=sl3-wp
msbuild fsharp-library-build.proj /p:TargetFramework=sl5
msbuild fsharp-library-build.proj /p:TargetFramework=net20 /p:Configuration=Release
msbuild fsharp-library-build.proj /p:TargetFramework=sl3-wp /p:Configuration=Release
msbuild fsharp-library-build.proj /p:TargetFramework=sl5 /p:Configuration=Release
</pre>
<p>Here <tt>net20</tt> gives a runtime for .NET 2.0-3.5, <tt>sl3-wp</tt> gives a runtime for Windows Phone 7,
and <tt>sl5</tt> gives a runtime for Silverlight 5.</p>
<h3>Steps - Building F# Core Unit Tests for .NET 4.x (optional)</h3>
<p>This uses the proto compiler to build the unit tests that check some parts of FSharp.Core.dll and FSharp.Compiler.dll.
There is also another set of tests under tests\fsharp.</p>
<pre>
msbuild fsharp-library-unittests-build.proj /p:TargetFramework=net40
</pre>
<p>Note: You must have NUnit installed.</p>
<h3>Steps - Running Compiler tests (on Windows)</h3>
<p>There are language tests under tests\fsharp\core. The test apparatus is primitive and unfortunately uses batch files.
You can run these on Windows using:</p>
<pre>
cd ..\tests\fsharp\core
..\..\build-and-run-all-installed-ilx-configs.bat results.log
</pre>
<p>The results file will contain one entry for each test directory, plus any reported errors.</p>
<pre>
C:\projects\openfsharp\Compiler\3.0\head\tests\fsharp\core
C:\projects\openfsharp\Compiler\3.0\head\tests\fsharp\core\queriesCustomQueryOps
C:\projects\openfsharp\Compiler\3.0\head\tests\fsharp\core\queriesLeafExpressionConvert
C:\projects\openfsharp\Compiler\3.0\head\tests\fsharp\core\queriesNullableOperators
C:\projects\openfsharp\Compiler\3.0\head\tests\fsharp\core\queriesOverIEnumerable
...
</pre>
<p>Some tests for LINQ queries require SQL Server be installed. A failing test will look like this:</p>
<pre>
ERRORLEVEL=1: in C:\projects\openfsharp\Compiler\3.0\head\tests\fsharp\core\csfromfs\build.bat
</pre>
<p>You can then go to the relevant directory and run 'build.bat' and 'run.bat'.</p>
<h3>Using the FSharp.Core you built</h3>
<p>The FSharp.Core.dll library produced uses the standard version number 4.3.0.0 and is delay signed with the Microsoft public key. This gives it
the same identity as FSharp.Core for F# 3.0 in Visual Studio 2012. <b>This means that if you have Visual Studio 2012 installed, the FSharp.Core you produce will not be used by default</b>. You must
replace the one in the GAC and skip strong-name verification for the DLL, e.g.
</p>
<pre>
sn -Vr FSharp.Core,*
gacutil /i Debug\net40\bin\FSharp.Core.dll
</pre>
<p>However, this is not recommended except in the rare case you are adding extra functionality to
FSharp.Core - it is better to just continue to run with the
FSharp.Core that comes with Visual Studio 2012.</p>
<h3>Preparing for inclusion in Mono</h3>
<p> Building for the 'mono20' and 'mono40' frameworks gives strong-named, delay-signed assemblies with the msfinal.pub key
and standard version numbers such as 2.0.0.0, 2.3.0.0, 4.0.0.0 and 4.3.0.0. You complete the signing of these assemblies using
<tt>http://github.com/fsharp/fsharp/raw/master/mono.snk</tt>. These assemblies will not run if you already have
a version of them installed in your GAC (e.g. if you have Visual Studio 2012).
</p>
<pre>
sn -R ..\Debug\mono40\bin\fsc.exe mono.snk
sn -R ..\Debug\mono40\bin\fsi.exe mono.snk
sn -R ..\Debug\mono40\bin\FSharp.Core.dll mono.snk
sn -R ..\Debug\mono40\bin\FSharp.Compiler.dll mono.snk
sn -R ..\Debug\mono40\bin\FSharp.Compiler.Server.Shared.dll mono.snk
sn -R ..\Debug\mono40\bin\FSharp.Compiler.Interactive.Settings.dll mono.snk
</pre>
<p>This is the way the assemblies are built in a source build of <a href="https://github.com/fsharp/fsharp">the canonical GitHub repository for fsharp</a>
and how the binaries are shipped in Mono binary distributions.
</p>
<h3>Notes on the build</h3>
<p>The prerequisites and build command line for compiling the source (on Windows) are shown
later in this README. Here's the logic of the build:</p>
<ul>
<li>We first need an existing F# compiler, usually the one available from <a href="http://fsharp.net">fsharp.net</a>,
although it could also be another. Let's assume this compiler has an FSharp.Core.dll with version X.</li>
<li>We use this compiler to compile the source in this distribution, to produce a "proto" compiler, in the Proto
directory. When run, this compiler still relies on the FSharp.Core.dll with version X.</li>
<li>We use the proto compiler to compile the source for FSharp.Core.dll in this distribution, producing
an FSharp.Core.dll with the version identified in src\source-build-version, usually 1.9.999.</li>
<li>We use the proto compiler to compile the source for FSharp.Compiler.dll, fsc.exe, fsi.exe and other
binaries found in this distribution. When run, these binaries will rely on the FSharp.Core.dll with version
1.9.999. This is good, since it means the 1.9.999 binaries now form a consistent, bootstrapped compiler. If
you like you should now be able to throw away the compiler with version X.</li>
</ul>
<p>Some additional tools are required to build the compiler, notably fslex.exe, fsyacc.exe,
FSharp.PowerPack.Build.Tasks.dll, FsSrGen.exe, FSharp.SRGen.Build.Tasks.dll and the other
tools found in the lkg directory. These are "Last Known Good" binaries created from a version of the F# Power Pack
on CodePlex. If you like you can throw away these binaries and use your own compiled versions of these.
tools.</p>
<h3>Validation and Use</h3>
<p>Here are some simple tests to validate what you have built by checking <tt>fsi.exe</tt> (F# Interactive) starts up:</p>
<pre>
ngen install ..\Debug\net40\bin\fsi.exe
..\Debug\net40\bin\fsi.exe
1 + 1;;
#q;;
..\Debug\net40\bin\fsi.exe /help
..\Debug\net40\bin\fsc.exe /help
echo printfn "hello world" > hello.fs
..\Debug\net40\bin\fsc.exe hello.fs
copy ..\Debug\net40\bin\FSharp.Core.dll .
hello.exe
del /q FSharp.Core.dll
</pre>
<h3>Some alternative Steps - Building for .NET 2.0 profile</h3>
<pre>
cd src
msbuild fsharp-proto-build.proj /p:TargetFramework=net20
msbuild fsharp-library-build.proj /p:TargetFramework=net20
msbuild fsharp-compiler-build.proj /p:TargetFramework=net20
msbuild fsharp-library-unittests-build.proj /p:TargetFramework=net20
ngen install ..\Debug\net20\bin\fsi.exe
..\Debug\net20\bin\fsi.exe
1 + 1;;
#q;;
..\Debug\net20\bin\fsi.exe /help
..\Debug\net20\bin\fsc.exe /help
echo printfn "hello world" > hello.fs
..\Debug\net20\bin\fsc.exe hello.fs
copy ..\Debug\net20\bin\FSharp.Core.dll .
hello.exe
del /q FSharp.Core.dll
</pre>
<h3>Some alternative Steps - Building an optimized (Release) compiler for .NET 4.0 profile</h3>
<pre>
msbuild fsharp-compiler-build.proj /p:TargetFramework=net40 /p:Configuration=Release
ngen install ..\Release\net40\bin\fsi.exe
..\Release\net40\bin\fsi.exe
1 + 1;;
#q;;
..\Release\net40\bin\fsi.exe /help
..\Release\net40\bin\fsc.exe /help
echo printfn "hello world" > hello.fs
..\Release\net40\bin\fsc.exe hello.fs
copy ..\Release\net40\bin\FSharp.Core.dll .
hello.exe
del /q FSharp.Core.dll
</pre>
<h3>Some alternative Steps - Other examples of building for Release mode (choose some of these as you need)</h3>
<pre>
msbuild fsharp-library-build.proj /p:Configuration=Release
msbuild fsharp-library-build.proj /p:TargetFramework=net20 /p:Configuration=Release
msbuild fsharp-library-build.proj /p:TargetFramework=net40 /p:Configuration=Release
msbuild fsharp-library-build.proj /p:TargetFramework=sl3-wp /p:Configuration=Release
msbuild fsharp-library-build.proj /p:TargetFramework=sl5 /p:Configuration=Release
msbuild fsharp-compiler-build.proj /p:TargetFramework=net20 /p:Configuration=Release
</pre>
<h3>Editing and Building on Windows using Visual Studio 2012</h3>
<h3>Prerequisites</h3>
<ul>
<li>Visual Studio Shell 2012 (with F# CTP MSI added), Visual Studio Professional 2012 or another non-Express version of Visual Studio 2012.</li>
</ul>
<h3>Editing and Building</h3>
<p>Open all-vs2012.sln, and edit in modes Debug or Release. The compiler takes a long time to compile and
that can be a bit invasive to the work flow, so it's normally better to do the actual compilation from the command line,
see above.</p>
</body>