Lay down the foundation for packaging the .NET echosystem

- fetchNuGet can fetch binaries from nuget servers
- buildDotnetPackage can build .NET packages using mono/xbuild
  - Places nuget & paket as they would clash with nix
  - Patch project files because F# targets are expected to be found in
    the mono directory (and we know that's not going to happen on nix)
  - Find DLLs that were copied from buildInputs and replace by symlink
    for sharing
  - Export produced DLL via the pkg-config mechanism
  - Create wrappers for produced EXEs
- Repackaged this new infrastructure: keepass, monodevelop
- Newly packaged: ExtCore, UnionArgParser, FSharp.Data, Paket, and a
  bunch more..

This is a combination of 73 commits.
This commit is contained in:
obadz
2015-05-22 14:25:02 +01:00
parent 4cf3596fda
commit d4681bf626
20 changed files with 1159 additions and 76 deletions

View File

@@ -1,4 +1,6 @@
{ stdenv, fetchurl, mono, pkgconfig, autoconf, automake, which }:
# Temporaririly avoid dependency on dotnetbuildhelpers to avoid rebuilding many times while working on it
{ stdenv, fetchurl, mono, pkgconfig, dotnetbuildhelpers, autoconf, automake, which }:
stdenv.mkDerivation rec {
name = "fsharp-${version}";
@@ -9,7 +11,7 @@ stdenv.mkDerivation rec {
sha256 = "16kqgdx0y0lmxv59mc4g7l5ll60nixg5b8bg07vxfnqrf7i6dffd";
};
buildInputs = [ mono pkgconfig autoconf automake which ];
buildInputs = [ mono pkgconfig dotnetbuildhelpers autoconf automake which ];
configurePhase = ''
substituteInPlace ./autogen.sh --replace "/usr/bin/env sh" "/bin/sh"
./autogen.sh --prefix $out
@@ -23,6 +25,10 @@ stdenv.mkDerivation rec {
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/4.5"/FSharp*.dll
do
create-pkg-config-for-dll.sh "$out/lib/pkgconfig" "$dll"
done
'';
# To fix this error when running:

View File

@@ -1,4 +1,4 @@
{ stdenv, fetchurl, bison, pkgconfig, glib, gettext, perl, libgdiplus, libX11, callPackage, ncurses, zlib, withLLVM ? true }:
{ stdenv, fetchurl, bison, pkgconfig, glib, gettext, perl, libgdiplus, libX11, callPackage, ncurses, zlib, withLLVM ? false, cacert }:
let
llvm = callPackage ./llvm.nix { };
@@ -31,11 +31,16 @@ stdenv.mkDerivation rec {
# Parallel building doesn't work, as shows http://hydra.nixos.org/build/2983601
enableParallelBuilding = false;
# We want pkg-config to take priority over the dlls in the Mono framework and the GAC
# because we control pkg-config
patches = [ ./pkgconfig-before-gac.patch ];
# Patch all the necessary scripts. Also, if we're using LLVM, we fix the default
# LLVM path to point into the Mono LLVM build, since it's private anyway.
preBuild = ''
makeFlagsArray=(INSTALL=`type -tp install`)
patchShebangs ./
substituteInPlace mcs/class/corlib/System/Environment.cs --replace /usr/share "$out/share"
'' + stdenv.lib.optionalString withLLVM ''
substituteInPlace mono/mini/aot-compiler.c --replace "llvm_path = g_strdup (\"\")" "llvm_path = g_strdup (\"${llvm}/bin/\")"
'';
@@ -50,6 +55,14 @@ stdenv.mkDerivation rec {
done
'';
# Without this, any Mono application attempting to open an SSL connection will throw with
# The authentication or decryption has failed.
# ---> Mono.Security.Protocol.Tls.TlsException: Invalid certificate received from server.
postInstall = ''
echo "Updating Mono key store"
$out/bin/cert-sync ${cacert}/etc/ssl/certs/ca-bundle.crt
'';
meta = {
homepage = http://mono-project.com/;
description = "Cross platform, open source .NET development framework";

View File

@@ -0,0 +1,65 @@
diff -Naur mono-4.0.1.old/mcs/tools/xbuild/data/12.0/Microsoft.Common.targets mono-4.0.1/mcs/tools/xbuild/data/12.0/Microsoft.Common.targets
--- mono-4.0.1.old/mcs/tools/xbuild/data/12.0/Microsoft.Common.targets 2015-04-24 02:26:18.000000000 +0100
+++ mono-4.0.1/mcs/tools/xbuild/data/12.0/Microsoft.Common.targets 2015-05-26 00:52:33.997847464 +0100
@@ -229,8 +229,8 @@
$(ReferencePath);
@(AdditionalReferencePath);
{HintPathFromItem};
- {TargetFrameworkDirectory};
{PkgConfig};
+ {TargetFrameworkDirectory};
{GAC};
{RawFileName};
$(OutDir)
diff -Naur mono-4.0.1.old/mcs/tools/xbuild/data/14.0/Microsoft.Common.targets mono-4.0.1/mcs/tools/xbuild/data/14.0/Microsoft.Common.targets
--- mono-4.0.1.old/mcs/tools/xbuild/data/14.0/Microsoft.Common.targets 2015-04-24 02:26:18.000000000 +0100
+++ mono-4.0.1/mcs/tools/xbuild/data/14.0/Microsoft.Common.targets 2015-05-26 00:52:41.832612748 +0100
@@ -214,8 +214,8 @@
$(ReferencePath);
@(AdditionalReferencePath);
{HintPathFromItem};
- {TargetFrameworkDirectory};
{PkgConfig};
+ {TargetFrameworkDirectory};
{GAC};
{RawFileName};
$(OutDir)
diff -Naur mono-4.0.1.old/mcs/tools/xbuild/data/2.0/Microsoft.Common.targets mono-4.0.1/mcs/tools/xbuild/data/2.0/Microsoft.Common.targets
--- mono-4.0.1.old/mcs/tools/xbuild/data/2.0/Microsoft.Common.targets 2015-04-24 02:26:18.000000000 +0100
+++ mono-4.0.1/mcs/tools/xbuild/data/2.0/Microsoft.Common.targets 2015-05-26 00:52:46.298478961 +0100
@@ -139,8 +139,8 @@
$(ReferencePath);
@(AdditionalReferencePath);
{HintPathFromItem};
- {TargetFrameworkDirectory};
{PkgConfig};
+ {TargetFrameworkDirectory};
{GAC};
{RawFileName};
$(OutDir)
diff -Naur mono-4.0.1.old/mcs/tools/xbuild/data/3.5/Microsoft.Common.targets mono-4.0.1/mcs/tools/xbuild/data/3.5/Microsoft.Common.targets
--- mono-4.0.1.old/mcs/tools/xbuild/data/3.5/Microsoft.Common.targets 2015-04-24 02:26:18.000000000 +0100
+++ mono-4.0.1/mcs/tools/xbuild/data/3.5/Microsoft.Common.targets 2015-05-26 00:52:52.119304583 +0100
@@ -167,8 +167,8 @@
$(ReferencePath);
@(AdditionalReferencePath);
{HintPathFromItem};
- {TargetFrameworkDirectory};
{PkgConfig};
+ {TargetFrameworkDirectory};
{GAC};
{RawFileName};
$(OutDir)
diff -Naur mono-4.0.1.old/mcs/tools/xbuild/data/4.0/Microsoft.Common.targets mono-4.0.1/mcs/tools/xbuild/data/4.0/Microsoft.Common.targets
--- mono-4.0.1.old/mcs/tools/xbuild/data/4.0/Microsoft.Common.targets 2015-04-24 02:26:18.000000000 +0100
+++ mono-4.0.1/mcs/tools/xbuild/data/4.0/Microsoft.Common.targets 2015-05-26 00:52:56.519172776 +0100
@@ -229,8 +229,8 @@
$(ReferencePath);
@(AdditionalReferencePath);
{HintPathFromItem};
- {TargetFrameworkDirectory};
{PkgConfig};
+ {TargetFrameworkDirectory};
{GAC};
{RawFileName};
$(OutDir)

View File

@@ -0,0 +1,88 @@
--- fsharpbinding-a09c818/monodevelop/MonoDevelop.FSharpBinding/FSharpBinding.addin.xml.orig.old 2015-06-03 19:53:00.116849746 +0100
+++ fsharpbinding-a09c818/monodevelop/MonoDevelop.FSharpBinding/FSharpBinding.addin.xml.orig 2015-06-03 19:56:30.112579384 +0100
@@ -130,6 +130,11 @@
<!-- New projects will be created with this targets file. -->
<Extension path="/MonoDevelop/ProjectModel/MSBuildItemTypes">
<!-- If FSharp 3.1 is available, use it. Note XS looks for the first DotNetProject node under 'Extension' -->
+ <Condition id="MSBuildTargetIsAvailable" target="$(FSharpTargetsPath)" >
+ <DotNetProject language="F#" extension="fsproj" guid="{f2a71f9b-5d33-465a-a702-920d77279786}" import="$(FSharpTargetsPath)" resourceHandler="MonoDevelop.FSharp.FSharpResourceIdBuilder"/>
+ </Condition>
+
+ <!-- If FSharp 3.1 is available, use it. Note XS looks for the first DotNetProject node under 'Extension' -->
<Condition id="MSBuildTargetIsAvailable" target="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets" >
<DotNetProject language="F#" extension="fsproj" guid="{f2a71f9b-5d33-465a-a702-920d77279786}" import="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets" resourceHandler="MonoDevelop.FSharp.FSharpResourceIdBuilder"/>
</Condition>
@@ -182,14 +187,7 @@
<ProjectTemplate id="FSharpConsoleProject" file="Templates/FSharpConsoleProject.xpt.xml"/>
<ProjectTemplate id="FSharpLibraryProject" file="Templates/FSharpLibraryProject.xpt.xml"/>
<!-- Only include the tutorial project if an F# 3.0 or 3.1 target is available as this includes F# 3.0 specific features -->
- <ComplexCondition>
- <Or>
- <Condition id="MSBuildTargetIsAvailable" target="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets" />
- <Condition id="MSBuildTargetIsAvailable" target="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets" />
- </Or>
<ProjectTemplate id="FSharpTutorialProject" file="Templates/FSharpTutorialProject.xpt.xml"/>
- </ComplexCondition>
-
<ProjectTemplate id="FSharpGtkProject" file="Templates/FSharpGtkProject.xpt.xml"/>
<ProjectTemplate id="FSharpNUnitLibraryProject" file="Templates/FSharpNUnitLibraryProject.xpt.xml"/>
</Extension>
@@ -267,13 +265,7 @@
<!-- F# interactive -->
<Extension path="/MonoDevelop/Ide/Pads">
- <ComplexCondition>
- <Or>
- <Condition id="MSBuildTargetIsAvailable" target="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets" />
- <Condition id="MSBuildTargetIsAvailable" target="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets" />
- </Or>
<Pad id="MonoDevelop.FSharp.FSharpInteractivePad" defaultPlacement="Bottom" _label="F# Interactive" icon="md-project" class="MonoDevelop.FSharp.FSharpInteractivePad" />
- </ComplexCondition>
</Extension>
<Extension path = "/MonoDevelop/Ide/Pads/ProjectPad">
@@ -281,11 +273,6 @@
</Extension>
<Extension path="/MonoDevelop/Ide/Commands">
- <ComplexCondition>
- <Or>
- <Condition id="MSBuildTargetIsAvailable" target="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets" />
- <Condition id="MSBuildTargetIsAvailable" target="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets" />
- </Or>
<Category _name = "F# Integration" id="F# Integration">
<Command id="MonoDevelop.FSharp.FSharpCommands.ShowFSharpInteractive"
_label = "F# Interactive"
@@ -330,32 +317,19 @@
macShortcut="Meta|Control|C"
shortcut="Ctrl|Alt|C" />
</Category>
- </ComplexCondition>
</Extension>
<Extension path = "/MonoDevelop/SourceEditor2/ContextMenu/Editor">
- <ComplexCondition>
- <Or>
- <Condition id="MSBuildTargetIsAvailable" target="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets" />
- <Condition id="MSBuildTargetIsAvailable" target="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets" />
- </Or>
<SeparatorItem id = "FSharpInteractiveStart" />
<CommandItem id = "MonoDevelop.FSharp.FSharpCommands.SendSelection" />
<CommandItem id = "MonoDevelop.FSharp.FSharpCommands.SendLine" />
<CommandItem id = "MonoDevelop.FSharp.FSharpCommands.SendReferences" />
- </ComplexCondition>
</Extension>
<Extension path = "/MonoDevelop/Ide/MainMenu/Edit">
- <ComplexCondition>
- <Or>
- <Condition id="MSBuildTargetIsAvailable" target="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets" />
- <Condition id="MSBuildTargetIsAvailable" target="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets" />
- </Or>
<CommandItem id = "MonoDevelop.FSharp.FSharpCommands.SendSelection" />
<CommandItem id = "MonoDevelop.FSharp.FSharpCommands.SendLine" />
<CommandItem id = "MonoDevelop.FSharp.FSharpCommands.SendReferences" />
- </ComplexCondition>
</Extension>
<!--- F# Android -->

View File

@@ -0,0 +1,43 @@
--- fsharpbinding-a09c818/monodevelop/MonoDevelop.FSharpBinding/MonoDevelop.FSharp.fsproj.orig.old 2015-06-03 18:48:55.345385084 +0100
+++ fsharpbinding-a09c818/monodevelop/MonoDevelop.FSharpBinding/MonoDevelop.FSharp.fsproj.orig 2015-06-03 19:00:11.453399028 +0100
@@ -185,19 +185,19 @@
<Private>False</Private>
<HintPath>INSERT_FSPROJ_MDROOT\AddIns\NUnit\MonoDevelop.NUnit.dll</HintPath>
</Reference>
- <ProjectReference Include="..\..\FSharp.CompilerBinding\FSharp.CompilerBinding.fsproj">
- <Project>{88F6940F-D300-474C-B2A7-E2ECD5B04B57}</Project>
- <Name>FSharp.CompilerBinding</Name>
- </ProjectReference>
+ <Reference Include="FSharp.CompilerBinding">
+ <Private>True</Private>
+ </Reference>
<ProjectReference Include="Gui\MonoDevelop.FSharp.Gui.csproj">
<Project>{FD0D1033-9145-48E5-8ED8-E2365252878C}</Project>
<Name>MonoDevelop.FSharp.Gui</Name>
</ProjectReference>
- <Reference Include="FSharp.Core, Version=$(TargetFSharpCoreVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <Reference Include="FSharp.Core">
<Private>True</Private>
</Reference>
<Reference Include="FSharp.Compiler.Service">
<HintPath>packages\FSharp.Compiler.Service.0.0.85\lib\net45\FSharp.Compiler.Service.dll</HintPath>
+ <Private>True</Private>
</Reference>
<Reference Include="Mono.Cecil">
<HintPath>packages\Mono.Cecil.0.9.5.4\lib\net40\Mono.Cecil.dll</HintPath>
@@ -213,12 +213,15 @@
</Reference>
<Reference Include="FantomasLib">
<HintPath>packages\Fantomas.1.6.0\lib\FantomasLib.dll</HintPath>
+ <Private>True</Private>
</Reference>
<Reference Include="FSharp.Compiler.CodeDom">
<HintPath>packages\FSharp.Compiler.CodeDom.0.9.1\lib\net40\FSharp.Compiler.CodeDom.dll</HintPath>
+ <Private>True</Private>
</Reference>
<Reference Include="ExtCore">
<HintPath>packages\ExtCore.0.8.45\lib\net40\ExtCore.dll</HintPath>
+ <Private>True</Private>
</Reference>
</ItemGroup>
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />

View File

@@ -0,0 +1,11 @@
--- Newtonsoft.Json-6.0.8/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj.old 2015-01-11 06:46:39.000000000 +0000
+++ Newtonsoft.Json-6.0.8/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj 2015-05-25 21:29:40.546808622 +0100
@@ -52,6 +52,8 @@
<Reference Include="System.Data.Linq" />
<Reference Include="System.Drawing" />
<Reference Include="System.Numerics" />
+ <Reference Include="System.Collections" />
+ <Reference Include="System.Runtime" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />