lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

mono: add LLVM support (3.4svn build)

This adds LLVM support in Mono using their custom fork, based on LLVM
3.4svn upstream. Somehow, it's gone for a while without a patch to fix
the CMakeLists.txt in the fork...

The upstream commit is based on the mono3 branch.

Signed-off-by: Austin Seipp <aseipp@pobox.com>

+84 -5
+12
pkgs/development/compilers/mono/build-fix-llvm.patch
··· 1 + diff --git a/lib/CodeGen/AsmPrinter/CMakeLists.txt.old b/lib/CodeGen/AsmPrinter/CMakeLists.txt 2 + index be484a6..c92ff46 100644 3 + --- a/lib/CodeGen/AsmPrinter/CMakeLists.txt.old 4 + +++ b/lib/CodeGen/AsmPrinter/CMakeLists.txt 5 + @@ -10,6 +10,7 @@ add_llvm_library(LLVMAsmPrinter 6 + DwarfCompileUnit.cpp 7 + DwarfDebug.cpp 8 + DwarfException.cpp 9 + + DwarfMonoException.cpp 10 + ErlangGCPrinter.cpp 11 + OcamlGCPrinter.cpp 12 + Win64Exception.cpp
+13 -5
pkgs/development/compilers/mono/default.nix
··· 1 - {stdenv, fetchurl, bison, pkgconfig, glib, gettext, perl, libgdiplus, libX11}: 1 + { stdenv, fetchurl, bison, pkgconfig, glib, gettext, perl, libgdiplus, libX11, callPackage, ncurses, zlib, withLLVM ? true }: 2 2 3 + let 4 + llvm = callPackage ./llvm.nix { }; 5 + llvmOpts = stdenv.lib.optionalString withLLVM "--enable-llvm --enable-llvmloaded --with-llvm=${llvm}"; 6 + in 3 7 stdenv.mkDerivation rec { 4 8 name = "mono-${version}"; 5 9 version = "3.2.8"; ··· 8 12 sha256 = "0h0s42pmgrhwqaym0b1401h70dcpr179ngcsp7f8i4hl4snqrd7x"; 9 13 }; 10 14 11 - buildInputs = [bison pkgconfig glib gettext perl libgdiplus libX11]; 15 + buildInputs = [bison pkgconfig glib gettext perl libgdiplus libX11 ncurses zlib]; 12 16 propagatedBuildInputs = [glib]; 13 17 14 18 NIX_LDFLAGS = "-lgcc_s" ; ··· 18 22 19 23 # In fact I think this line does not help at all to what I 20 24 # wanted to achieve: have mono to find libgdiplus automatically 21 - configureFlags = "--x-includes=${libX11}/include --x-libraries=${libX11}/lib --with-libgdiplus=${libgdiplus}/lib/libgdiplus.so"; 25 + configureFlags = "--x-includes=${libX11}/include --x-libraries=${libX11}/lib --with-libgdiplus=${libgdiplus}/lib/libgdiplus.so ${llvmOpts}"; 22 26 23 27 # Attempt to fix this error when running "mcs --version": 24 28 # The file /nix/store/xxx-mono-2.4.2.1/lib/mscorlib.dll is an invalid CIL image ··· 27 31 # Parallel building doesn't work, as shows http://hydra.nixos.org/build/2983601 28 32 enableParallelBuilding = false; 29 33 30 - preBuild = " 34 + # Patch all the necessary scripts. Also, if we're using LLVM, we fix the default 35 + # LLVM path to point into the Mono LLVM build, since it's private anyway. 36 + preBuild = '' 31 37 makeFlagsArray=(INSTALL=`type -tp install`) 32 38 patchShebangs ./ 33 - "; 39 + '' + stdenv.lib.optionalString withLLVM '' 40 + substituteInPlace mono/mini/aot-compiler.c --replace "llvm_path = g_strdup (\"\")" "llvm_path = g_strdup (\"${llvm}/bin/\")" 41 + ''; 34 42 35 43 #Fix mono DLLMap so it can find libX11 and gdiplus to run winforms apps 36 44 #Other items in the DLLMap may need to be pointed to their store locations, I don't think this is exhaustive
+59
pkgs/development/compilers/mono/llvm.nix
··· 1 + { stdenv 2 + , fetchurl 3 + , perl 4 + , groff 5 + , cmake 6 + , python 7 + , libffi 8 + , binutils 9 + , libxml2 10 + , valgrind 11 + , ncurses 12 + , zlib 13 + }: 14 + 15 + stdenv.mkDerivation rec { 16 + name = "llvm-${version}"; 17 + version = "3.4svn-mono-f9b1a74368"; 18 + src = fetchurl { 19 + # from the HEAD of the 'mono3' branch 20 + url = "https://github.com/mono/llvm/archive/f9b1a74368ec299fc04c4cfef4b5aa0992b7b806.tar.gz"; 21 + name = "${name}.tar.gz"; 22 + sha256 = "1bbkx4p5zdnk3nbdd5jxvbwqx8cdq8z1n1nhf639i98mggs0zhdg"; 23 + }; 24 + 25 + patches = [ ./build-fix-llvm.patch ]; 26 + unpackPhase = '' 27 + unpackFile ${src} 28 + mv llvm-* llvm 29 + sourceRoot=$PWD/llvm 30 + ''; 31 + 32 + buildInputs = [ perl groff cmake libxml2 python libffi ] ++ stdenv.lib.optional stdenv.isLinux valgrind; 33 + 34 + propagatedBuildInputs = [ ncurses zlib ]; 35 + 36 + # hacky fix: created binaries need to be run before installation 37 + preBuild = '' 38 + mkdir -p $out/ 39 + ln -sv $PWD/lib $out 40 + ''; 41 + postBuild = "rm -fR $out"; 42 + 43 + cmakeFlags = with stdenv; [ 44 + "-DCMAKE_BUILD_TYPE=Release" 45 + "-DLLVM_ENABLE_FFI=ON" 46 + "-DLLVM_BINUTILS_INCDIR=${binutils}/include" 47 + "-DCMAKE_CXX_FLAGS=-std=c++11" 48 + ] ++ stdenv.lib.optional (!isDarwin) "-DBUILD_SHARED_LIBS=ON"; 49 + 50 + enableParallelBuilding = true; 51 + 52 + meta = { 53 + description = "Collection of modular and reusable compiler and toolchain technologies - Mono build"; 54 + homepage = http://llvm.org/; 55 + license = stdenv.lib.licenses.bsd3; 56 + maintainers = with stdenv.lib.maintainers; [ thoughtpolice ]; 57 + platforms = stdenv.lib.platforms.all; 58 + }; 59 + }