git.iko.soy/typeable/nixpkgs
on master help sign in
Scaffold mono50 package
commit80bc82206ef27f5e39f9b12fc925a9b976645a5c authorRoman Kuznetsov <roman@kuznero.com> dateMon 24 Apr 2017, 21:20 (10 years ago) parent26f47d1
4 files changed+167
pkgs/development/compilers/mono/5.0.nix+7 pkgs/development/compilers/mono/generic-5x.nix+90 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-5x.nix (rec {
4+ inherit Foundation libobjc;
5+ version = "5.0.0.48";
6+ sha256 = "13n20wmijkhd7vm41lzz1n774rna67d94prl33bz1lly0idsciq0";
7+})
pkgs/development/compilers/mono/generic-5x.nixnew file+90
@@ -0,0 +1,90 @@
1+{ stdenv, fetchurl, bison, pkgconfig, glib, gettext, perl, libgdiplus, libX11, callPackage, ncurses, zlib, withLLVM ? false, cacert, Foundation, libobjc, python, version, sha256, cmake, autoconf, libtool, automake, gcc }:
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 = "https://download.mono-project.com/sources/mono/${name}.tar.bz2";
12+ };
13+
14+ buildInputs =
15+ [ bison pkgconfig glib gettext perl libgdiplus libX11 ncurses zlib python cmake autoconf libtool automake gcc
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+ # Attempt to fix this error when running "mcs --version":
40+ # The file /nix/store/xxx-mono-2.4.2.1/lib/mscorlib.dll is an invalid CIL image
41+ dontStrip = true;
42+
43+ # Parallel building doesn't work, as shows http://hydra.nixos.org/build/2983601
44+ enableParallelBuilding = false;
45+
46+ # We want pkg-config to take priority over the dlls in the Mono framework and the GAC
47+ # because we control pkg-config
48+ patches = [ ./pkgconfig-before-gac-5x.patch ];
49+
50+ # Patch all the necessary scripts. Also, if we're using LLVM, we fix the default
51+ # LLVM path to point into the Mono LLVM build, since it's private anyway.
52+ preBuild = ''
53+ makeFlagsArray=(INSTALL=`type -tp install`)
54+ patchShebangs ./
55+ substituteInPlace mcs/class/corlib/System/Environment.cs --replace /usr/share "$out/share"
56+ '' + stdenv.lib.optionalString withLLVM ''
57+ substituteInPlace mono/mini/aot-compiler.c --replace "llvm_path = g_strdup (\"\")" "llvm_path = g_strdup (\"${llvm}/bin/\")"
58+ echo 11111
59+ '';
60+
61+ # Fix mono DLLMap so it can find libX11 and gdiplus to run winforms apps
62+ # Other items in the DLLMap may need to be pointed to their store locations, I don't think this is exhaustive
63+ # http://www.mono-project.com/Config_DllMap
64+ postBuild = ''
65+ find . -name 'config' -type f | xargs \
66+ sed -i -e "s@libX11.so.6@${libX11.out}/lib/libX11.so.6@g" \
67+ -e "s@/.*libgdiplus.so@${libgdiplus}/lib/libgdiplus.so@g" \
68+ '';
69+
70+ # Without this, any Mono application attempting to open an SSL connection will throw with
71+ # The authentication or decryption has failed.
72+ # ---> Mono.Security.Protocol.Tls.TlsException: Invalid certificate received from server.
73+ postInstall = ''
74+ echo "Updating Mono key store"
75+ $out/bin/cert-sync ${cacert}/etc/ssl/certs/ca-bundle.crt
76+ ''
77+ # According to [1], gmcs is just mcs
78+ # [1] https://github.com/mono/mono/blob/master/scripts/gmcs.in
79+ + ''
80+ ln -s $out/bin/mcs $out/bin/gmcs
81+ '';
82+
83+ meta = {
84+ homepage = http://mono-project.com/;
85+ description = "Cross platform, open source .NET development framework";
86+ platforms = with stdenv.lib.platforms; darwin ++ linux;
87+ maintainers = with stdenv.lib.maintainers; [ viric thoughtpolice obadz vrthra ];
88+ license = stdenv.lib.licenses.free; # Combination of LGPL/X11/GPL ?
89+ };
90+}
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
@@ -5742,6 +5742,11 @@ with pkgs;
57425742 inherit (darwin.apple_sdk.frameworks) Foundation;
57435743 });
57445744
5745+ mono50 = lowPrio (callPackage ../development/compilers/mono/5.0.nix {
5746+ inherit (darwin) libobjc;
5747+ inherit (darwin.apple_sdk.frameworks) Foundation;
5748+ });
5749+
57455750 monoDLLFixer = callPackage ../build-support/mono-dll-fixer { };
57465751
57475752 mozart-binary = callPackage ../development/compilers/mozart/binary.nix { };