mono: refactor and cleanup

Refactor and cleanup in preparation for mono44
This commit is contained in:
Rahul Gopinath 2016-07-03 12:32:46 -07:00 committed by Bjørn Forsman
parent 01b8db1bc7
commit a605b54b38

View file

@ -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 ?
};
}