Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcdf8abb

Browse files
committed
Merge pull requestfsharp#35 from jack-pappas/master
Changed README to use Markdown formatting
2 parentsb273df3 +c136bb1 commitcdf8abb

File tree

2 files changed

+276
-589
lines changed

2 files changed

+276
-589
lines changed

‎README-original.md‎

Lines changed: 276 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,276 @@
1+
F# 3.0 Compiler + Library Source Code Drop, matching Visual Studio 2012 (R) RTM binary release
2+
===
3+
4+
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.
5+
6+
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[Try F#](http://tryfsharp.org).
7+
8+
**Before we start, are sure you're in the right place?**
9+
10+
* To get a free F# environment for Windows, go to[fsharp.net](http://fsharp.net).
11+
* To get a free F# environment for Linux or Mac, go to[fsxplat.codeplex.com](http://fsxplat.codeplex.com).
12+
* To learn what F# is and why it's interesting, go to[fsharp.net](http://fsharp.net) or[tryfsharp.org](http://tryfsharp.org).
13+
* If you want to to use F# in Visual Studio 2010 (R) or Visual Studio 2012 (R), go to[fsharp.net](http://fsharp.net).
14+
* Looking for F# coding samples? Go to[fsharp.net](http://fsharp.net) or[tryfsharp.org](http://tryfsharp.org) or[fssnip.net](http://fssnip.net). 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.
15+
16+
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[fsharp.net](http://fsharp.net) or[fsxplat.codeplex.com](http://fsxplat.codeplex.com)
17+
18+
**License:** subject to terms and conditions of the Apache License, Version 2.0. A copy of the license can be found in the License.html 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.
19+
20+
**Questions?** If you have questions about the source code, please ask at the[F# Open Source Google Group](http://groups.google.com/group/fsharp-opensource). 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.
21+
22+
**Updates?** 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.
23+
24+
**Copyright:** Copyright 2002-2012 (c) Microsoft Corporation.
25+
26+
27+
##What do I get when I compile?
28+
29+
When you build the compiler using the standard instructions below, you get`fsc.exe`,`fsi.exe`,`FSharp.Core.dll`,`FSharp.Compiler.dll` and some related DLLs.
30+
31+
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.
32+
33+
34+
##Steps - Building a Proto Compiler
35+
36+
```
37+
cd src
38+
gacutil /i ..\lkg\FSharp-2.0.50726.900\bin\FSharp.Core.dll
39+
msbuild fsharp-proto-build.proj /p:TargetFramework=net40
40+
```
41+
42+
Note: Make sure you run the .NET 4.0`msbuild.exe`, e.g.`C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe`.
43+
44+
Optional: NGEN the Proto Compiler for faster future startup (optional)
45+
46+
```
47+
ngen install ..\Proto\net40\bin\fsc-proto.exe
48+
```
49+
50+
51+
##Steps - Building the F# Core Library
52+
53+
This uses the proto compiler to build the FSharp.Core library, for Mono/.NET 4.0.
54+
55+
```
56+
msbuild fsharp-library-build.proj /p:TargetFramework=net40
57+
```
58+
59+
Note: Make sure you run the .NET 4.0`msbuild.exe`, e.g.`C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe`.
60+
61+
62+
##Steps - Building the F# Compiler
63+
64+
This uses the proto compiler to build the`FSharp.Compiler.dll` and`fsc.exe` to run on for Mono/.NET 4.0.
65+
66+
```
67+
msbuild fsharp-compiler-build.proj /p:TargetFramework=net40
68+
```
69+
70+
Note: Make sure you run the .NET 4.0`msbuild.exe`, e.g.`C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe`.
71+
72+
73+
##Steps - Building a compiler component for hosting in the browser with Silverlight or Moonlight
74+
75+
This builds`FSharp.Compiler.Silverlight.dll` which is a Silverlight 5.0 component for hosting in the browser.
76+
77+
*Debug configuration for browser-hosted compiler for Silverlight 5.0:*
78+
```
79+
msbuild fsharp-library-build.proj /p:TargetFramework=sl5-compiler
80+
msbuild fsharp-compiler-build.proj /p:TargetFramework=sl5-compiler
81+
```
82+
83+
*Release configuration for browser-hosted compiler for Silverlight 5.0:*
84+
```
85+
msbuild fsharp-library-build.proj /p:TargetFramework=sl5-compiler /p:Configuration=Release
86+
msbuild fsharp-compiler-build.proj /p:TargetFramework=sl5-compiler /p:Configuration=Release
87+
```
88+
89+
The binaries are placed in`Debug\sl5-compiler`,`Release\sl5-compiler`,`Debug\sl5-compiler` and/or`Release\sl5-compiler`. A custom`FSharp.Core.dll` is used for this configuration, be sure to reference it rather than any other`FSharp.Core.dll` for Silverlight. You may have to edit your project file by hand to ensure you get exactly the right reference to`FSharp.Core.dll`.
90+
91+
92+
##Building the F# core library for alternative CLI/.NET/CIL implementations
93+
94+
```
95+
msbuild fsharp-library-build.proj /p:TargetFramework=net20
96+
msbuild fsharp-library-build.proj /p:TargetFramework=sl3-wp
97+
msbuild fsharp-library-build.proj /p:TargetFramework=sl5
98+
```
99+
100+
```
101+
msbuild fsharp-library-build.proj /p:TargetFramework=net20 /p:Configuration=Release
102+
msbuild fsharp-library-build.proj /p:TargetFramework=sl3-wp /p:Configuration=Release
103+
msbuild fsharp-library-build.proj /p:TargetFramework=sl5 /p:Configuration=Release
104+
```
105+
106+
Here**net20** gives a runtime for .NET 2.0-3.5,**sl3-wp** gives a runtime for Windows Phone 7, and**sl5** gives a runtime for Silverlight 5.
107+
108+
109+
##Steps - Building F# Core Unit Tests for .NET 4.x (optional)
110+
111+
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`.
112+
113+
```
114+
msbuild fsharp-library-unittests-build.proj /p:TargetFramework=net40
115+
```
116+
117+
*Note: You must have NUnit installed.*
118+
119+
120+
##Steps - Running Compiler tests (on Windows)
121+
122+
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:
123+
124+
```
125+
cd ..\tests\fsharp\core
126+
..\..\build-and-run-all-installed-ilx-configs.bat results.log
127+
```
128+
129+
The results file will contain one entry for each test directory, plus any reported errors.
130+
131+
```
132+
C:\projects\openfsharp\Compiler\3.0\head\tests\fsharp\core
133+
C:\projects\openfsharp\Compiler\3.0\head\tests\fsharp\core\queriesCustomQueryOps
134+
C:\projects\openfsharp\Compiler\3.0\head\tests\fsharp\core\queriesLeafExpressionConvert
135+
C:\projects\openfsharp\Compiler\3.0\head\tests\fsharp\core\queriesNullableOperators
136+
C:\projects\openfsharp\Compiler\3.0\head\tests\fsharp\core\queriesOverIEnumerable
137+
...
138+
```
139+
140+
Some tests for LINQ queries require SQL Server be installed. A failing test will look like this:
141+
142+
```
143+
ERRORLEVEL=1: in C:\projects\openfsharp\Compiler\3.0\head\tests\fsharp\core\csfromfs\build.bat
144+
```
145+
146+
You can then go to the relevant directory and run`build.bat` and`run.bat`.
147+
148+
149+
##Using the FSharp.Core you built
150+
151+
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. This means that if you have Visual Studio 2012 installed, the`FSharp.Core` you produce will not be used by default. You must replace the one in the GAC and skip strong-name verification for the DLL, e.g.
152+
153+
```
154+
sn -Vr FSharp.Core,*
155+
gacutil /i Debug\net40\bin\FSharp.Core.dll
156+
```
157+
158+
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.
159+
160+
161+
##Preparing for inclusion in Mono
162+
163+
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[http://github.com/fsharp/fsharp/raw/master/mono.snk](http://github.com/fsharp/fsharp/raw/master/mono.snk). 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).
164+
165+
```
166+
sn -R ..\Debug\mono40\bin\fsc.exe mono.snk
167+
sn -R ..\Debug\mono40\bin\fsi.exe mono.snk
168+
sn -R ..\Debug\mono40\bin\FSharp.Core.dll mono.snk
169+
sn -R ..\Debug\mono40\bin\FSharp.Compiler.dll mono.snk
170+
sn -R ..\Debug\mono40\bin\FSharp.Compiler.Server.Shared.dll mono.snk
171+
sn -R ..\Debug\mono40\bin\FSharp.Compiler.Interactive.Settings.dll mono.snk
172+
```
173+
174+
This is the way the assemblies are built in a source build of the canonical GitHub repository for F# and how the binaries are shipped in Mono binary distributions.
175+
176+
177+
##Notes on the build
178+
179+
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:
180+
181+
* We first need an existing F# compiler, usually the one available from[fsharp.net](http://fsharp.net), although it could also be another. Let's assume this compiler has an`FSharp.Core.dll` with version X.
182+
* 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.
183+
* 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**.
184+
* 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.
185+
186+
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.
187+
188+
189+
##Validation and Use
190+
191+
Here are some simple tests to validate what you have built by checking`fsi.exe` (F# Interactive) starts up:
192+
193+
```
194+
ngen install ..\Debug\net40\bin\fsi.exe
195+
..\Debug\net40\bin\fsi.exe
196+
1 + 1;;
197+
\#q;;
198+
..\Debug\net40\bin\fsi.exe /help
199+
..\Debug\net40\bin\fsc.exe /help
200+
echo printfn "hello world" > hello.fs
201+
..\Debug\net40\bin\fsc.exe hello.fs
202+
copy ..\Debug\net40\bin\FSharp.Core.dll .
203+
hello.exe
204+
del /q FSharp.Core.dll
205+
```
206+
207+
208+
##Some alternative Steps - Building for .NET 2.0 profile
209+
210+
```
211+
cd src
212+
msbuild fsharp-proto-build.proj /p:TargetFramework=net20
213+
msbuild fsharp-library-build.proj /p:TargetFramework=net20
214+
msbuild fsharp-compiler-build.proj /p:TargetFramework=net20
215+
msbuild fsharp-library-unittests-build.proj /p:TargetFramework=net20
216+
```
217+
218+
```
219+
ngen install ..\Debug\net20\bin\fsi.exe
220+
..\Debug\net20\bin\fsi.exe
221+
1 + 1;;
222+
\#q;;
223+
..\Debug\net20\bin\fsi.exe /help
224+
..\Debug\net20\bin\fsc.exe /help
225+
echo printfn "hello world" > hello.fs
226+
..\Debug\net20\bin\fsc.exe hello.fs
227+
copy ..\Debug\net20\bin\FSharp.Core.dll .
228+
hello.exe
229+
del /q FSharp.Core.dll
230+
```
231+
232+
233+
##Some alternative Steps - Building an optimized (Release) compiler for .NET 4.0 profile
234+
235+
```
236+
msbuild fsharp-compiler-build.proj /p:TargetFramework=net40 /p:Configuration=Release
237+
```
238+
239+
```
240+
ngen install ..\Release\net40\bin\fsi.exe
241+
..\Release\net40\bin\fsi.exe
242+
1 + 1;;
243+
\#q;;
244+
..\Release\net40\bin\fsi.exe /help
245+
..\Release\net40\bin\fsc.exe /help
246+
echo printfn "hello world" > hello.fs
247+
..\Release\net40\bin\fsc.exe hello.fs
248+
copy ..\Release\net40\bin\FSharp.Core.dll .
249+
hello.exe
250+
del /q FSharp.Core.dll
251+
```
252+
253+
254+
##Some alternative Steps - Other examples of building for Release mode (choose some of these as you need)
255+
256+
```
257+
msbuild fsharp-library-build.proj /p:Configuration=Release
258+
msbuild fsharp-library-build.proj /p:TargetFramework=net20 /p:Configuration=Release
259+
msbuild fsharp-library-build.proj /p:TargetFramework=net40 /p:Configuration=Release
260+
msbuild fsharp-library-build.proj /p:TargetFramework=sl3-wp /p:Configuration=Release
261+
msbuild fsharp-library-build.proj /p:TargetFramework=sl5 /p:Configuration=Release
262+
```
263+
264+
```
265+
msbuild fsharp-compiler-build.proj /p:TargetFramework=net20 /p:Configuration=Release
266+
```
267+
268+
269+
##Editing and Building on Windows using Visual Studio 2012
270+
###Prerequisites
271+
272+
Visual Studio Shell 2012 (with F# CTP MSI added), Visual Studio Professional 2012 or another non-Express version of Visual Studio 2012.
273+
274+
###Editing and Building
275+
276+
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.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp