git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #25235 from kuznero/mono5x

mono: init at 5.0

commit16f02e8116e3cabf55844cb4bfdb840c5d2d1a83 authorMichael Raskin <7c6f434c@mail.ru> dateWed 5 Jul 2017, 22:36 (9 years ago) parentbd53744bdc99c8
4 files changed+171
pkgs/development/compilers/mono/5.0.nix+7 pkgs/development/compilers/mono/generic-cmake.nix+94 pkgs/development/compilers/mono/pkgconfig-before-gac-5x.patch+65 pkgs/top-level/all-packages.nix+5
pkgs/development/compilers/mono/5.0.nixnew file+7
@@ -0,0 +1,7 @@
1+{ stdenv, callPackage, Foundation, libobjc }:
2+
3+callPackage ./generic-cmake.nix (rec {
4+ inherit Foundation libobjc;
5+ version = "5.0.0.48";
6+ sha256 = "13n20wmijkhd7vm41lzz1n774rna67d94prl33bz1lly0idsciq0";
7+})
pkgs/development/compilers/mono/generic-cmake.nixnew file+94
@@ -0,0 +1,94 @@
1+{ 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 }:
2+
3+let
4+ llvm = callPackage ./llvm.nix { };
5+in
6+stdenv.mkDerivation rec {
7+ name = "mono-${version}";
8+
9+ src = fetchurl {
10+ inherit sha256;
11+ url = "http://download.mono-project.com/sources/mono/${name}.tar.bz2";
12+ };
13+
14+ buildInputs =
15+ [ bison pkgconfig glib gettext perl libgdiplus libX11 ncurses zlib python autoconf libtool automake cmake which
16+ ]
17+ ++ (stdenv.lib.optionals stdenv.isDarwin [ Foundation libobjc ]);
18+
19+ propagatedBuildInputs = [glib];
20+
21+ NIX_LDFLAGS = if stdenv.isDarwin then "" else "-lgcc_s" ;
22+
23+ # To overcome the bug https://bugzilla.novell.com/show_bug.cgi?id=644723
24+ dontDisableStatic = true;
25+
26+ # In fact I think this line does not help at all to what I
27+ # wanted to achieve: have mono to find libgdiplus automatically
28+ configureFlags = [
29+ "--x-includes=${libX11.dev}/include"
30+ "--x-libraries=${libX11.out}/lib"
31+ "--with-libgdiplus=${libgdiplus}/lib/libgdiplus.so"
32+ ]
33+ ++ stdenv.lib.optionals withLLVM [
34+ "--enable-llvm"
35+ "--enable-llvmloaded"
36+ "--with-llvm=${llvm}"
37+ ];
38+
39+ configurePhase = ''
40+ substituteInPlace ./autogen.sh --replace "/usr/bin/env sh" "${stdenv.shell}"
41+ ./autogen.sh --prefix $out
42+ '';
43+
44+ # Attempt to fix this error when running "mcs --version":
45+ # The file /nix/store/xxx-mono-2.4.2.1/lib/mscorlib.dll is an invalid CIL image
46+ dontStrip = true;
47+
48+ # Parallel building doesn't work, as shows http://hydra.nixos.org/build/2983601
49+ enableParallelBuilding = false;
50+
51+ # We want pkg-config to take priority over the dlls in the Mono framework and the GAC
52+ # because we control pkg-config
53+ patches = [ ./pkgconfig-before-gac.patch ];
54+
55+ # Patch all the necessary scripts. Also, if we're using LLVM, we fix the default
56+ # LLVM path to point into the Mono LLVM build, since it's private anyway.
57+ preBuild = ''
58+ makeFlagsArray=(INSTALL=`type -tp install`)
59+ patchShebangs ./
60+ substituteInPlace mcs/class/corlib/System/Environment.cs --replace /usr/share "$out/share"
61+ '' + stdenv.lib.optionalString withLLVM ''
62+ substituteInPlace mono/mini/aot-compiler.c --replace "llvm_path = g_strdup (\"\")" "llvm_path = g_strdup (\"${llvm}/bin/\")"
63+ '';
64+
65+ # Fix mono DLLMap so it can find libX11 and gdiplus to run winforms apps
66+ # Other items in the DLLMap may need to be pointed to their store locations, I don't think this is exhaustive
67+ # http://www.mono-project.com/Config_DllMap
68+ postBuild = ''
69+ find . -name 'config' -type f | xargs \
70+ sed -i -e "s@libX11.so.6@${libX11.out}/lib/libX11.so.6@g" \
71+ -e "s@/.*libgdiplus.so@${libgdiplus}/lib/libgdiplus.so@g" \
72+ '';
73+
74+ # Without this, any Mono application attempting to open an SSL connection will throw with
75+ # The authentication or decryption has failed.
76+ # ---> Mono.Security.Protocol.Tls.TlsException: Invalid certificate received from server.
77+ postInstall = ''
78+ echo "Updating Mono key store"
79+ $out/bin/cert-sync ${cacert}/etc/ssl/certs/ca-bundle.crt
80+ ''
81+ # According to [1], gmcs is just mcs
82+ # [1] https://github.com/mono/mono/blob/master/scripts/gmcs.in
83+ + ''
84+ ln -s $out/bin/mcs $out/bin/gmcs
85+ '';
86+
87+ meta = {
88+ homepage = http://mono-project.com/;
89+ description = "Cross platform, open source .NET development framework";
90+ platforms = with stdenv.lib.platforms; darwin ++ linux;
91+ maintainers = with stdenv.lib.maintainers; [ viric thoughtpolice obadz vrthra ];
92+ license = stdenv.lib.licenses.free; # Combination of LGPL/X11/GPL ?
93+ };
94+}
pkgs/development/compilers/mono/pkgconfig-before-gac-5x.patchnew file+65
@@ -0,0 +1,65 @@
1+diff -Naur mono-5.0.0/mcs/tools/xbuild/data/3.5/Microsoft.Common.targets.old mono-5.0.0/mcs/tools/xbuild/data/3.5/Microsoft.Common.targets
2+--- mono-5.0.0/mcs/tools/xbuild/data/3.5/Microsoft.Common.targets.old 2017-04-24 23:45:18.348116305 +0200
3++++ mono-5.0.0/mcs/tools/xbuild/data/3.5/Microsoft.Common.targets 2017-04-24 23:45:11.407051755 +0200
4+@@ -167,8 +167,8 @@
5+ $(ReferencePath);
6+ @(AdditionalReferencePath);
7+ {HintPathFromItem};
8+- {TargetFrameworkDirectory};
9+ {PkgConfig};
10++ {TargetFrameworkDirectory};
11+ {GAC};
12+ {RawFileName};
13+ $(OutDir)
14+diff -Naur mono-5.0.0/mcs/tools/xbuild/data/4.0/Microsoft.Common.targets.old mono-5.0.0/mcs/tools/xbuild/data/4.0/Microsoft.Common.targets
15+--- mono-5.0.0/mcs/tools/xbuild/data/4.0/Microsoft.Common.targets.old 2017-04-24 23:49:53.019616196 +0200
16++++ mono-5.0.0/mcs/tools/xbuild/data/4.0/Microsoft.Common.targets 2017-04-24 23:50:05.709729585 +0200
17+@@ -232,8 +232,8 @@
18+ $(ReferencePath);
19+ @(AdditionalReferencePath);
20+ {HintPathFromItem};
21+- {TargetFrameworkDirectory};
22+ {PkgConfig};
23++ {TargetFrameworkDirectory};
24+ {GAC};
25+ {RawFileName};
26+ $(OutDir)
27+diff -Naur mono-5.0.0/mcs/tools/xbuild/data/2.0/Microsoft.Common.targets.old mono-5.0.0/mcs/tools/xbuild/data/2.0/Microsoft.Common.targets
28+--- mono-5.0.0/mcs/tools/xbuild/data/2.0/Microsoft.Common.targets.old 2017-04-24 23:52:33.200037047 +0200
29++++ mono-5.0.0/mcs/tools/xbuild/data/2.0/Microsoft.Common.targets 2017-04-24 23:52:43.281125802 +0200
30+@@ -139,8 +139,8 @@
31+ $(ReferencePath);
32+ @(AdditionalReferencePath);
33+ {HintPathFromItem};
34+- {TargetFrameworkDirectory};
35+ {PkgConfig};
36++ {TargetFrameworkDirectory};
37+ {GAC};
38+ {RawFileName};
39+ $(OutDir)
40+diff -Naur mono-5.0.0/mcs/tools/xbuild/data/14.0/Microsoft.Common.targets.old mono-5.0.0/mcs/tools/xbuild/data/14.0/Microsoft.Common.targets
41+--- mono-5.0.0/mcs/tools/xbuild/data/14.0/Microsoft.Common.targets.old 2017-04-24 23:54:02.585821594 +0200
42++++ mono-5.0.0/mcs/tools/xbuild/data/14.0/Microsoft.Common.targets 2017-04-24 23:54:09.313880438 +0200
43+@@ -234,8 +234,8 @@
44+ $(ReferencePath);
45+ @(AdditionalReferencePath);
46+ {HintPathFromItem};
47+- {TargetFrameworkDirectory};
48+ {PkgConfig};
49++ {TargetFrameworkDirectory};
50+ {GAC};
51+ {RawFileName};
52+ $(OutDir)
53+diff -Naur mono-5.0.0/mcs/tools/xbuild/data/12.0/Microsoft.Common.targets.old mono-5.0.0/mcs/tools/xbuild/data/12.0/Microsoft.Common.targets
54+--- mono-5.0.0/mcs/tools/xbuild/data/12.0/Microsoft.Common.targets.old 2017-04-24 23:55:46.244895155 +0200
55++++ mono-5.0.0/mcs/tools/xbuild/data/12.0/Microsoft.Common.targets 2017-04-24 23:55:51.998961342 +0200
56+@@ -232,8 +232,8 @@
57+ $(ReferencePath);
58+ @(AdditionalReferencePath);
59+ {HintPathFromItem};
60+- {TargetFrameworkDirectory};
61+ {PkgConfig};
62++ {TargetFrameworkDirectory};
63+ {GAC};
64+ {RawFileName};
65+ $(OutDir)
pkgs/top-level/all-packages.nix+5
@@ -5751,6 +5751,11 @@ with pkgs;
57515751 inherit (darwin.apple_sdk.frameworks) Foundation;
57525752 });
57535753
5754+ mono50 = lowPrio (callPackage ../development/compilers/mono/5.0.nix {
5755+ inherit (darwin) libobjc;
5756+ inherit (darwin.apple_sdk.frameworks) Foundation;
5757+ });
5758+
57545759 monoDLLFixer = callPackage ../build-support/mono-dll-fixer { };
57555760
57565761 mozart-binary = callPackage ../development/compilers/mozart/binary.nix { };