Merge pull request #66299 from jdanekrh/jd_fsharp_update_mono

fsharp41: 4.1.7 -> 4.1.34; mono = mono6
This commit is contained in:
obadz 2019-08-26 19:53:30 +01:00 committed by GitHub
commit a9b4e7592f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 1435 additions and 30 deletions

View File

@ -2863,6 +2863,15 @@
githubId = 1383440;
name = "Jason Gilliland";
};
jdanek = {
email = "jdanek@redhat.com";
github = "jdanekrh";
keys = [{
longkeyid = "ed25519/0x69275CADF15D872E";
fingerprint = "D4A6 F051 AD58 2E7C BCED 5439 6927 5CAD F15D 872E";
}];
name = "Jiri Daněk";
};
jdehaas = {
email = "qqlq@nullptr.club";
github = "jeroendehaas";

View File

@ -1,14 +1,14 @@
# Temporaririly avoid dependency on dotnetbuildhelpers to avoid rebuilding many times while working on it
{ stdenv, fetchurl, pkgconfig, autoconf, automake, which, mono, dotnetbuildhelpers, dotnetPackages }:
{ stdenv, fetchurl, pkgconfig, autoconf, automake, which, mono, msbuild, dotnetbuildhelpers, dotnetPackages }:
stdenv.mkDerivation rec {
name = "fsharp-${version}";
version = "4.1.7";
version = "4.1.34";
src = fetchurl {
url = "https://github.com/fsharp/fsharp/archive/${version}.tar.gz";
sha256 = "0rfkrk4mzi4w54mfqilvng9ar5swhmnwhsyjc54rx3fd0np3jiyl";
sha256 = "0cv6p5pin962vhbpsji40nkckkag5c96kq5qihvg60pc1z821p0i";
};
nativeBuildInputs = [ pkgconfig ];
@ -17,12 +17,16 @@ stdenv.mkDerivation rec {
automake
which
mono
msbuild
dotnetbuildhelpers
dotnetPackages.FsCheck262
dotnetPackages.FSharpCompilerTools
dotnetPackages.FSharpCore
dotnetPackages.FSharpCore302
dotnetPackages.FSharpCore3125
dotnetPackages.FSharpCore4001
dotnetPackages.FSharpCore4117
dotnetPackages.FSharpData225
dotnetPackages.FsLexYacc704
dotnetPackages.FsLexYacc706
dotnetPackages.MicrosoftDiaSymReader
dotnetPackages.MicrosoftDiaSymReaderPortablePdb
dotnetPackages.NUnit350
@ -31,6 +35,14 @@ stdenv.mkDerivation rec {
dotnetPackages.SystemValueTuple
];
# https://github.com/mono/mono/tree/fe0f311a848068ab2d17a9b9dd15326e5712d520/packaging/MacSDK/patches
# https://github.com/mono/mono/issues/7805
patches = [
./fsharp-IsPathRooted-type-inference.patch
./fsharp-string-switchName.patch
./fsharp-path-overloads.patch
];
configurePhase = ''
substituteInPlace ./autogen.sh --replace "/usr/bin/env sh" "${stdenv.shell}"
./autogen.sh --prefix $out
@ -47,24 +59,30 @@ stdenv.mkDerivation rec {
mkdir packages
ln -s ${dotnetPackages.FsCheck262}/lib/dotnet/FsCheck packages/FsCheck.2.6.2
ln -s ${dotnetPackages.FSharpCompilerTools}/lib/dotnet/FSharp.Compiler.Tools packages/FSharp.Compiler.Tools.4.1.4
ln -s ${dotnetPackages.FSharpCore}/lib/dotnet/FSharp.Core/ packages/FSharp.Core.4.0.0.1
ln -s ${dotnetPackages.FSharpCompilerTools}/lib/dotnet/FSharp.Compiler.Tools packages/FSharp.Compiler.Tools.4.1.27
ln -s ${dotnetPackages.FSharpCore302}/lib/dotnet/FSharp.Core/ packages/FSharp.Core.3.0.2
ln -s ${dotnetPackages.FSharpCore3125}/lib/dotnet/FSharp.Core/ packages/FSharp.Core.3.1.2.5
ln -s ${dotnetPackages.FSharpCore4001}/lib/dotnet/FSharp.Core/ packages/FSharp.Core.4.0.0.1
ln -s ${dotnetPackages.FSharpCore4117}/lib/dotnet/FSharp.Core/ packages/FSharp.Core.4.1.17
ln -s ${dotnetPackages.FSharpData225}/lib/dotnet/FSharp.Data/ packages/FSharp.Data.2.2.5
ln -s ${dotnetPackages.FsLexYacc704}/lib/dotnet/FsLexYacc/ packages/FsLexYacc.7.0.4
ln -s ${dotnetPackages.FsLexYacc706}/lib/dotnet/FsLexYacc/ packages/FsLexYacc.7.0.6
ln -s ${dotnetPackages.MicrosoftDiaSymReader}/lib/dotnet/Microsoft.DiaSymReader/ packages/Microsoft.DiaSymReader.1.1.0
ln -s ${dotnetPackages.MicrosoftDiaSymReaderPortablePdb}/lib/dotnet/Microsoft.DiaSymReader.PortablePdb/ packages/Microsoft.DiaSymReader.PortablePdb.1.2.0
ln -s ${dotnetPackages.NUnit350}/lib/dotnet/NUnit/ packages/NUnit.3.5.0
ln -s ${dotnetPackages.SystemCollectionsImmutable131}/lib/dotnet/System.Collections.Immutable/ packages/System.Collections.Immutable.1.3.1
ln -s ${dotnetPackages.SystemReflectionMetadata}/lib/dotnet/System.Reflection.Metadata/ packages/System.Reflection.Metadata.1.4.2
ln -s ${dotnetPackages.SystemValueTuple}/lib/dotnet/System.ValueTuple/ packages/System.ValueTuple.4.3.0
ln -s ${dotnetPackages.SystemValueTuple}/lib/dotnet/System.ValueTuple/ packages/System.ValueTuple.4.3.1
'';
# Make sure the executables use the right mono binary,
# and set up some symlinks for backwards compatibility.
# Signing /home/jdanek/nix/nixpkgs/build/fss/fsharp-4.1.34/again/fsharp-4.1.34/Release/fsharp30/net40/bin/FSharp.Core.dll with Mono key
# ERROR: Unknown error during processing: System.UnauthorizedAccessException: Access to the path
# "Release/fsharp30/net40/bin/FSharp.Core.dll" is denied.
preInstall = ''
find Release/ -name FSharp.Core.dll -exec chmod u+w {} \;
'';
# Set up some symlinks for backwards compatibility.
postInstall = ''
substituteInPlace $out/bin/fsharpc --replace " mono " " ${mono}/bin/mono "
substituteInPlace $out/bin/fsharpi --replace " mono " " ${mono}/bin/mono "
substituteInPlace $out/bin/fsharpiAnyCpu --replace " mono " " ${mono}/bin/mono "
ln -s $out/bin/fsharpc $out/bin/fsc
ln -s $out/bin/fsharpi $out/bin/fsi
for dll in "$out/lib/mono/fsharp"/FSharp*.dll
@ -73,6 +91,26 @@ stdenv.mkDerivation rec {
done
'';
doInstallCheck = true;
installCheckPhase = ''
echo 'printf "int = %i" (6 * 7);;' > script.fsx
$out/bin/fsi --exec script.fsx | grep "int = 42"
$out/bin/fsharpi --exec script.fsx | grep "int = 42"
$out/bin/fsharpiAnyCpu --exec script.fsx | grep "int = 42"
cat > answer.fs <<EOF
open System
[<EntryPoint>]
let main argv =
printfn "int = %i" (6 * 7)
0
EOF
$out/bin/fsc answer.fs
${mono}/bin/mono answer.exe | grep "int = 42"
'';
# To fix this error when running:
# The file "/nix/store/path/whatever.exe" is an not a valid CIL image
dontStrip = true;

View File

@ -0,0 +1,21 @@
commit c37fce5b3019c7a150203fc3a484885591b194de
Author: Alexis Christoforides <alexis@thenull.net>
Date: Sun Dec 2 00:10:24 2018 -0500
Help Path.IsPathRooted method overload selection.
.NET Core, and Mono after merging https://github.com/mono/mono/pull/11342, introduce ambiguity with a new overload.
diff --git a/src/scripts/scriptlib.fsx b/src/scripts/scriptlib.fsx
index cc797e305..699c7bb93 100644
--- a/src/scripts/scriptlib.fsx
+++ b/src/scripts/scriptlib.fsx
@@ -92,7 +92,7 @@ module Scripting =
module Process =
- let processExePath baseDir exe =
+ let processExePath baseDir (exe:string) =
if Path.IsPathRooted(exe) then exe
else
match Path.GetDirectoryName(exe) with

View File

@ -0,0 +1,22 @@
diff --git a/src/scripts/scriptlib.fsx b/src/scripts/scriptlib.fsx
index cc797e305..ae8a6d3cc 100644
--- a/src/scripts/scriptlib.fsx
+++ b/src/scripts/scriptlib.fsx
@@ -59,12 +59,12 @@ module Scripting =
let (++) a b = Path.Combine(a,b)
- let getBasename a = Path.GetFileNameWithoutExtension a
- let getFullPath a = Path.GetFullPath a
- let getFilename a = Path.GetFileName a
- let getDirectoryName a = Path.GetDirectoryName a
+ let getBasename (path: string) = Path.GetFileNameWithoutExtension path
+ let getFullPath (path: string) = Path.GetFullPath path
+ let getFilename (path: string) = Path.GetFileName path
+ let getDirectoryName (path: string) = Path.GetDirectoryName path
- let copyFile source dir =
+ let copyFile (source: string) dir =
let dest =
if not (Directory.Exists dir) then Directory.CreateDirectory dir |>ignore
let result = Path.Combine(dir, Path.GetFileName source)

View File

@ -0,0 +1,13 @@
diff --git a/src/scripts/scriptlib.fsx b/src/scripts/scriptlib.fsx
index cc797e305..5a7be7d2b 100644
--- a/src/scripts/scriptlib.fsx
+++ b/src/scripts/scriptlib.fsx
@@ -36,7 +36,7 @@ module Scripting =
#if INTERACTIVE
let argv = Microsoft.FSharp.Compiler.Interactive.Settings.fsi.CommandLineArgs |> Seq.skip 1 |> Seq.toArray
- let getCmdLineArgOptional switchName =
+ let getCmdLineArgOptional (switchName: string) =
argv |> Array.filter(fun t -> t.StartsWith(switchName)) |> Array.map(fun t -> t.Remove(0, switchName.Length).Trim()) |> Array.tryHead
let getCmdLineArg switchName defaultValue =

View File

@ -0,0 +1,9 @@
{ callPackage, Foundation, libobjc }:
callPackage ./generic.nix (rec {
inherit Foundation libobjc;
version = "6.0.0.313";
srcArchiveSuffix = "tar.xz";
sha256 = "0l0cd6q5xh1vdm6zr78rkfqdsmrgzanjgpxvgig0pyd3glfyjim9";
enableParallelBuilding = true;
})

View File

@ -1,14 +1,16 @@
{ stdenv, fetchurl, bison, pkgconfig, glib, gettext, perl, libgdiplus, libX11, callPackage, ncurses, zlib, withLLVM ? false, cacert, Foundation, libobjc, python, version, sha256, autoconf, libtool, automake, cmake, which, enableParallelBuilding ? true }:
{ stdenv, fetchurl, bison, pkgconfig, glib, gettext, perl, libgdiplus, libX11, callPackage, ncurses, zlib, withLLVM ? false, cacert, Foundation, libobjc, python, version, sha256, autoconf, libtool, automake, cmake, which
, enableParallelBuilding ? true
, srcArchiveSuffix ? "tar.bz2"
}:
let
llvm = callPackage ./llvm.nix { };
in
stdenv.mkDerivation rec {
name = "mono-${version}";
src = fetchurl {
inherit sha256;
url = "https://download.mono-project.com/sources/mono/${name}.tar.bz2";
url = "https://download.mono-project.com/sources/mono/${name}.${srcArchiveSuffix}";
};
buildInputs =

View File

@ -0,0 +1,133 @@
{ stdenv, fetchurl, makeWrapper, glibcLocales, mono, dotnetPackages, unzip, dotnet-sdk }:
let
xplat = fetchurl {
url = "https://github.com/mono/msbuild/releases/download/0.07/mono_msbuild_xplat-master-8f608e49.zip";
sha256 = "1jxq3fk9a6q2a8i9zacxaz3fkvc22i9qvzlpa7wbb95h42g0ffhq";
};
deps = import ./nuget.nix { inherit fetchurl; };
in
stdenv.mkDerivation rec {
pname = "msbuild";
version = "16.3+xamarinxplat.2019.07.26.14.57";
src = fetchurl {
url = "https://download.mono-project.com/sources/msbuild/msbuild-${version}.tar.xz";
sha256 = "1zcdfx4xsh62wj3g1jc2an0lppsfs691lz4dv05xbgi01aq1hk6a";
};
nativeBuildInputs = [
dotnet-sdk
mono
];
buildInputs = [
dotnetPackages.Nuget
glibcLocales
makeWrapper
unzip
];
# https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=msbuild
phases = ["unpackPhase" "buildPhase" "installPhase" "installCheckPhase"];
# https://github.com/NixOS/nixpkgs/issues/38991
# bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
LOCALE_ARCHIVE = stdenv.lib.optionalString stdenv.isLinux
"${glibcLocales}/lib/locale/locale-archive";
buildPhase = ''
# nuget would otherwise try to base itself in /homeless-shelter
export HOME=$(pwd)/fake-home
for package in ${toString deps}; do
nuget add $package -Source nixos
done
nuget sources Disable -Name "nuget.org"
nuget sources Add -Name nixos -Source $(pwd)/nixos
# license check is case sensitive
mv LICENSE license
mkdir -p artifacts
unzip ${xplat} -d artifacts
mv artifacts/msbuild artifacts/mono-msbuild
chmod +x artifacts/mono-msbuild/MSBuild.dll
ln -s $(find ${dotnet-sdk} -name libhostfxr.so) artifacts/mono-msbuild/SdkResolvers/Microsoft.DotNet.MSBuildSdkResolver/
# overwrite the file
echo "#!${stdenv.shell}" > eng/common/dotnet-install.sh
# msbuild response files to use only the nixos source
echo "/p:RestoreSources=nixos" > artifacts/mono-msbuild/MSBuild.rsp
echo "/p:RestoreSources=nixos" > src/MSBuild/MSBuild.rsp
# not patchShebangs, there is /bin/bash in the body of the script as well
substituteInPlace ./eng/cibuild_bootstrapped_msbuild.sh --replace /bin/bash ${stdenv.shell}
# DisableNerdbankVersioning https://gitter.im/Microsoft/msbuild/archives/2018/06/27?at=5b33dbc4ce3b0f268d489bfa
# TODO there are some (many?) failing tests
./eng/cibuild_bootstrapped_msbuild.sh --host_type mono --configuration Release --skip_tests /p:DisableNerdbankVersioning=true
'';
installPhase = ''
mono artifacts/mono-msbuild/MSBuild.dll mono/build/install.proj /p:MonoInstallPrefix="$out" /p:Configuration=Release-MONO
ln -s ${mono}/lib/mono/msbuild/Current/bin/Roslyn $out/lib/mono/msbuild/Current/bin/Roslyn
makeWrapper ${mono}/bin/mono $out/bin/msbuild \
--set MSBuildExtensionsPath $out/lib/mono/xbuild \
--set-default MONO_GC_PARAMS "nursery-size=64m" \
--add-flags "$out/lib/mono/msbuild/15.0/bin/MSBuild.dll"
'';
doInstallCheck = true;
# https://docs.microsoft.com/cs-cz/visualstudio/msbuild/walkthrough-creating-an-msbuild-project-file-from-scratch?view=vs-2019
installCheckPhase = ''
cat > Helloworld.cs <<EOF
using System;
class HelloWorld
{
static void Main()
{
#if DebugConfig
Console.WriteLine("WE ARE IN THE DEBUG CONFIGURATION");
#endif
Console.WriteLine("Hello, world!");
}
}
EOF
cat > Helloworld.csproj <<EOF
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Compile Include="Helloworld.cs" />
</ItemGroup>
<Target Name="Build">
<Csc Sources="@(Compile)"/>
</Target>
</Project>
EOF
$out/bin/msbuild Helloworld.csproj -t:Build
${mono}/bin/mono Helloworld.exe | grep "Hello, world!"
'';
meta = with stdenv.lib; {
description = "Mono version of Microsoft Build Engine, the build platform for .NET, and Visual Studio";
homepage = https://github.com/mono/msbuild;
license = licenses.mit;
maintainers = with maintainers; [ jdanek ];
platforms = platforms.unix;
};
}

File diff suppressed because it is too large Load Diff

View File

@ -7833,7 +7833,7 @@ in
fsharp = callPackage ../development/compilers/fsharp { };
fsharp41 = callPackage ../development/compilers/fsharp41 { mono = mono4; };
fsharp41 = callPackage ../development/compilers/fsharp41 { mono = mono6; };
fstar = callPackage ../development/compilers/fstar { };
@ -8220,8 +8220,15 @@ in
inherit (darwin.apple_sdk.frameworks) Foundation;
};
mono6 = callPackage ../development/compilers/mono/6.nix {
inherit (darwin) libobjc;
inherit (darwin.apple_sdk.frameworks) Foundation;
};
monoDLLFixer = callPackage ../build-support/mono-dll-fixer { };
msbuild = callPackage ../development/tools/build-managers/msbuild { mono = mono6; };
mosml = callPackage ../development/compilers/mosml { };
mozart-binary = callPackage ../development/compilers/mozart/binary.nix { };

View File

@ -45,10 +45,31 @@ let self = dotnetPackages // overrides; dotnetPackages = with self; {
outputFiles = [ "lib/net40/*" ];
};
FSharpCore = fetchNuGet {
FSharpCore302 = fetchNuGet {
baseName = "FSharp.Core";
version = "3.0.2";
sha256 = "1s4pqwbmhrsg5sw8i6dixdri3x0yjyilmkhsf4apfkp80si7d73q";
outputFiles = [ "*" ];
};
FSharpCore3125 = fetchNuGet {
baseName = "FSharp.Core";
version = "3.1.2.5";
sha256 = "0pfvjimrgrffb5rj612gsid044lfpk8g2cxyh9792dc1n8ck5hih";
outputFiles = [ "*" ];
};
FSharpCore4001 = fetchNuGet {
baseName = "FSharp.Core";
version = "4.0.0.1";
sha256 = "01nhjcxdz8l1r5vvdzhmgy5x7z5fqppab3ki34qg14axgf8jjygn";
sha256 = "0v53iq12ji2d1bkdyg9dn8sz5l93sprrh835amh39dghh8v8vm8k";
outputFiles = [ "*" ];
};
FSharpCore4117 = fetchNuGet {
baseName = "FSharp.Core";
version = "4.1.17";
sha256 = "1yk23ir66fgqm5r6qyf66zf64l0s223l3yd7p9yvbyimyg0hgzb1";
outputFiles = [ "*" ];
};
@ -89,8 +110,8 @@ let self = dotnetPackages // overrides; dotnetPackages = with self; {
FSharpCompilerTools = fetchNuGet {
baseName = "FSharp.Compiler.Tools";
version = "4.1.4";
sha256 = "0vsp0khlnwh15ibg8s161rw6a6i8rlriclpq53paga447jllf0m8";
version = "4.1.27";
sha256 = "1m3hl8ja9gp5ajxmjf7bnq24bbkd6kx7yhxf4zb8si27h1n9l6dl";
outputFiles = [ "*" ];
};
@ -101,10 +122,10 @@ let self = dotnetPackages // overrides; dotnetPackages = with self; {
outputFiles = [ "build/*" ];
};
FsLexYacc704 = fetchNuGet {
FsLexYacc706 = fetchNuGet {
baseName = "FsLexYacc";
version = "7.0.4";
sha256 = "01zpdb0pybdf0by02rwd7pb1g0cmnn8jxm2pibzxjxw6f4l43ywi";
version = "7.0.6";
sha256 = "0xwiq8q5q6ga6zj24w83ch5csbv405xcg6jg2hmnjic0npz0drk2";
outputFiles = [ "*" ];
};
@ -203,8 +224,8 @@ let self = dotnetPackages // overrides; dotnetPackages = with self; {
SystemValueTuple = fetchNuGet {
baseName = "System.ValueTuple";
version = "4.3.0";
sha256 = "00p5s753xh5417arw3k6npf1pc1k3m1s9mrlkw5vmc7pg8lm6n88";
version = "4.3.1";
sha256 = "0qzq878s66yfkf4n2b9af8lw2bx45s3cg6mi0w8w0bi358fa7q70";
outputFiles = [ "*" ];
};
@ -848,13 +869,13 @@ let self = dotnetPackages // overrides; dotnetPackages = with self; {
Nuget = buildDotnetPackage {
baseName = "Nuget";
version = "3.4.3";
version = "4.9.1";
src = fetchFromGitHub {
owner = "mono";
repo = "nuget-binary";
rev = "1f3025c2eb13bfcb56b47ddd77329ac3d9911d1c";
sha256 = "01snk05hcrp5i2ys3p1y34r05q1b460q6wb8p3vwpba2q2czdax5";
rev = "7871fa26914593fdb2f2500df1196df7b8aecb1c";
sha256 = "07r63xam6icm17pf6amh1qkmna13nxa3ncdan7a3ql307i5isriz";
};
buildInputs = [ unzip ];