Skip to content
This repository was archived by the owner on Feb 19, 2020. It is now read-only.

Commit e3d597d

Browse files
committed
Fix READMEs to document build on windows
1 parent 3c49693 commit e3d597d

File tree

2 files changed

+121
-216
lines changed

2 files changed

+121
-216
lines changed

README-original.md

+3-206
Original file line numberDiff line numberDiff line change
@@ -1,214 +1,11 @@
11
F# 3.0 Compiler + Library Source Code Drop, matching Visual Studio 2012 (R) RTM binary release
22
===
33

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.
54

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).
5+
The original README can be found at http://fsharppowerpack.codeplex.com/SourceControl/changeset/view/70537#1229467
76

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 learn what F# is and why it's interesting, go to [fsharp.net](http://fsharp.net) or [tryfsharp.org](http://tryfsharp.org).
12-
* If you want to to use F# in Visual Studio 2010 (R) or Visual Studio 2012 (R), go to [fsharp.net](http://fsharp.net).
13-
* 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.
7+
It has been removed to avoid confusion because the build instructions were Windows-specific.
148

159
**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.
1610

17-
**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.
18-
19-
**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.
20-
21-
**Copyright:** Copyright 2002-2012 (c) Microsoft Corporation.
22-
23-
##What do I get when I compile?
24-
25-
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.
26-
27-
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.
28-
29-
30-
##Building Everything for .NET 2.0 and 4.0 with msbuild/build
31-
32-
To just build everything use:
33-
```
34-
cd src
35-
msbuild fsharp-build.proj
36-
```
37-
If on Mono, use 'xbuild' instead of 'msbuild'
38-
39-
##Step by step - Building a Proto Compiler
40-
41-
If you prefer to do things the slow way, then this is step 1:
42-
```
43-
cd src
44-
msbuild fsharp-proto-build.proj
45-
```
46-
47-
Note: On Windows, make sure you run the .NET 4.0 `msbuild.exe`, e.g. `C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe`.
48-
On Linux and Mac, you can use xbuild.
49-
50-
Optional: NGEN the Proto Compiler for faster future startup (optional)
51-
52-
```
53-
ngen install ..\Proto\net40\bin\fsc-proto.exe
54-
```
55-
56-
57-
##Steps - Building the F# Core Library with msbuild/build
58-
59-
The next step uses the proto compiler to build the FSharp.Core library, for Mono/.NET 4.0.
60-
61-
```
62-
msbuild fsharp-library-build.proj
63-
```
64-
65-
##Steps - Building the F# Compiler with msbuild/build
66-
67-
The next step uses the proto compiler to build the `FSharp.Compiler.dll` and `fsc.exe` to run on for Mono/.NET 4.0.
68-
69-
```
70-
msbuild fsharp-compiler-build.proj
71-
```
72-
73-
74-
75-
##Building the F# core library for alternative CLI/.NET/CIL implementations with msbuild/build
76-
77-
```
78-
msbuild fsharp-library-build.proj /p:TargetFramework=net20
79-
msbuild fsharp-library-build.proj /p:TargetFramework=mono21
80-
msbuild fsharp-library-build.proj /p:TargetFramework=sl3-wp
81-
msbuild fsharp-library-build.proj /p:TargetFramework=sl5
82-
```
83-
84-
```
85-
msbuild fsharp-library-build.proj /p:TargetFramework=net20 /p:Configuration=Release
86-
msbuild fsharp-library-build.proj /p:TargetFramework=mono21 /p:Configuration=Release
87-
msbuild fsharp-library-build.proj /p:TargetFramework=sl3-wp /p:Configuration=Release
88-
msbuild fsharp-library-build.proj /p:TargetFramework=sl5 /p:Configuration=Release
89-
```
90-
91-
Here **net20** gives a runtime for .NET 2.0-3.5, **mono21** fives a runtime for MonoAnrdoid and MonoTouch,
92-
**sl3-wp** gives a runtime for Windows Phone 7, and **sl5** gives a runtime for Silverlight 5.
93-
94-
To build these libraries you may need the corresponding tools installed (e.g. MonoAndroid or the Silverlight tools)
95-
96-
97-
##Some alternative Steps - Building an optimized (Release) compiler and libraries
98-
99-
```
100-
msbuild fsharp-library-build.proj /p:Configuration=Release
101-
msbuild fsharp-compiler-build.proj /p:Configuration=Release
102-
msbuild fsharp-library-build.proj /p:TargetFramework=net20 /p:Configuration=Release
103-
msbuild fsharp-library-build.proj /p:TargetFramework=sl3-wp /p:Configuration=Release
104-
msbuild fsharp-library-build.proj /p:TargetFramework=sl5 /p:Configuration=Release
105-
```
106-
107-
##Steps - Building F# Core Unit Tests for .NET 4.x (optional)
108-
109-
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`.
110-
111-
```
112-
msbuild fsharp-library-unittests-build.proj /p:TargetFramework=net40
113-
```
114-
115-
*Note: You must have NUnit installed.*
116-
117-
118-
##Steps - Running Compiler tests (on Windows)
119-
120-
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:
121-
122-
```
123-
cd ..\tests\fsharp\core
124-
..\..\build-and-run-all-installed-ilx-configs.bat results.log
125-
```
126-
127-
The results file will contain one entry for each test directory, plus any reported errors.
128-
129-
```
130-
tests\fsharp\core
131-
tests\fsharp\core\queriesCustomQueryOps
132-
tests\fsharp\core\queriesLeafExpressionConvert
133-
tests\fsharp\core\queriesNullableOperators
134-
tests\fsharp\core\queriesOverIEnumerable
135-
...
136-
```
137-
138-
Some tests for LINQ queries require SQL Server be installed. A failing test will look like this:
139-
140-
```
141-
ERRORLEVEL=1: in tests\fsharp\core\csfromfs\build.bat
142-
```
143-
144-
You can then go to the relevant directory and run `build.bat` and `run.bat`.
145-
146-
147-
##Using the FSharp.Core you built
148-
149-
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.
150-
151-
```
152-
sn -Vr FSharp.Core,*
153-
gacutil /i Debug\net40\bin\FSharp.Core.dll
154-
```
155-
156-
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.
157-
158-
159-
160-
##Preparing for inclusion in Mono
161-
162-
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).
163-
164-
```
165-
sn -R ..\Debug\mono40\bin\fsc.exe mono.snk
166-
sn -R ..\Debug\mono40\bin\fsi.exe mono.snk
167-
sn -R ..\Debug\mono40\bin\FSharp.Core.dll mono.snk
168-
sn -R ..\Debug\mono40\bin\FSharp.Compiler.dll mono.snk
169-
sn -R ..\Debug\mono40\bin\FSharp.Compiler.Server.Shared.dll mono.snk
170-
sn -R ..\Debug\mono40\bin\FSharp.Compiler.Interactive.Settings.dll mono.snk
171-
```
172-
173-
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.
174-
175-
176-
##Notes on the build
177-
178-
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:
179-
180-
* 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.
181-
* 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.
182-
* 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**.
183-
* 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.
184-
185-
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.
186-
187-
188-
##Validation and Use
189-
190-
Here are some simple tests to validate what you have built by checking `fsi.exe` (F# Interactive) starts up:
191-
192-
```
193-
ngen install ..\Debug\net40\bin\fsi.exe
194-
..\Debug\net40\bin\fsi.exe
195-
1 + 1;;
196-
\#q;;
197-
..\Debug\net40\bin\fsi.exe /help
198-
..\Debug\net40\bin\fsc.exe /help
199-
echo printfn "hello world" > hello.fs
200-
..\Debug\net40\bin\fsc.exe hello.fs
201-
copy ..\Debug\net40\bin\FSharp.Core.dll .
202-
hello.exe
203-
del /q FSharp.Core.dll
204-
```
205-
206-
207-
##Editing and Building on Windows using Visual Studio 2012
208-
###Prerequisites
209-
210-
Visual Studio Shell 2012 (with F# CTP MSI added), Visual Studio Professional 2012 or another non-Express version of Visual Studio 2012.
211-
212-
###Editing and Building
213-
214-
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.
11+
**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 Visual 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.

README.md

+118-10
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ The `master` branch is for the latest version of F# (currently F# 3.0).
44

55
To bootstrap the compiler, binaries built from an earlier version of this project are used.
66

7-
87
## Requirements
98

109
Requires mono 2.9 or higher. Prefer Mono 3.0.
@@ -17,38 +16,77 @@ brew install automake
1716

1817
## Building
1918

20-
To build and install on non-MacOS Unix systems:
19+
### On Linux and other Unix systems:
20+
The usual:
2121
```
2222
./autogen.sh
2323
make
2424
sudo make install
2525
```
2626

27-
On MacOS (OSX), use a prefix to your version of Mono:
27+
### On MacOS (OSX)
28+
29+
Use a prefix to your version of Mono:
2830
```
2931
./autogen.sh --prefix=/Library/Frameworks/Mono.framework/Versions/Current/
3032
make
3133
sudo make install
3234
```
3335

34-
On Windows, build using msbuild (if .NET is installed) or xbuild (if only Mono 3.0.1 is installed):
36+
### On Windows, using msbuild (e.g.. if .NET is installed)
37+
```
38+
cd src
39+
msbuild fsharp-proto-build.proj
40+
msbuild fsharp-library-build.proj
41+
msbuild fsharp-compiler-build.proj
42+
```
43+
You can also build the FSharp.Core for .NET 2.0, Mono 2.1 and Silverlight 5.0 profiles:
44+
```
45+
msbuild fsharp-library-build.proj /p:TargetFramework=net20
46+
msbuild fsharp-library-build.proj /p:TargetFramework=mono21
47+
msbuild fsharp-library-build.proj /p:TargetFramework=sl5
48+
```
49+
50+
You can also build the FSharp.Core and FSharp.Compiler.Silverlight.dll for Silverlight 5.0:
51+
```
52+
msbuild fsharp-library-build.proj /p:TargetFramework=sl5-compiler
53+
msbuild fsharp-compiler-build.proj /p:TargetFramework=sl5-compiler
54+
```
55+
And for Release versions of the same:
56+
```
57+
msbuild fsharp-library-build.proj /p:Configuration=Release
58+
msbuild fsharp-compiler-build.proj /p:Configuration=Release
59+
msbuild fsharp-library-build.proj /p:TargetFramework=net20 /p:Configuration=Release
60+
msbuild fsharp-library-build.proj /p:TargetFramework=mono21 /p:Configuration=Release
61+
msbuild fsharp-library-build.proj /p:TargetFramework=sl5 /p:Configuration=Release
62+
msbuild fsharp-library-build.proj /p:TargetFramework=sl5-compiler /p:Configuration=Release
63+
msbuild fsharp-compiler-build.proj /p:TargetFramework=sl5-compiler /p:Configuration=Release
64+
```
65+
### On Windows, using xbuild (e.g. if no .NET is installed and only Mono 3.0 is installed):
66+
3567
```
3668
cd src
3769
xbuild fsharp-proto-build.proj
3870
xbuild fsharp-library-build.proj
3971
xbuild fsharp-compiler-build.proj
4072
```
73+
4174
Building using xbuild does not yet lay down a Mono-ready distribution (see src/fsharp/targets.make), so should only
42-
be used for private development rather than preparing distributions. The FSharp.Core.dll produced will be delay-signed,
43-
if a strong-name signed FSharp.Core.dll is needed then use the one in
75+
be used for private development rather than preparing distributions.
76+
77+
78+
## Strong Names
79+
80+
The FSharp.Core.dll produced is only delay-signed (Mono does not require strong names).
81+
If a strong-name signed FSharp.Core.dll is needed then use the one in
4482
```
4583
lib\bootstrap\signed\3.0\v4.0\FSharp.Core.dll
4684
```
4785

4886

49-
## What you get
87+
## What you get
5088

51-
On 'make' the main compiler binaries produced go in
89+
Once built the main compiler binaries go in
5290
lib/release/4.0
5391

5492
There are versions of FSharp.Core for .NET 2.0 and MonoAndroid (Mono profile 2.1) in
@@ -81,15 +119,85 @@ plus scripts
81119
/usr/bin/fsharpc (F# compiler)
82120
/usr/bin/fsharpi (F# Interactive)
83121

84-
85122
## Development notes
86123

124+
###Continuous Integration Build
125+
87126
We have a CI build set up with the JetBrains/Teamcity server as part of the F# community projects there:
88127

89128
http://teamcity.codebetter.com/project.html?projectId=project61&tab=projectOverview
90129

91130
@forki controls access. Right now this builds both a Mono 'make' install and a Windows 'cd src; msbuild fsharp-build.proj' build. No binaries are saved from the build, it is just for sanity checking.
92131

93-
Uses bootstrapping libraries, tools and F# compiler. The `lib/bootstrap/X.0` directories contain mono-built libraries, compiler and tools that can be used to bootstrap a build. You can also supply your own via the `--with-bootstrap` option.
132+
133+
###Editing the Compiler with Visual Studio or MonoDevelop
134+
135+
Open `all-vs2012.sln`, and edit in modes Debug or Release. The compiler takes a good while to compile and that
136+
can be a bit invasive to the work flow, so it's normally better to do the actual compilation from
137+
the command line, see above.
138+
139+
The F# support in MonoDevelop uses an in-process background compiler. On the Mac this causes pausing garbage
140+
collections to kick in which makes editing the compiler in MonoDevelop awkward.
141+
142+
### Building F# Core Unit Tests for .NET 4.x (optional)
143+
144+
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`.
145+
146+
```
147+
msbuild fsharp-library-unittests-build.proj /p:TargetFramework=net40
148+
```
149+
150+
*Note: You must have NUnit installed to build the unit tests.*
151+
152+
153+
154+
### Validation and Use
155+
156+
Here are some simple tests to validate what you have built by checking `fsi.exe` (F# Interactive) starts up:
157+
158+
```
159+
lib\debug\4.0\fsi.exe
160+
1 + 1;;
161+
\#q;;
162+
lib\debug\4.0\fsi.exe /help
163+
lib\debug\4.0\fsc.exe /help
164+
echo printfn "hello world" > hello.fs
165+
lib\debug\4.0\fsc.exe hello.fs
166+
hello.exe
167+
```
168+
169+
### Running Compiler tests (on Windows)
170+
171+
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:
172+
173+
```
174+
cd ..\tests\fsharp\core
175+
..\..\build-and-run-all-installed-ilx-configs.bat results.log
176+
```
177+
178+
The results file will contain one entry for each test directory, plus any reported errors.
179+
180+
```
181+
tests\fsharp\core
182+
tests\fsharp\core\queriesCustomQueryOps
183+
tests\fsharp\core\queriesLeafExpressionConvert
184+
tests\fsharp\core\queriesNullableOperators
185+
tests\fsharp\core\queriesOverIEnumerable
186+
...
187+
```
188+
189+
Some tests for LINQ queries require SQL Server be installed. A failing test will look like this:
190+
191+
```
192+
ERRORLEVEL=1: in tests\fsharp\core\csfromfs\build.bat
193+
```
194+
195+
You can then go to the relevant directory and run `build.bat` and `run.bat`.
196+
197+
198+
## History
94199

95200
F# compiler sources dropped by Microsoft are available from [fsharppowerpack.codeplex.com](http://fsharppowerpack.codeplex.com).
201+
202+
Uses bootstrapping libraries, tools and F# compiler. The `lib/bootstrap/X.0` directories contain mono-built libraries, compiler and tools that can be used to bootstrap a build. You can also supply your own via the `--with-bootstrap` option.
203+

0 commit comments

Comments
 (0)