From a605b54b38285b790ac87da983036cb64a5de288 Mon Sep 17 00:00:00 2001 From: Rahul Gopinath Date: Sun, 3 Jul 2016 12:32:46 -0700 Subject: [PATCH] mono: refactor and cleanup Refactor and cleanup in preparation for mono44 --- pkgs/development/compilers/mono/default.nix | 33 +++++++++++++-------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/pkgs/development/compilers/mono/default.nix b/pkgs/development/compilers/mono/default.nix index 54e76c731a1..123ffa57ac0 100644 --- a/pkgs/development/compilers/mono/default.nix +++ b/pkgs/development/compilers/mono/default.nix @@ -1,19 +1,20 @@ -{ stdenv, fetchurl, bison, pkgconfig, glib, gettext, perl, libgdiplus, libX11, callPackage, ncurses, zlib, withLLVM ? false, cacert, Foundation, libobjc }: +{ stdenv, fetchurl, bison, pkgconfig, glib, gettext, perl, libgdiplus, libX11, callPackage, ncurses, zlib, withLLVM ? false, cacert, Foundation, libobjc, python }: let llvm = callPackage ./llvm.nix { }; - llvmOpts = stdenv.lib.optionalString withLLVM "--enable-llvm --enable-llvmloaded --with-llvm=${llvm}"; + sha256 = "1ydw9l89apc9p7xr5mdzy0h97g2q6v243g82mxswfc2rrqhfs4gd"; + version = "4.0.4.1"; in stdenv.mkDerivation rec { name = "mono-${version}"; - version = "4.0.4.1"; + src = fetchurl { + inherit sha256; url = "http://download.mono-project.com/sources/mono/${name}.tar.bz2"; - sha256 = "1ydw9l89apc9p7xr5mdzy0h97g2q6v243g82mxswfc2rrqhfs4gd"; }; buildInputs = - [ bison pkgconfig glib gettext perl libgdiplus libX11 ncurses zlib + [ bison pkgconfig glib gettext perl libgdiplus libX11 ncurses zlib python ] ++ (stdenv.lib.optionals stdenv.isDarwin [ Foundation libobjc ]); @@ -26,7 +27,16 @@ stdenv.mkDerivation rec { # In fact I think this line does not help at all to what I # wanted to achieve: have mono to find libgdiplus automatically - configureFlags = "--x-includes=${libX11.dev}/include --x-libraries=${libX11.out}/lib --with-libgdiplus=${libgdiplus}/lib/libgdiplus.so ${llvmOpts}"; + configureFlags = [ + "--x-includes=${libX11.dev}/include" + "--x-libraries=${libX11.out}/lib" + "--with-libgdiplus=${libgdiplus}/lib/libgdiplus.so" + ] + ++ stdenv.lib.optionals withLLVM [ + "--enable-llvm" + "--enable-llvmloaded" + "--with-llvm=${llvm}" + ]; # Attempt to fix this error when running "mcs --version": # The file /nix/store/xxx-mono-2.4.2.1/lib/mscorlib.dll is an invalid CIL image @@ -53,13 +63,12 @@ stdenv.mkDerivation rec { # Other items in the DLLMap may need to be pointed to their store locations, I don't think this is exhaustive # http://www.mono-project.com/Config_DllMap postBuild = '' - find . -name 'config' -type f | while read i; do - sed -i "s@libX11.so.6@${libX11.out}/lib/libX11.so.6@g" $i - sed -i "s@/.*libgdiplus.so@${libgdiplus}/lib/libgdiplus.so@g" $i - done + find . -name 'config' -type f | xargs \ + sed -i -e "s@libX11.so.6@${libX11.out}/lib/libX11.so.6@g" \ + -e "s@/.*libgdiplus.so@${libgdiplus}/lib/libgdiplus.so@g" \ ''; - # Without this, any Mono application attempting to open an SSL connection will throw with + # 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 = '' @@ -76,7 +85,7 @@ stdenv.mkDerivation rec { homepage = http://mono-project.com/; description = "Cross platform, open source .NET development framework"; platforms = with stdenv.lib.platforms; darwin ++ linux; - maintainers = with stdenv.lib.maintainers; [ viric thoughtpolice obadz ]; + maintainers = with stdenv.lib.maintainers; [ viric thoughtpolice obadz vrthra ]; license = stdenv.lib.licenses.free; # Combination of LGPL/X11/GPL ? }; }