未验证 提交 3d0ae5ed 编写于 作者: D Don Syme 提交者: GitHub

[WIP] simplify mono build (#4358)

* simplify mono build

* remove dead files

* remove build.sh in favour of make

* remove build.sh in favour of make (doc)

* remove build.sh in favour of make (doc)

* simplify netci.groovy

* cleanup
上级 2180de45
......@@ -21,11 +21,8 @@
*.rtf diff=astextplain
*.RTF diff=astextplain
autogen.sh text eol=lf
launcher.in text eol=lf
config.make.in text eol=lf
mono/launcher text eol=lf
mono/config.make text eol=lf
targets.make text eol=lf
configure.ac text eol=lf
Makefile.in text eol=lf
*.bsl linguist-vendored=true
......@@ -87,10 +87,7 @@ Proto
sign_temp
.libs
configure
launcher
autom4te.cache
config.log
mono/config.make
config.status
*~
*.suo
......
......@@ -70,28 +70,47 @@ then building the solution will be enough.
For Linux/Mono, follow [these instructions](http://www.mono-project.com/docs/getting-started/install/linux/). Also you may need:
sudo apt-get install mono-complete autoconf libtool pkg-config make git automake
sudo apt-get install mono-complete make git
Then:
./autoconf.sh --prefix /usr
make
make install
Full testing is not yet enabled on Linux, nor is a .NET Core build of the compiler.
Then to replace your machine-wide installation:
You can alternatively use
sudo make install
./build.sh
Full testing is not yet enabled on Linux, nor is a .NET Core build of the compiler.
### Developing the F# Compiler (macOS)
Install Xamarin Studio, then
Install XCode command line tools (or homebrew equivalents) and Mono or Visual Studio for Mac.
Then:
./autogen.sh --prefix=/Library/Frameworks/Mono.framework/Versions/Current/
make
Then to replace your machine-wide installation:
sudo make install
### Developing the F# Compiler (Linux or macOS and .NET Core)
Install [the latest .NET SDK](https://www.microsoft.com/net/download/). Then use
src/buildfromsource.sh
Outputs are placed in
BuildFromSource/Debug/...
BuildFromSource/Release/...
This uses an installed .NET SDK 2.0 to build the various duplicated project
Testing the .NET Core version of the F# compiler on mwcOS and Linux is TBD.
### Developing the Visual F# IDE Tools (Windows Only)
To build and test Visual F# IDE Tools, install these requirements:
......
......@@ -39,10 +39,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{B8DDA694
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{3058BC79-8E79-4645-B05D-48CC182FA8A6}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "HostedCompilerServer", "tests\fsharpqa\testenv\src\HostedCompilerServer\HostedCompilerServer.fsproj", "{4239EFEA-E746-446A-BF7A-51FCBAB13946}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "ILComparer", "tests\fsharpqa\testenv\src\ILComparer\ILComparer.fsproj", "{2E60864A-E3FF-4BCC-810F-DC7C34E6B236}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -185,26 +181,6 @@ Global
{88E2D422-6852-46E3-A740-83E391DC7973}.Release|Any CPU.Build.0 = Release|Any CPU
{88E2D422-6852-46E3-A740-83E391DC7973}.Release|x86.ActiveCfg = Release|Any CPU
{88E2D422-6852-46E3-A740-83E391DC7973}.Release|x86.Build.0 = Release|Any CPU
{4239EFEA-E746-446A-BF7A-51FCBAB13946}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4239EFEA-E746-446A-BF7A-51FCBAB13946}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4239EFEA-E746-446A-BF7A-51FCBAB13946}.Debug|x86.ActiveCfg = Debug|Any CPU
{4239EFEA-E746-446A-BF7A-51FCBAB13946}.Debug|x86.Build.0 = Debug|Any CPU
{4239EFEA-E746-446A-BF7A-51FCBAB13946}.Proto|Any CPU.ActiveCfg = Release|Any CPU
{4239EFEA-E746-446A-BF7A-51FCBAB13946}.Proto|x86.ActiveCfg = Release|Any CPU
{4239EFEA-E746-446A-BF7A-51FCBAB13946}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4239EFEA-E746-446A-BF7A-51FCBAB13946}.Release|Any CPU.Build.0 = Release|Any CPU
{4239EFEA-E746-446A-BF7A-51FCBAB13946}.Release|x86.ActiveCfg = Release|Any CPU
{4239EFEA-E746-446A-BF7A-51FCBAB13946}.Release|x86.Build.0 = Release|Any CPU
{2E60864A-E3FF-4BCC-810F-DC7C34E6B236}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2E60864A-E3FF-4BCC-810F-DC7C34E6B236}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2E60864A-E3FF-4BCC-810F-DC7C34E6B236}.Debug|x86.ActiveCfg = Debug|Any CPU
{2E60864A-E3FF-4BCC-810F-DC7C34E6B236}.Debug|x86.Build.0 = Debug|Any CPU
{2E60864A-E3FF-4BCC-810F-DC7C34E6B236}.Proto|Any CPU.ActiveCfg = Release|Any CPU
{2E60864A-E3FF-4BCC-810F-DC7C34E6B236}.Proto|x86.ActiveCfg = Release|Any CPU
{2E60864A-E3FF-4BCC-810F-DC7C34E6B236}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2E60864A-E3FF-4BCC-810F-DC7C34E6B236}.Release|Any CPU.Build.0 = Release|Any CPU
{2E60864A-E3FF-4BCC-810F-DC7C34E6B236}.Release|x86.ActiveCfg = Release|Any CPU
{2E60864A-E3FF-4BCC-810F-DC7C34E6B236}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......@@ -221,7 +197,5 @@ Global
{C163E892-5BF7-4B59-AA99-B0E8079C67C4} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449}
{A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449}
{88E2D422-6852-46E3-A740-83E391DC7973} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449}
{4239EFEA-E746-446A-BF7A-51FCBAB13946} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449}
{2E60864A-E3FF-4BCC-810F-DC7C34E6B236} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449}
EndGlobalSection
EndGlobal
include $(topsrcdir)mono/config.make
.PHONY: restore build
.PHONY: restore build build-proto
restore:
MONO_ENV_OPTIONS=$(monoopts) mono .nuget/NuGet.exe restore packages.config -PackagesDirectory packages -ConfigFile .nuget/NuGet.Config
chmod u+x packages/FSharp.Compiler.Tools.4.1.27/tools/fsi.exe
chmod u+x packages/FsLexYacc.7.0.6/build/fslex.exe
chmod u+x packages/FsLexYacc.7.0.6/build/fsyacc.exe
# Make the proto using the bootstrap, then make the final compiler using the proto
# We call MAKE sequentially because we don't want build-final to explicitly depend on build-proto,
# as that causes a complete recompilation of both proto and final everytime you touch the
# compiler sources.
all:
@echo -----------
@echo prefix=$(prefix)
@echo topdir=$(topdir)
@echo monodir=$(monodir)
@echo monolibdir=$(monolibdir)
@echo monobindir=$(monobindir)
@echo -----------
$(MAKE) restore
$(MAKE) build-proto
$(MAKE) build
build-proto: restore
build-proto:
MONO_ENV_OPTIONS=$(monoopts) $(MSBUILD) /p:Configuration=Proto /p:TargetDotnetProfile=$(TargetDotnetProfile) src/fsharp/FSharp.Build-proto/FSharp.Build-proto.fsproj
MONO_ENV_OPTIONS=$(monoopts) $(MSBUILD) /p:Configuration=Proto /p:TargetDotnetProfile=$(TargetDotnetProfile) src/fsharp/Fsc-proto/Fsc-proto.fsproj
......
#!/usr/bin/env sh
which autoreconf > /dev/null || (echo "Please install autoconf" && exit 1)
autoreconf && ./configure $@
#!/bin/sh
# OS detection
OSName=$(uname -s)
case $OSName in
Darwin)
OS=OSX
;;
Linux)
OS=Linux
;;
*)
echo "Unsupported OS '$OSName' detected. Cannot continue with build, the scripts must be updated to support this OS."
exit 1
;;
esac
# On Linux (or at least, Ubuntu), when building with Mono, need to install the mono-devel package first.
if [ $OS = 'Linux' ]; then
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
sudo apt-get update
sudo apt-get -y install mono-devel autoconf libtool pkg-config make git
fi
# Check if SSL certificates have been imported into Mono's certificate store.
# If certs haven't been installed, some/all of the Nuget packages will fail to restore.
# Note, the result of the certmgr and grep commands returns the number of installed X.509 certificates.
# We need to run the command twice -- on some systems (e.g. macOS) the certs are installed in the user store,
# and on other systems (e.g., Ubuntu) they're installed to the machine store. certmgr only shows what's in
# the selected store, which is why we need to check both.
if [ $OS = 'Linux' ] && [ "$(certmgr -list -c Trust | grep -c -F "X.509")" -le 1 ] && [ "$(certmgr -list -c -m Trust | grep -c -F "X.509")" -le 1 ]; then
echo "No SSL certificates installed so unable to restore NuGet packages." >&2;
echo "Run 'mozroots --sync --import' to install certificates to Mono's certificate store." >&2;
exit 1
fi
# Restore NuGet packages (needed for compiler bootstrap and tests).
mono .nuget/NuGet.exe restore packages.config -PackagesDirectory packages -ConfigFile .nuget/NuGet.Config
(if test x-$BUILD_CORECLR = x-1; then \
sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list'; \
sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893; \
sudo apt-get update; \
sudo apt-get -y install dotnet-dev-1.0.0-preview2-003131; \
(cd tests/fsharp; mono ../../.nuget/NuGet.exe restore project.json -PackagesDirectory ../../packages -ConfigFile ../../.nuget/NuGet.Config); \
./init-tools.sh; \
echo "------ start log"; \
cat ./init-tools.log; echo "------ end log"; \
fi)
(if test x-$BUILD_PROTO_WITH_CORECLR_LKG = x-1; then \
(cd lkg/fsc && dotnet restore --packages ../packages && dotnet publish project.json -o ../Tools/lkg -r ubuntu.14.04-x64); \
(cd lkg/fsi && dotnet restore --packages ../packages && dotnet publish project.json -o ../Tools/lkg -r ubuntu.14.04-x64); \
fi)
#TODO: work out how to avoid the need for this
chmod u+x packages/FSharp.Compiler.Tools.4.1.27/tools/fsi.exe
chmod u+x packages/FsLexYacc.7.0.6/build/fslex.exe
chmod u+x packages/FsLexYacc.7.0.6/build/fsyacc.exe
# The FSharp.Compiler.Tools package doesn't work correctly unless a proper install of F# has been done on the machine.
# OSX can skip this because the OSX Mono installer includes F#.
if [ $OS != 'OSX' ]; then
sudo apt-get -y install fsharp
fi
# "access to the path /etc/mono/registry/last-time is denied"
# On non-OSX systems, may need to create Mono's registry folder to avoid exceptions during builds.
# This doesn't seem to be necessary on OSX, as the folder is created by the installer.
if [ $OS != 'OSX' ]; then
# This registry folder path is correct for Linux;
# on OSX the folder is /Library/Frameworks/Mono.framework/Versions/Current/etc/mono/registry
# and may be different for *BSD systems.
__MonoRegistryDir="/etc/mono/registry"
if [ ! -d "$__MonoRegistryDir" ]; then
echo "Mono registry directory does not exist (it may not have been created yet)."
echo "The directory needs to be created now; superuser permissions are required for this."
{ sudo -- sh -c "mkdir -p $__MonoRegistryDir && chmod uog+rw $__MonoRegistryDir"; } || { echo "Unable to create/chmod Mono registry directory '$__MonoRegistryDir'." >&2; }
fi
fi
#!/bin/sh
# Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
# Helper function to print an error message and exit with a non-zero error code.
failwith () {
printf "Error: %s\n" "$1" >&2
exit 1
}
# Prints command text to stdout then runs (via eval) the command.
printeval () {
printf "%s\n" "$1" >&1
eval "$1"
}
# Prints build status to stdout.
build_status () {
printf "%s %s %s\n" "----------------" "$1" "-----------------" >&1
}
# Text for the usage message.
usage_text="
Build and run a subset of test suites
Usage:
build.sh ^<all^|net40^|coreclr^>
^<proto^|protofx^>
^<debug^|release^>
^<diag^|publicsign^>
^<test^|no-test^|test-net40-coreunit^|test-coreclr-coreunit^|test-compiler-unit^|test-net40-fsharp^|test-coreclr-fsharp^>
^<include tag^>
^<init^>
No arguments default to 'default', meaning this (no testing)
build.sh net40
Other examples:
build.sh net40 (build compiler for .NET Framework)
build.sh coreclr (build compiler for .NET Core)
build.sh all (build everything)
build.sh test (build and test default targets)
build.sh net40 test (build and test net40)
build.sh coreclr test (build and test net40)
build.sh all test (build and test net40)
"
# Prints usage text to stdout then exits with a non-zero exit code.
show_usage_and_exit() {
printf "%s\n" "$usage_text"
exit 1
}
# Check if caller specified any typical argument used to get usage/help info.
if [ "$1" = "--help" ] || [ "$1" = "-h" ] || [ "$1" = "-?" ]; then
show_usage_and_exit
fi
# Save directory of the current script -- this is used below to fix up relative paths (if needed).
# The directory should have a trailing slash like it does on Windows, to minimize differences between scripts.
_scriptdir="$( cd -P -- "$(dirname -- "$(command -v -- "$0")")" && pwd -P )/"
# disable setup build by setting FSC_BUILD_SETUP=0
if [ -z "$FSC_BUILD_SETUP" ]; then
export FSC_BUILD_SETUP=0
fi
# by default don't build coreclr lkg.
# However allow configuration by setting (more specifically, exporting) an environment variable: export BUILD_PROTO_WITH_CORECLR_LKG = 1
if [ -z "$BUILD_PROTO_WITH_CORECLR_LKG" ]; then
export BUILD_PROTO_WITH_CORECLR_LKG=0
fi
export BUILD_PROTO=0
export BUILD_PHASE=1
export BUILD_NET40_FSHARP_CORE=0
export BUILD_NET40=0
export BUILD_CORECLR=0
export BUILD_CONFIG=release
export BUILD_CONFIG_LOWERCASE=release
export BUILD_DIAG=
export BUILD_PUBLICSIGN=0
export TEST_NET40_COMPILERUNIT_SUITE=0
export TEST_NET40_COREUNIT_SUITE=0
export TEST_NET40_FSHARP_SUITE=0
export TEST_CORECLR_COREUNIT_SUITE=0
export TEST_CORECLR_FSHARP_SUITE=0
export INCLUDE_TEST_SPEC_NUNIT=
export INCLUDE_TEST_TAGS=
# Set up variables used to determine whether we'll automatically select which
# targets to build/run/test. NOTE: These aren't exported, they're only used by this script.
no_test=0
_autoselect=1
_autoselect_tests=0
# Parse script arguments (specifying which targets to build/run/test),
# and export the corresponding environment variables to configure the build.
for arg in "$@"
do
case $arg in
"net40")
_autoselect=0
export BUILD_NET40=1
export BUILD_NET40_FSHARP_CORE=1
;;
"coreclr")
_autoselect=0
export BUILD_PROTO_WITH_CORECLR_LKG=1
export BUILD_CORECLR=1
;;
"nobuild")
export BUILD_PHASE=0
;;
"none")
_autoselect=0
export _buildexit=1
export _buildexitVALUE=0
;;
"all")
_autoselect=0
export BUILD_PROTO=1
export BUILD_PROTO_WITH_CORECLR_LKG=1
export BUILD_NET40=1
export BUILD_NET40_FSHARP_CORE=1
export BUILD_CORECLR=1
export BUILD_VS=1
export BUILD_SETUP=$FSC_BUILD_SETUP
export CI=1
;;
"proto")
export BUILD_PROTO=1
;;
"diag")
export BUILD_DIAG=/v:detailed
if [ -z "$APPVEYOR" ]; then
export BUILD_LOG=fsharp_build_log.log
fi
;;
"debug")
export BUILD_CONFIG=debug
;;
"release")
export BUILD_CONFIG=release
;;
"test")
_autoselect_tests=1
;;
"no-test")
no_test=1
;;
"test-all")
_autoselect=0
export BUILD_PROTO=1
export BUILD_PROTO_WITH_CORECLR_LKG=1
export BUILD_NET40=1
export BUILD_NET40_FSHARP_CORE=1
export BUILD_CORECLR=1
export BUILD_SETUP=$FSC_BUILD_SETUP
export TEST_NET40_COMPILERUNIT_SUITE=1
export TEST_NET40_COREUNIT_SUITE=1
export TEST_NET40_FSHARP_SUITE=1
export TEST_CORECLR_COREUNIT_SUITE=1
;;
"test-compiler-unit")
export BUILD_NET40=1
export BUILD_NET40_FSHARP_CORE=1
export TEST_NET40_COMPILERUNIT_SUITE=1
;;
"test-net40-coreunit")
export BUILD_NET40_FSHARP_CORE=1
export TEST_NET40_COREUNIT_SUITE=1
;;
"test-coreclr-coreunit")
export BUILD_PROTO_WITH_CORECLR_LKG=1
export BUILD_CORECLR=1
export TEST_CORECLR_COREUNIT_SUITE=1
;;
"test-net40-fsharp")
export BUILD_NET40=1
export BUILD_NET40_FSHARP_CORE=1
export TEST_NET40_FSHARP_SUITE=1
;;
"test-coreclr-fsharp")
export BUILD_NET40=1
export BUILD_NET40_FSHARP_CORE=1
export BUILD_PROTO_WITH_CORECLR_LKG=1
export BUILD_CORECLR=1
export TEST_CORECLR_FSHARP_SUITE=1
;;
"publicsign")
export BUILD_PUBLICSIGN=1
;;
"init")
export BUILD_PROTO_WITH_CORECLR_LKG=1
;;
*)
errmsg=$(printf "Invalid argument: %s" "$arg")
failwith "$errmsg"
;;
esac
done
if [ "$_buildexit" = "1" ]; then
exit $_buildexitvalue
fi
# Apply defaults, if necessary.
if [ "$_autoselect" = "1" ]; then
export BUILD_NET40=1
export BUILD_NET40_FSHARP_CORE=1
fi
if [ "$_autoselect_tests" = "1" ]; then
if [ "$BUILD_NET40" = "1" ]; then
export TEST_NET40_COMPILERUNIT_SUITE=1
# This requires a build of FSharp.Core.dll?
# export TEST_NET40_COREUNIT_SUITE=1
# This requires a lot more work to get running on OSX/Linux
# export TEST_NET40_FSHARP_SUITE=1
fi
if [ "$BUILD_CORECLR" = "1" ]; then
export BUILD_NET40=1
export BUILD_NET40_FSHARP_CORE=1
export TEST_CORECLR_FSHARP_SUITE=1
export TEST_CORECLR_COREUNIT_SUITE=1
fi
fi
# If the `PB_SKIPTESTS` variable is set to 'true' then no tests should be built or run, even if explicitly specified
if [ "$PB_SKIPTESTS" = "true" ]; then
export TEST_NET40_COMPILERUNIT_SUITE=0
export TEST_NET40_COREUNIT_SUITE=0
export TEST_NET40_FSHARP_SUITE=0
export TEST_CORECLR_COREUNIT_SUITE=0
export TEST_CORECLR_FSHARP_SUITE=0
fi
#
# Report config
#
printf "Build/Tests configuration:\n"
printf "\n"
printf "BUILD_PROTO=%s\n" "$BUILD_PROTO"
printf "BUILD_PROTO_WITH_CORECLR_LKG=%s\n" "$BUILD_PROTO_WITH_CORECLR_LKG"
printf "BUILD_NET40=%s\n" "$BUILD_NET40"
printf "BUILD_NET40_FSHARP_CORE=%s\n" "$BUILD_NET40_FSHARP_CORE"
printf "BUILD_CORECLR=%s\n" "$BUILD_CORECLR"
printf "BUILD_SETUP=%s\n" "$BUILD_SETUP"
printf "BUILD_CONFIG=%s\n" "$BUILD_CONFIG"
printf "BUILD_PUBLICSIGN=%s\n" "$BUILD_PUBLICSIGN"
printf "\n"
printf "PB_SKIPTESTS=%s\n" "$PB_SKIPTESTS"
printf "PB_RESTORESOURCE=%s\n" "$PB_RESTORESOURCE"
printf "\n"
printf "TEST_NET40_COMPILERUNIT_SUITE=%s\n" "$TEST_NET40_COMPILERUNIT_SUITE"
printf "TEST_NET40_COREUNIT_SUITE=%s\n" "$TEST_NET40_COREUNIT_SUITE"
printf "TEST_NET40_FSHARP_SUITE=%s\n" "$TEST_NET40_FSHARP_SUITE"
printf "TEST_CORECLR_COREUNIT_SUITE=%s\n" "$TEST_CORECLR_COREUNIT_SUITE"
printf "TEST_CORECLR_FSHARP_SUITE=%s\n" "$TEST_CORECLR_FSHARP_SUITE"
printf "INCLUDE_TEST_SPEC_NUNIT=%s\n" "$INCLUDE_TEST_SPEC_NUNIT"
printf "INCLUDE_TEST_TAGS=%s\n" "$INCLUDE_TEST_TAGS"
printf "\n"
build_status "Done with arguments, starting preparation"
_msbuildexe="msbuild"
msbuildflags=""
# Perform any necessary setup and system configuration prior to running builds.
./before_install.sh
rc=$?;
if [ "$rc" != "0" ]; then
printf "before_install script failed.\n"
exit $rc
fi
build_status "Done with prepare, starting package restore"
# Use built-in Nuget executable on Mono, if available.
_nugetexe="mono .nuget/NuGet.exe"
if command -v nuget > /dev/null; then
_nugetexe="nuget"
fi
_nugetconfig=".nuget/NuGet.Config"
# TODO: Confirm existence of 'nuget' (or $_nugetexe) before proceeding.
# Restore packages (default to restoring packages if otherwise unspecified).
if [ "${RestorePackages:-true}" = 'true' ]; then
cd fcs
mono .paket/paket.exe restore
cd ..
exit_code=$?
if [ $exit_code -ne 0 ]; then
exit $exit_code
fi
_nugetoptions="-PackagesDirectory packages -ConfigFile $_nugetconfig"
if [ "$PB_RESTORESOURCE" != "" ]; then
_nugetoptions="$_nugetoptions -FallbackSource $PB_RESTORESOURCE"
fi
eval "$_nugetexe restore packages.config $_nugetoptions"
if [ $? -ne 0 ]; then
failwith "Nuget restore failed"
fi
fi
# If building for CoreCLR, restore the Tools directory.
if [ "$BUILD_PROTO_WITH_CORECLR_LKG" = "1" ]; then
# Restore the Tools directory
./init-tools.sh
rc=$?;
if [ $rc -ne 0 ]; then
printf "init-tools script failed.\n"
exit $rc
fi
fi
# TODO: Check for existence of fsi (either on the system, or from the FSharp.Compiler.Tools package that was restored).
build_status "Done with package restore, starting dependency uptake check"
if [ "$PB_PACKAGEVERSIONPROPSURL" != "" ]; then
dependencyUptakeDir="${_scriptdir}Tools/dependencyUptake"
mkdir -p "$dependencyUptakeDir"
# download package version overrides
{ printeval "curl '$PB_PACKAGEVERSIONPROPSURL' -o '$dependencyUptakeDir/PackageVersions.props'"; } || failwith "downloading package version properties failed"
# prepare dependency uptake files
{ printeval "$_msbuildexe $msbuildflags ${scriptdir}build/projects/PrepareDependencyUptake.proj /t:Build"; } || failwith "building dependency uptake files failed"
# restore dependencies
{ printeval "$_nugetexe restore '$dependencyUptakeDir/packages.config' -PackagesDirectory packages -ConfigFile '$dependencyUptakeDir/NuGet.config'"; } || failwith "restoring dependency uptake packages failed"
fi
build_status "Done with package restore, starting proto"
# Decide if Proto need building
if [ ! -f "Proto/net40/bin/fsc-proto.exe" ]; then
export BUILD_PROTO=1
fi
_dotnetexe=dotnet
_architecture=win7-x64
# Build Proto
if [ "$BUILD_PROTO" = "1" ]; then
rm -rfd Proto
if [ "$BUILD_PROTO_WITH_CORECLR_LKG" = "1" ]; then
{ pushd ./lkg/fsc && eval "$_dotnetexe restore" && popd; } || failwith "dotnet restore failed"
{ pushd ./lkg/fsi && eval "$_dotnetexe restore" && popd; } || failwith "dotnet restore failed"
{ pushd ./lkg/fsc && eval "$_dotnetexe publish project.json --no-build -o ${_scriptdir}Tools/lkg -r $_architecture" && popd; } || failwith "dotnet publish failed"
{ pushd ./lkg/fsi && eval "$_dotnetexe publish project.json --no-build -o ${_scriptdir}Tools/lkg -r $_architecture" && popd; } || failwith "dotnet publish failed"
{ printeval "$_msbuildexe $msbuildflags src/fsharp-proto-build.proj /p:Configuration=Proto /p:DisableLocalization=true"; } || failwith "compiler proto build failed"
# { printeval "$_ngenexe install Proto/net40/bin/fsc-proto.exe /nologo"; } || failwith "NGen of proto failed"
else
# Build proto-compiler and libs
{ printeval "$_msbuildexe $msbuildflags src/fsharp-proto-build.proj /p:Configuration=Proto /p:DisableLocalization=true"; } || failwith "compiler proto build failed"
fi
fi
build_status "Done with proto, starting build"
if [ "$BUILD_PHASE" = "1" ]; then
cmd="$_msbuildexe $msbuildflags build-everything.proj /p:Configuration=$BUILD_CONFIG $BUILD_DIAG /p:BUILD_PUBLICSIGN=$BUILD_PUBLICSIGN"
{ printeval "$cmd"; } || failwith "'$cmd' failed"
fi
if [ "$TEST_NET40_COMPILERUNIT_SUITE" != "1" ] && [ "$TEST_CORECLR_COREUNIT_SUITE" != "1" ] && [ "$TEST_NET40_FSHARP_SUITE" != "1" ]; then
# Successful build; not running tests so exit now.
exit 0
fi
NUNITPATH="packages/NUnit.Console.3.0.0/tools/"
if [ "$no_test" = "1" ]; then
# Successful build; not running tests so exit now.
exit 0
fi
build_status "Done with update, starting tests"
if [ -n "$INCLUDE_TEST_SPEC_NUNIT" ]; then
export WHERE_ARG_NUNIT="--where $INCLUDE_TEST_SPEC_NUNIT"
fi
if [ -n "$INCLUDE_TEST_TAGS" ]; then
export TTAGS_ARG_RUNALL="-ttags:$INCLUDE_TEST_TAGS"
fi
printf "WHERE_ARG_NUNIT=%s\n" "$WHERE_ARG_NUNIT"
export NUNIT3_CONSOLE="${NUNITPATH}nunit3-console.exe"
export FSCBINPATH="${_scriptdir}$BUILD_CONFIG/net40/bin"
export RESULTSDIR="${_scriptdir}tests/TestResults"
if [ ! -d "$RESULTSDIR" ]; then
mkdir "$RESULTSDIR"
fi
printf "FSCBINPATH=%s\n" "$FSCBINPATH"
printf "RESULTSDIR=%s\n" "$RESULTSDIR"
printf "NUNIT3_CONSOLE=%s\n" "$NUNIT3_CONSOLE"
printf "NUNITPATH=%s\n" "$NUNITPATH"
# ---------------- net40-fsharp -----------------------
if [ "$TEST_NET40_FSHARP_SUITE" = "1" ]; then
OUTPUTARG=""
ERRORARG=""
OUTPUTFILE=""
ERRORFILE=""
XMLFILE="$RESULTSDIR/test-net40-fsharp-results.xml"
if [ "$CI" = "1" ]; then
OUTPUTFILE="$RESULTSDIR/test-net40-fsharp-output.log"
OUTPUTARG="--output:\"$OUTPUTFILE\""
ERRORFILE="$RESULTSDIR/test-net40-fsharp-errors.log"
ERRORARG="--err:\"$ERRORFILE\""
fi
if ! printeval "mono $NUNIT3_CONSOLE --verbose \"$FSCBINPATH/FSharp.Tests.FSharpSuite.dll\" --framework:V4.0 --work:\"$FSCBINPATH\" $OUTPUTARG $ERRORARG --result:\"$XMLFILE;format=nunit3\" $WHERE_ARG_NUNIT"; then
if [ -f "$ERRORFILE" ]; then
echo -----------------------------------------------------------------
cat "$ERRORFILE"
fi
echo -----------------------------------------------------------------
echo Error: Running tests net40-fsharp failed, see log above -- FAILED
echo -----------------------------------------------------------------
exit 1
fi
fi
# ---------------- net40-compilerunit -----------------------
if [ "$TEST_NET40_COMPILERUNIT_SUITE" = "1" ]; then
OUTPUTARG=""
ERRORARG=""
OUTPUTFILE=""
ERRORFILE="$RESULTSDIR/test-net40-compilerunit-errors.log"
XMLFILE="$RESULTSDIR/test-net40-compilerunit-results.xml"
if [ "$CI" = "1" ]; then
OUTPUTFILE="$RESULTSDIR/test-net40-compilerunit-output.log"
ERRORARG="--err:\"$ERRORFILE\""
OUTPUTARG="--output:\"$OUTPUTFILE\""
fi
if ! printeval "mono $NUNIT3_CONSOLE --verbose --framework:V4.0 --result:\"$XMLFILE;format=nunit3\" $OUTPUTARG $ERRORARG --work:\"$FSCBINPATH\" \"$FSCBINPATH/../../net40/bin/FSharp.Compiler.UnitTests.dll\" $WHERE_ARG_NUNIT"; then
if [ -f "$OUTPUTFILE" ]; then
echo -----------------------------------------------------------------
cat "$OUTPUTFILE"
fi
if [ -f "$ERRORFILE" ]; then
echo -----------------------------------------------------------------
cat "$ERRORFILE"
fi
echo -----------------------------------------------------------------
echo Error: Running tests net40-compilerunit failed, see logs above -- FAILED
echo -----------------------------------------------------------------
exit 1
fi
fi
# ---------------- net40-coreunit -----------------------
if [ "$TEST_NET40_COREUNIT_SUITE" = "1" ]; then
OUTPUTARG=""
ERRORARG=""
OUTPUTFILE=""
ERRORFILE=""
XMLFILE="$RESULTSDIR/test-net40-coreunit-results.xml"
if [ "$CI" = "1" ]; then
ERRORFILE="$RESULTSDIR/test-net40-coreunit-errors.log"
OUTPUTFILE="$RESULTSDIR/test-net40-coreunit-output.log"
ERRORARG="--err:\"$ERRORFILE\""
OUTPUTARG="--output:\"$OUTPUTFILE\""
fi
if ! printeval "mono $NUNIT3_CONSOLE --verbose --framework:V4.0 --result:\"$XMLFILE;format=nunit3\" $OUTPUTARG $ERRORARG --work:\"$FSCBINPATH\" \"$FSCBINPATH/FSharp.Core.UnitTests.dll\" $WHERE_ARG_NUNIT"; then
if [ -f "$OUTPUTFILE" ]; then
echo -----------------------------------------------------------------
cat "$OUTPUTFILE"
fi
if [ -f "$ERRORFILE" ]; then
echo -----------------------------------------------------------------
cat "$ERRORFILE"
fi
echo -----------------------------------------------------------------
echo Error: Running tests net40-coreunit failed, see logs above -- FAILED
echo -----------------------------------------------------------------
exit 1
fi
fi
# ---------------- coreclr-coreunit -----------------------
if [ "$TEST_CORECLR_COREUNIT_SUITE" = "1" ]; then
XMLFILE="$RESULTSDIR/test-coreclr-coreunit-results.xml"
OUTPUTFILE="$RESULTSDIR/test-coreclr-coreunit-output.log"
ERRORFILE="$RESULTSDIR/test-coreclr-coreunit-errors.log"
if ! printeval "$_dotnetexe \"${_scriptdir}tests/testbin/$BUILD_CONFIG/coreclr/FSharp.Core.UnitTests/FSharp.Core.UnitTests.dll\" $WHERE_ARG_NUNIT"; then
echo -----------------------------------------------------------------
echo Error: Running tests coreclr-coreunit failed, see logs above-- FAILED
echo -----------------------------------------------------------------
exit 1
fi
fi
# ---------------- coreclr-fsharp -----------------------
if [ "$TEST_CORECLR_FSHARP_SUITE" = "1" ]; then
export single_threaded=true
export permutations=FSC_CORECLR
OUTPUTARG=""
ERRORARG=""
OUTPUTFILE=""
ERRORFILE=""
XMLFILE="$RESULTSDIR/test-coreclr-fsharp-results.xml"
if ! printeval "$_dotnetexe \"${_scriptdir}tests/testbin/$BUILD_CONFIG/coreclr/FSharp.Tests.FSharpSuite.DrivingCoreCLR/FSharp.Tests.FSharpSuite.DrivingCoreCLR.dll\" $WHERE_ARG_NUNIT"; then
echo -----------------------------------------------------------------
echo Error: Running tests coreclr-fsharp failed, see logs above-- FAILED
echo -----------------------------------------------------------------
exit 1
fi
fi
make Configuration=release
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.61])
AC_INIT([fsharp], [4.0], [https://github.com/fsharp/fsharp/issues])
# Checks for programs.
AC_PROG_MAKE_SET
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
# pkg-config precedence: 1) our prefix 2) the system Mono location 3) the PATH
prefix_pkg_config="$prefix"/bin/pkg-config
osx_pkg_config=/Library/Frameworks/Mono.framework/Versions/Current/bin/pkg-config
if test -e $prefix_pkg_config; then
PKG_CONFIG=$prefix_pkg_config
elif test -e $osx_pkg_config; then
PKG_CONFIG=$osx_pkg_config
elif test "x$PKG_CONFIG" = "xno"; then
AC_MSG_ERROR([You need to install pkg-config])
fi
AC_MSG_NOTICE("pkg-config: $PKG_CONFIG")
AC_MSG_NOTICE("PKG_CONFIG_LIBDIR: $PKG_CONFIG_LIBDIR")
MONO_REQUIRED_VERSION=4.0
MONO_RECOMMENDED_VERSION=4.2
MONO_RECOMMENDED_REASON="as it is newer and already considered a stable version"
if ! $PKG_CONFIG --atleast-version=$MONO_REQUIRED_VERSION mono; then
AC_MSG_ERROR("You need mono $MONO_REQUIRED_VERSION")
fi
if ! $PKG_CONFIG --atleast-version=$MONO_RECOMMENDED_VERSION mono; then
AC_MSG_WARN([Mono $MONO_RECOMMENDED_VERSION or higher is recommended, $MONO_RECOMMENDED_REASON])
fi
AC_ARG_WITH([gacdir],
[ --with-gacdir=/path/to/gac Specify the gac directory (ex: /usr/lib/mono/gac)],
[],
[with_gacdir=no]
)
MONOPREFIX=$(cd `$PKG_CONFIG --variable=prefix mono` && pwd)
MONOBINDIR="$MONOPREFIX"/bin
MONOLIBDIR="$MONOPREFIX"/lib
AC_PATH_PROG(MSBUILD, msbuild, no)
msbuild_from_pkg_config="$MONOBINDIR"/msbuild
if test -e $msbuild_from_pkg_config; then
MSBUILD=$msbuild_from_pkg_config
elif test "x$MSBUILD" == "xno"; then
AC_MSG_ERROR([Could not find msbuild])
fi
AC_MSG_NOTICE(msbuild: $MSBUILD)
AC_SUBST(MONOBINDIR)
AC_SUBST(MONOLIBDIR)
AC_CONFIG_FILES([
mono/launcher
mono/config.make
])
AC_OUTPUT
CONFIGURE_FILE=autogen.sh
if ! test -e $CONFIGURE_FILE; then
CONFIGURE_FILE=configure
fi
CONFIGURE_COMMAND="`dirname $0`/$CONFIGURE_FILE"
if ! test "x$MONOPREFIX" = "x$prefix"; then
AC_WARN([Prefix to use is not the same as mono's: $prefix
Consider using: $CONFIGURE_COMMAND --prefix=$MONOPREFIX])
fi
F# Compiler README
=============================================================================================
> **NOTE:** This readme file is the original `README.md` document from the F# compiler
source code ([github.com/fsharp/fsharp](https://github.com/fsharp/fsharp)). This project is a fork of the F# compiler
source, with several minor changes that expose certain services. The readme is included
here for reference.
This is the F# compiler, core library and core tools (open source edition).
The `master` branch is for the latest version of F# (currently F# 3.0).
To bootstrap the compiler, binaries built from an earlier version of this project are used.
## Requirements
Requires mono 2.9 or higher. Prefer Mono 3.0.
On OSX, requires automake 2.69. To install from [homebrew](http://mxcl.github.com/homebrew):
[lang=text]
brew install automake
## Building
### On Linux and other Unix systems:
The usual:
[lang=text]
./autogen.sh
make
sudo make install
By default that makes optimized binaries. To make debug, use `make CONFIG=debug`
### On MacOS (OSX)
Use a prefix to your version of Mono:
[lang=text]
./autogen.sh --prefix=/Library/Frameworks/Mono.framework/Versions/Current/
make
sudo make install
By default that makes optimized binaries. To make debug, use `make CONFIG=debug`
### On Windows, using msbuild (e.g.. if .NET is installed)
If you have only VS2012 installed, and not VS2010, you'll need to install the F# 2.0 Runtime (http://www.microsoft.com/en-us/download/details.aspx?id=13450)
[lang=text]
cd src
msbuild fsharp-proto-build.proj
ngen install ..\lib\proto\4.0\fsc-proto.exe (optional)
msbuild fsharp-library-build.proj /p:Configuration=Release
msbuild fsharp-compiler-build.proj /p:Configuration=Release
You can also build the FSharp.Core for .NET 2.0, Mono 2.1, MonoTouch, Silverlight 5.0, Windows Phone 7.1, Portable Profile47 (net45+sl5+win8), Portable Profile88 (net4+sl4+wp71+win8) and XNA 4.0 for Xbox 360 profiles:
[lang=text]
msbuild fsharp-library-build.proj /p:TargetFramework=net20 /p:Configuration=Release
msbuild fsharp-library-build.proj /p:TargetFramework=mono21 /p:Configuration=Release
msbuild fsharp-library-build.proj /p:TargetFramework=monotouch /p:Configuration=Release
msbuild fsharp-library-build.proj /p:TargetFramework=portable-net45+sl5+win8 /p:Configuration=Release
msbuild fsharp-library-build.proj /p:TargetFramework=portable-net4+sl4+wp71+win8 /p:Configuration=Release
msbuild fsharp-library-build.proj /p:TargetFramework=sl5 /p:Configuration=Release
msbuild fsharp-library-build.proj /p:TargetFramework=wp7 /p:Configuration=Release
msbuild fsharp-library-build.proj /p:TargetFramework=net40-xna40-xbox360 /p:Configuration=Release
You can also build the FSharp.Core and FSharp.Compiler.Silverlight.dll for Silverlight 5.0:
[lang=text]
msbuild fsharp-library-build.proj /p:TargetFramework=sl5-compiler /p:Configuration=Release
msbuild fsharp-compiler-build.proj /p:TargetFramework=sl5-compiler /p:Configuration=Release
Change to ` /p:Configuration=Debug` for debug binaries.
### On Windows, using xbuild (e.g. if no .NET is installed and only Mono 3.0 is installed):
[lang=text]
cd src
xbuild fsharp-proto-build.proj
xbuild fsharp-library-build.proj
xbuild fsharp-compiler-build.proj
Building using xbuild does not yet lay down a Mono-ready distribution (see src/fsharp/targets.make), so should only
be used for private development rather than preparing distributions.
## Strong Names
The FSharp.Core.dll produced is only delay-signed (Mono does not require strong names).
If a strong-name signed FSharp.Core.dll is needed then use the one in
[lang=text]
lib\bootstrap\signed\3.0\v4.0\FSharp.Core.dll
## What you get
Once built the main compiler binaries go in
[lang=text]
lib/release/4.0
There are versions of FSharp.Core for .NET 2.0, MonoAndroid, MonoTouch (Mono profile 2.1) in
[lang=text]
lib/release/2.0
lib/release/2.1
lib/release/2.1monotouch
On `make install` the binaries etc. go in the prefix, e.g.
[lang=text]
/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/2.0/FSharp.Core.dll
/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/2.1/FSharp.Core.dll
/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.0/fsc.exe
/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.0/FSharp.Compiler.dll
...
/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5/fsc.exe
/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5/FSharp.Compiler.dll
...
/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/gac/.../FSharp.Compiler.dll
/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/gac/.../FSharp.Compiler.dll
...
plus some files for xbuild support
[lang=text]
/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/Microsoft\ F#/v4.0/*
/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/Microsoft\ SDKs/F#/3.0/Framework/*
(these names are the canonical names for Microsoft.FSharp.Targets used by project files coming from Visual Studio)
plus scripts
/usr/bin/fsharpc (F# compiler)
/usr/bin/fsharpi (F# Interactive)
## Development notes
###Continuous Integration Build
We have a CI build set up with the JetBrains/Teamcity server as part of the F# community projects there:
http://teamcity.codebetter.com/project.html?projectId=project61&tab=projectOverview
@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.
###Editing the Compiler with Visual Studio or MonoDevelop
Open `all-vs2012.sln`, and edit in modes Debug or Release. The compiler takes a good while 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.
The F# support in MonoDevelop uses an in-process background compiler. On the Mac this causes pausing garbage
collections to kick in which makes editing the compiler in MonoDevelop awkward.
### Building F# Core Unit Tests for .NET 4.x (optional)
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`.
[lang=text]
msbuild fsharp-library-unittests-build.proj /p:TargetFramework=net40
*Note: You must have NUnit installed to build the unit tests.*
### Validation and Use
Here are some simple tests to validate what you have built by checking `fsi.exe` (F# Interactive) starts up:
[lang=text]
lib\debug\4.0\fsi.exe
1 + 1;;
\#q;;
lib\debug\4.0\fsi.exe /help
lib\debug\4.0\fsc.exe /help
echo printfn "hello world" > hello.fs
lib\debug\4.0\fsc.exe hello.fs
hello.exe
### Running Compiler tests (on Windows)
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:
[lang=text]
cd ..\tests\fsharp\core
..\..\build-and-run-all-installed-ilx-configs.bat results.log
The results file will contain one entry for each test directory, plus any reported errors.
[lang=text]
tests\fsharp\core
tests\fsharp\core\queriesCustomQueryOps
tests\fsharp\core\queriesLeafExpressionConvert
tests\fsharp\core\queriesNullableOperators
tests\fsharp\core\queriesOverIEnumerable
...
Some tests for LINQ queries require SQL Server be installed. A failing test will look like this:
[lang=text]
ERRORLEVEL=1: in tests\fsharp\core\csfromfs\build.bat
You can then go to the relevant directory and run `build.bat` and `run.bat`.
## History
F# compiler sources dropped by Microsoft are available from [fsharppowerpack.codeplex.com](http://fsharppowerpack.codeplex.com).
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.
\ No newline at end of file
F# コンパイラのREADME
=============================================================================================
> **注意:** このreadmeファイルはF# コンパイラソースコード
([github.com/fsharp/fsharp](https://github.com/fsharp/fsharp))
に付属していたオリジナルのファイルのコピーです。
F# Compiler Servicesプロジェクトは元々F# Compilerプロジェクトから派生したもので、
いくつかのサービスを公開するために若干の変更が加えられています。
ここに含まれるreadmeファイルは参考程度にとどめてください。
このプロジェクトには(オープンソース版の)F# コンパイラ、コアライブラリ、コアツールが含まれます。
いずれもMITライセンスが適用されます。
`master` ブランチは最新バージョンのF#(現時点ではF# 3.0)に対応します。
なおコンパイラをブートストラップするために、
このプロジェクトの以前のバージョンでビルドされたバイナリが使用されます。
## 必須要件
Mono 2.9以上のバージョンが必要です。Mono 3.0が推奨されます。
OS Xの場合、automake 2.69が必要です。
[homebrew](http://brew.sh/) 経由でインストールする場合は
以下のようにします:
[lang=text]
brew install automake
## ビルド
### Linuxおよびその他のUnixシステムの場合
通常の手順は以下の通りです:
[lang=text]
./autogen.sh
make
sudo make install
デフォルトでは最適化されたバイナリが生成されます。
デバッグ版をビルドする場合は `make CONFIG=debug` とします。
### MacOS (OSX)の場合
Monoのバージョンを指定するprefixを設定します:
[lang=text]
./autogen.sh --prefix=/Library/Frameworks/Mono.framework/Versions/Current/
make
sudo make install
デフォルトでは最適化されたバイナリが生成されます。
デバッグ版をビルドする場合は `make CONFIG=debug` とします。
### Windows上でmsbuildを使用する(つまり.NETがインストールされている)場合
VS2010がインストールされておらず、VS2012しかインストールされていない場合には
[F# 2.0 ランタイム](http://www.microsoft.com/en-us/download/details.aspx?id=13450)
のインストールが必要です:
[lang=text]
cd src
msbuild fsharp-proto-build.proj
ngen install ..\lib\proto\4.0\fsc-proto.exe (optional)
msbuild fsharp-library-build.proj /p:Configuration=Release
msbuild fsharp-compiler-build.proj /p:Configuration=Release
また、.NET 2.0やMono 2.1、MonoTouch、Silverlight 5.0、
Windows Phone 7.1、ポータブルプロファイル47(.NET4.5+Silverlight5+Windows8)、
ポータブルプロファイル88(.NET4+Silverlight4+WindowsPhone7.1+Windows8)、
Xbox 360用XNA 4.0のプロファイルに対応するFSharp.Coreをビルドすることもできます:
[lang=text]
msbuild fsharp-library-build.proj /p:TargetFramework=net20 /p:Configuration=Release
msbuild fsharp-library-build.proj /p:TargetFramework=mono21 /p:Configuration=Release
msbuild fsharp-library-build.proj /p:TargetFramework=monotouch /p:Configuration=Release
msbuild fsharp-library-build.proj /p:TargetFramework=portable-net45+sl5+win8 /p:Configuration=Release
msbuild fsharp-library-build.proj /p:TargetFramework=portable-net4+sl4+wp71+win8 /p:Configuration=Release
msbuild fsharp-library-build.proj /p:TargetFramework=sl5 /p:Configuration=Release
msbuild fsharp-library-build.proj /p:TargetFramework=wp7 /p:Configuration=Release
msbuild fsharp-library-build.proj /p:TargetFramework=net40-xna40-xbox360 /p:Configuration=Release
Silverlight 5.0用にFSharp.CoreとFSharp.Compiler.Silverlight.dll
をビルドすることもできます:
[lang=text]
msbuild fsharp-library-build.proj /p:TargetFramework=sl5-compiler /p:Configuration=Release
msbuild fsharp-compiler-build.proj /p:TargetFramework=sl5-compiler /p:Configuration=Release
デバッグ版バイナリを出力する場合は ` /p:Configuration=Debug` に変更します。
### Windows上でxbuildを使用する(つまり.NETがインストールされておらず、Mono 3.0だけがインストールされている)場合
[lang=text]
cd src
xbuild fsharp-proto-build.proj
xbuild fsharp-library-build.proj
xbuild fsharp-compiler-build.proj
xbuildを使用したビルドはMono準拠の公開用バイナリ生成にはまだ対応していないため
(src/fsharp/targets.make を参照)、個人的な使用にとどめ、
公開用のビルドには使用してはいけません。
## 厳密名
生成されたFSharp.Core.dllには遅延署名だけが行われます
(Monoでは厳密名が必須ではありません)。
厳密名で署名されたFSharp.Core.dllが必要であれば以下を使用してください:
[lang=text]
lib\bootstrap\signed\3.0\v4.0\FSharp.Core.dll
## 生成されるファイル
ビルドが完了すると、メインのコンパイラバイナリは以下の場所に生成されます:
[lang=text]
lib/release/4.0
.NET 2.0やMonoAndroid、MonoTouch(Monoプロファイル2.1)は以下の場所に生成されます:
[lang=text]
lib/release/2.0
lib/release/2.1
lib/release/2.1monotouch
`make install` を実行した場合のプレフィックスは以下のようになります:
[lang=text]
/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/2.0/FSharp.Core.dll
/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/2.1/FSharp.Core.dll
/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.0/fsc.exe
/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.0/FSharp.Compiler.dll
...
/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5/fsc.exe
/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5/FSharp.Compiler.dll
...
/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/gac/.../FSharp.Compiler.dll
/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/gac/.../FSharp.Compiler.dll
...
またxbuildをサポートする場合は以下のプレフィックスになります:
[lang=text]
/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/Microsoft\ F#/v4.0/*
/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/Microsoft\ SDKs/F#/3.0/Framework/*
(これらの名前はVisual Studio由来のプロジェクトファイルで使用されている
Microsoft.FSharp.Targetsファイル内における正式名です)
また、以下のスクリプトが配置されます:
[lang=text]
/usr/bin/fsharpc (F# コンパイラ)
/usr/bin/fsharpi (F# Interactive)
## 開発者用メモ
### 継続的インテグレーションビルド
このプロジェクトはJetBrains/Teamcityサーバー上において、
F#コミュニティプロジェクトの一部として継続的インテグレーション
(CI:continuous integration)ビルドが行われています:
[http://teamcity.codebetter.com/project.html?projectId=project61&tab=projectOverview](http://teamcity.codebetter.com/project.html?projectId=project61&tab=projectOverview)
主な管理者は @forki です。
今のところMono用に'make' installと、
Windows用に 'cd src; msbuild fsharp-build.proj' のビルドが行われています。
ビルドされたバイナリは保存されておらず、
単にサニティチェックだけが対象になっています。
### Visual StudioまたはMonoDevelop上でコンパイラを編集する
`all-vs2012.sln` を開いてモードをDebugまたはReleaseに設定します。
コンパイラはコンパイル中でも気を利かせてワークフローに若干介入することがあるため、
実際にコンパイルを実行するには上記にあるようなコマンドライン経由で
コンパイルするとよいでしょう。
MonoDevelopでサポートされているF#ではプロセス内バックグラウンドコンパイラが
使用されます。
Mac上ではこれが原因でガベージコレクションを止めることがあり、
MonoDevelop上でのコンパイラの編集がしづらくなる場合があります。
### .NET 4.x用にF# Coreの単体テストをビルドする(省略可)
このプロジェクトでは、 `FSharp.Core.dll``FSharp.Compiler.dll` の一部を
チェックする単体テストをビルドするためにprotoコンパイラを使用しています。
また、 `tests\fsharp` 以下にもいくつかのテストがあります。
[lang=text]
msbuild fsharp-library-unittests-build.proj /p:TargetFramework=net40
*注意: 単体テストをビルドする場合、NUnitをインストールしておく必要があります。*
### 検証および使用方法
ビルドされたバイナリを簡単に検証するには、以下のようにして `fsi.exe`
(F# Interactive) を起動してみるとよいでしょう:
[lang=text]
lib\debug\4.0\fsi.exe
1 + 1;;
\#q;;
lib\debug\4.0\fsi.exe /help
lib\debug\4.0\fsc.exe /help
echo printfn "hello world" > hello.fs
lib\debug\4.0\fsc.exe hello.fs
hello.exe
### (Windows上で)コンパイラのテストを実行する
`tests\fsharp\core` 以下には言語機能のテストがあります。
テスト機構は素朴なもので、残念なことにバッチファイルを使用しています。
これらのテストをWindows上で実行するには以下のようにします:
[lang=text]
cd ..\tests\fsharp\core
..\..\build-and-run-all-installed-ilx-configs.bat results.log
それぞれのテストディレクトリには1つのテスト結果ファイルが生成され、
発生したエラーも記録されます。
[lang=text]
tests\fsharp\core
tests\fsharp\core\queriesCustomQueryOps
tests\fsharp\core\queriesLeafExpressionConvert
tests\fsharp\core\queriesNullableOperators
tests\fsharp\core\queriesOverIEnumerable
...
LINQクエリに対するいくつかのテストではSQL Serverのインストールが必要です。
テストが失敗すると、たとえば以下のように出力されます:
[lang=text]
ERRORLEVEL=1: in tests\fsharp\core\csfromfs\build.bat
この場合、関連するディレクトリに移動した後、
`build.bat` および `run.bat` を実行します。
## 歴史
Microsoftから公開されたF#コンパイラのソースは
[fsharppowerpack.codeplex.com](http://fsharppowerpack.codeplex.com) にあります。
ブートストラップ用ライブラリ、ツール、F#コンパイラが利用できます。
`lib/bootstrap/X.0` ディレクトリにはMonoビルド用ライブラリやコンパイラ、
ビルドをブートストラップするために使用するツールなどが含まれています。
ブートストラップを独自に指定する場合は `--with-bootstrap` オプションを使用します。
#!/bin/sh
# Perform any necessary setup prior to running builds
# (e.g., restoring NuGet packages).
echo "prepare-mono.sh..."
./mono/prepare-mono.sh
rc=$?;
if [ $rc -ne 0 ]; then
echo "mono/prepare-mono script failed."
exit $rc
fi
echo "done mono/prepare-mono.sh, building..."
chmod +x mono/travis-autogen.sh
# Generate the makefiles
# Bootstrap the compiler
# Install the compiler
./mono/travis-autogen.sh && \
./mono/prepare-mono.sh && \
make && \
sudo make install
......@@ -2,18 +2,26 @@ DEFAULT: all
.PHONY: install-sdk-lib
prefix := @prefix@
topdir := @abs_top_srcdir@/
builddir := @abs_top_builddir@/
libdir := ${prefix}/lib/
bindir := ${prefix}/bin/
monobindir := @MONOBINDIR@
monolibdir := @MONOLIBDIR@
monodir := ${libdir}mono
monocmd = $(shell which mono)
monocmddir = $(dir $(monocmd))
prefix = $(shell (cd $(monocmddir)/..; pwd))
thisdir = $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
topdir = $(thisdir)../
builddir = $(topdir)
libdir = $(prefix)/lib/
bindir = $(prefix)/bin/
monobindir = $(bindir)
monolibdir = $(libdir)
monodir = $(monolibdir)mono
debugvars:
@echo prefix=$(prefix)
@echo topdir=$(topdir)
@echo monodir=$(monodir)
@echo monolibdir=$(monolibdir)
@echo monobindir=$(monobindir)
TargetDotnetProfile = net40
CONFIG = release
Configuration = Release
DISTVERSION = 201011
......@@ -95,7 +103,7 @@ INSTALL = $(SHELL) $(topdir)/mono/install-sh
INSTALL_BIN = $(INSTALL) -c -m 755
INSTALL_LIB = $(INSTALL_BIN)
MSBUILD = @MSBUILD@
MSBUILD = msbuild
EXTRA_DIST = configure
NO_DIST = .gitignore lib/debug lib/proto lib/release
......@@ -127,7 +135,7 @@ install-sdk-lib:
@mkdir -p $(DESTDIR)$(monodir)/fsharp
@if test "x$(DELAY_SIGN)" = "x1"; then \
echo "Signing $(outdir)$(ASSEMBLY) with Mono key"; \
$(monobindir)/sn -q -R $(outdir)$(ASSEMBLY) $(topdir)mono/mono.snk; \
$(monobindir)sn -q -R $(outdir)$(ASSEMBLY) $(topdir)mono/mono.snk; \
fi
@if test x-$(NAME) = x-FSharp.Compiler.Private; then \
echo "Installing extra dependency System.Collections.Immutable.dll to $(DESTDIR)$(monodir)/fsharp/"; \
......
......@@ -16,9 +16,4 @@ if test x"$1" = x--valgrind; then
EXEC="valgrind $VALGRIND_OPTIONS"
fi
# Beware this line must match the regular expression " (\/.*)\/fsi\.exe" when @TOOL@ is fsi.exe.
# That's because the FSharp MonoDevelop addin looks inside the text of this script to determine the installation
# location of the default FSharp install in order to find the FSharp compiler binaries (see
# fsharpbinding/MonoDevelop.FSharpBinding/Services/CompilerLocationUtils.fs). That's a pretty unfortunate
# way of finding those binaries. And really should be changed.
$EXEC @MONOBINDIR@/mono $DEBUG $MONO_OPTIONS @DIR@/@TOOL@ --exename:$(basename "$0") "$@"
......@@ -26,41 +26,6 @@ if [ $OS = 'Linux' ]; then
sudo apt-get -y install mono-devel msbuild
fi
# Check if SSL certificates have been imported into Mono's certificate store.
# If certs haven't been installed, some/all of the Nuget packages will fail to restore.
#if [ $('certmgr -list -c Trust | grep -c -F "X.509"') -le 1 ]; then
# echo "No SSL certificates installed so unable to restore NuGet packages." >&2;
# echo "Run 'mozroots --sync --import' to install certificates to Mono's certificate store." >&2;
# exit 1
#fi
# Restore NuGet packages (needed for compiler bootstrap and tests).
mono .nuget/NuGet.exe restore packages.config -PackagesDirectory packages -ConfigFile .nuget/NuGet.Config
(if test x-$BUILD_CORECLR = x-1; then \
sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list'; \
sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893; \
sudo apt-get update; \
sudo apt-get -y install dotnet-dev-1.0.0-preview2-003131; \
(cd tests/fsharp; mono ../../.nuget/NuGet.exe restore project.json -PackagesDirectory ../../packages -ConfigFile ../../.nuget/NuGet.Config); \
./init-tools.sh; \
echo "------ start log"; \
cat ./init-tools.log; echo "------ end log"; \
fi)
(if test x-$BUILD_PROTO_WITH_CORECLR_LKG = x-1; then \
(cd lkg/fsc && dotnet restore --packages ../packages && dotnet publish project.json -o ../Tools/lkg -r ubuntu.14.04-x64); \
(cd lkg/fsi && dotnet restore --packages ../packages && dotnet publish project.json -o ../Tools/lkg -r ubuntu.14.04-x64); \
fi)
#TODO: work out how to avoid the need for this
echo "chmod u+x packages/FSharp.Compiler.Tools.4.1.27/tools/fsi.exe"
echo "chmod u+x packages/FsLexYacc.7.0.6/build/fslex.exe"
echo "chmod u+x packages/FsLexYacc.7.0.6/build/fsyacc.exe"
chmod u+x packages/FSharp.Compiler.Tools.4.1.27/tools/fsi.exe
chmod u+x packages/FsLexYacc.7.0.6/build/fslex.exe
chmod u+x packages/FsLexYacc.7.0.6/build/fsyacc.exe
# The FSharp.Compiler.Tools package doesn't work correctly unless a proper install of F# has been done on the machine.
# OSX can skip this because the OSX Mono installer includes F#.
if [ $OS != 'OSX' ]; then
......
#!/usr/bin/env sh
echo "TRAVIS_OS_NAME=$TRAVIS_OS_NAME"
if [ "$TRAVIS_OS_NAME" = "osx" ];
then
# Parse 'Mono JIT compiler version 5.0.1.1' to '5.0.1'
monoVer=$(mono --version | head -n 1 | cut -d' ' -f 5 | cut -d'.' -f 1-3)
prefix="/Library/Frameworks/Mono.framework/Versions/$monoVer";
else
prefix="/usr";
fi
echo "./autogen.sh --prefix=$prefix"
./autogen.sh --prefix=$prefix
\ No newline at end of file
......@@ -26,83 +26,68 @@ def static getBuildJobName(def configuration, def os) {
configurations.each { configuration ->
def lowerConfiguration = configuration.toLowerCase()
// Calculate job name
def jobName = getBuildJobName(configuration, os)
def buildPath = '';
if (os == 'Windows_NT') {
buildPath = ".\\"
}
else {
buildPath = "./"
}
def buildCommand = '';
def buildFlavor= '';
def buildOutput= '';
def buildArgs= '';
if (configuration == "Release_fcs" && branch != "dev15.5") {
// Build and test FCS NuGet package
buildPath = "./fcs/"
buildFlavor = ""
buildOutput = "Release"
if (os == 'Windows_NT') {
build_args = "TestAndNuget"
buildCommand = ".\\fcs\\build.cmd TestAndNuget"
}
else {
build_args = "Build"
buildCommand = "./fcs/build.sh Build"
}
}
else if (configuration == "Debug_default") {
buildFlavor = "debug"
build_args = ""
buildOutput = "Debug"
if (os == 'Windows_NT') {
buildCommand = "build.cmd debug"
}
else {
buildCommand = "make Configuration=Debug"
}
}
else if (configuration == "Release_default") {
buildFlavor = "release"
build_args = ""
buildOutput = "Release"
if (os == 'Windows_NT') {
buildCommand = "build.cmd release"
}
else {
buildCommand = "make Configuration=Release"
}
}
else if (configuration == "Release_net40_test") {
buildFlavor = "release"
build_args = "net40 test"
buildOutput = "Release"
buildCommand = "build.cmd release net40 test"
}
else if (configuration == "Release_ci_part1") {
buildFlavor = "release"
build_args = "ci_part1"
else if (onfiguration == "Release_ci_part1") {
buildOutput = "Release"
buildCommand = "build.cmd release ci_part1"
}
else if (configuration == "Release_ci_part2") {
buildFlavor = "release"
build_args = "ci_part2"
buildOutput = "Release"
buildCommand = "build.cmd release ci_part2"
}
else if (configuration == "Release_ci_part3") {
buildFlavor = "release"
build_args = "ci_part3"
buildOutput = "Release"
buildCommand = "build.cmd release ci_part3"
}
else if (configuration == "Release_net40_no_vs") {
buildFlavor = "release"
build_args = "net40"
}
else {
buildFlavor = "release"
build_args = "none"
buildOutput = "Release"
buildCommand = "build.cmd release net40"
}
if (os == 'Windows_NT') {
buildCommand = "${buildPath}build.cmd ${buildFlavor} ${build_args}"
}
else {
buildCommand = "${buildPath}build.sh ${buildFlavor} ${build_args}"
}
def newJobName = Utilities.getFullJobName(project, jobName, isPullRequest)
def newJob = job(newJobName) {
steps {
if (os == 'Windows_NT') {
batchFile("""
echo *** Build Visual F# Tools ***
${buildPath}build.cmd ${buildFlavor} ${build_args}""")
batchFile(buildCommand)
}
else {
// Shell
shell(buildCommand)
}
}
......@@ -115,15 +100,8 @@ ${buildPath}build.cmd ${buildFlavor} ${build_args}""")
Utilities.setMachineAffinity(newJob, os, affinity)
Utilities.standardJobSetup(newJob, project, isPullRequest, "*/${branch}")
if (build_args != "none") {
Utilities.addArchival(newJob, "tests/TestResults/*.*", "", skipIfNoTestFiles, false)
if (configuration == "Release_fcs") {
Utilities.addArchival(newJob, "Release/**")
}
else {
Utilities.addArchival(newJob, "${buildFlavor}/**")
}
}
Utilities.addArchival(newJob, "tests/TestResults/*.*", "", skipIfNoTestFiles, false)
Utilities.addArchival(newJob, "${buildOutput}/**")
if (isPullRequest) {
Utilities.addGithubPRTriggerForBranch(newJob, branch, "${os} ${configuration} Build")
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册