From 4a5d03c5b03b5468a414b6d797e0d1ed30e25871 Mon Sep 17 00:00:00 2001 From: Benjamin Sparks Date: Fri, 21 Mar 2025 22:58:49 +0100 Subject: [PATCH 1/2] mono: remove llvm build --- pkgs/development/compilers/mono/generic.nix | 35 ++++------- pkgs/development/compilers/mono/llvm.nix | 64 --------------------- 2 files changed, 10 insertions(+), 89 deletions(-) delete mode 100644 pkgs/development/compilers/mono/llvm.nix diff --git a/pkgs/development/compilers/mono/generic.nix b/pkgs/development/compilers/mono/generic.nix index 087d79cd04cc2..b84d8a6f574f8 100644 --- a/pkgs/development/compilers/mono/generic.nix +++ b/pkgs/development/compilers/mono/generic.nix @@ -9,11 +9,9 @@ perl, libgdiplus, libX11, - callPackage, ncurses, zlib, bash, - withLLVM ? false, cacert, Foundation, libobjc, @@ -32,9 +30,6 @@ env ? { }, }: -let - llvm = callPackage ./llvm.nix { }; -in stdenv.mkDerivation rec { pname = "mono"; inherit version env; @@ -72,16 +67,11 @@ stdenv.mkDerivation rec { libobjc ]; - configureFlags = - [ - "--x-includes=${libX11.dev}/include" - "--x-libraries=${libX11.out}/lib" - "--with-libgdiplus=${libgdiplus}/lib/libgdiplus.so" - ] - ++ lib.optionals withLLVM [ - "--enable-llvm" - "--with-llvm=${llvm}" - ]; + configureFlags = [ + "--x-includes=${libX11.dev}/include" + "--x-libraries=${libX11.out}/lib" + "--with-libgdiplus=${libgdiplus}/lib/libgdiplus.so" + ]; configurePhase = '' patchShebangs autogen.sh mcs/build/start-compiler-server.sh @@ -92,16 +82,11 @@ stdenv.mkDerivation rec { # because we control pkg-config patches = [ ./pkgconfig-before-gac.patch ] ++ extraPatches; - # Patch all the necessary scripts. Also, if we're using LLVM, we fix the default - # LLVM path to point into the Mono LLVM build, since it's private anyway. - preBuild = - '' - makeFlagsArray=(INSTALL=`type -tp install`) - substituteInPlace mcs/class/corlib/System/Environment.cs --replace /usr/share "$out/share" - '' - + lib.optionalString withLLVM '' - substituteInPlace mono/mini/aot-compiler.c --replace "llvm_path = g_strdup (\"\")" "llvm_path = g_strdup (\"${llvm}/bin/\")" - ''; + # Patch all the necessary scripts + preBuild = '' + makeFlagsArray=(INSTALL=`type -tp install`) + substituteInPlace mcs/class/corlib/System/Environment.cs --replace /usr/share "$out/share" + ''; # Fix mono DLLMap so it can find libX11 to run winforms apps # libgdiplus is correctly handled by the --with-libgdiplus configure flag diff --git a/pkgs/development/compilers/mono/llvm.nix b/pkgs/development/compilers/mono/llvm.nix deleted file mode 100644 index 27ddb96d9b05e..0000000000000 --- a/pkgs/development/compilers/mono/llvm.nix +++ /dev/null @@ -1,64 +0,0 @@ -{ - stdenv, - lib, - fetchFromGitHub, - groff, - cmake, - python2, - perl, - libffi, - libbfd, - libxml2, - valgrind, - ncurses, - zlib, -}: - -stdenv.mkDerivation { - pname = "llvm"; - version = "3.6-mono-2017-02-15"; - - src = fetchFromGitHub { - owner = "mono"; - repo = "llvm"; - rev = "dbb6fdffdeb780d11851a6be77c209bd7ada4bd3"; - sha256 = "07wd1cs3fdvzb1lv41b655z5zk34f47j8fgd9ljjimi5j9pj71f7"; - }; - - nativeBuildInputs = [ cmake ]; - buildInputs = [ - perl - groff - libxml2 - python2 - libffi - ] ++ lib.optional stdenv.hostPlatform.isLinux valgrind; - - propagatedBuildInputs = [ - ncurses - zlib - ]; - - # hacky fix: created binaries need to be run before installation - preBuild = '' - mkdir -p $out/ - ln -sv $PWD/lib $out - ''; - postBuild = "rm -fR $out"; - - cmakeFlags = - with stdenv; - [ - "-DLLVM_ENABLE_FFI=ON" - "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include" - ] - ++ lib.optional (!isDarwin) "-DBUILD_SHARED_LIBS=ON"; - - meta = { - description = "Collection of modular and reusable compiler and toolchain technologies - Mono build"; - homepage = "http://llvm.org/"; - license = lib.licenses.bsd3; - maintainers = with lib.maintainers; [ thoughtpolice ]; - platforms = lib.platforms.all; - }; -} From bf6a2d24fbd142cf0f8b69145f70f37bae43350a Mon Sep 17 00:00:00 2001 From: Benjamin Sparks Date: Sun, 30 Mar 2025 01:08:46 +0100 Subject: [PATCH 2/2] mono: prefer replace-fail --- pkgs/development/compilers/mono/generic.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/compilers/mono/generic.nix b/pkgs/development/compilers/mono/generic.nix index b84d8a6f574f8..56547ece52e6c 100644 --- a/pkgs/development/compilers/mono/generic.nix +++ b/pkgs/development/compilers/mono/generic.nix @@ -85,7 +85,7 @@ stdenv.mkDerivation rec { # Patch all the necessary scripts preBuild = '' makeFlagsArray=(INSTALL=`type -tp install`) - substituteInPlace mcs/class/corlib/System/Environment.cs --replace /usr/share "$out/share" + substituteInPlace mcs/class/corlib/System/Environment.cs --replace-fail /usr/share "$out/share" ''; # Fix mono DLLMap so it can find libX11 to run winforms apps