From 4bf5bf18a14bc5543f7f348b84dd0ac7feeec49e Mon Sep 17 00:00:00 2001 From: David McFarland Date: Sat, 4 May 2024 20:01:27 -0300 Subject: [PATCH] dotnet: fix RPATH in ilcompiler output --- .../compilers/dotnet/build-dotnet.nix | 26 +++++++++++++++---- .../development/compilers/dotnet/packages.nix | 2 ++ 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/pkgs/development/compilers/dotnet/build-dotnet.nix b/pkgs/development/compilers/dotnet/build-dotnet.nix index 11ece5397166..25bf78d9a054 100644 --- a/pkgs/development/compilers/dotnet/build-dotnet.nix +++ b/pkgs/development/compilers/dotnet/build-dotnet.nix @@ -18,6 +18,7 @@ assert if type == "sdk" then packages != null else true; , libuuid , zlib , libkrb5 +, openssl , curl , lttng-ust_2_12 , testers @@ -51,6 +52,20 @@ let sigtool = callPackage ./sigtool.nix {}; signAppHost = callPackage ./sign-apphost.nix {}; + hasILCompiler = lib.versionAtLeast version "7"; + + extraTargets = writeText "extra.targets" ('' + + '' + lib.optionalString hasILCompiler '' + + + + '' + lib.optionalString stdenv.isDarwin '' + + '' + '' + + ''); + in mkCommon type rec { inherit pname version; @@ -70,6 +85,7 @@ mkCommon type rec { icu libkrb5 curl + xmlstarlet ] ++ lib.optional stdenv.isLinux lttng-ust_2_12; src = fetchurl ( @@ -79,15 +95,15 @@ mkCommon type rec { sourceRoot = "."; - postPatch = if type == "sdk" && stdenv.isDarwin then '' + postPatch = if type == "sdk" then ('' xmlstarlet ed \ --inplace \ -s //_:Project -t elem -n Import \ - -i \$prev -t attr -n Project -v "${signAppHost}" \ + -i \$prev -t attr -n Project -v "${extraTargets}" \ sdk/*/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets - + '' + lib.optionalString stdenv.isDarwin '' codesign --remove-signature packs/Microsoft.NETCore.App.Host.osx-*/*/runtimes/osx-*/native/{apphost,singlefilehost} - '' else null; + '') else null; dontPatchELF = true; noDumpEnvVars = true; @@ -135,7 +151,7 @@ mkCommon type rec { ''; passthru = { - inherit icu; + inherit icu hasILCompiler; } // lib.optionalAttrs (type == "sdk") { packages = mkNugetDeps { name = "${pname}-${version}-deps"; diff --git a/pkgs/development/compilers/dotnet/packages.nix b/pkgs/development/compilers/dotnet/packages.nix index 4ce789e00b91..4e82e80a044f 100644 --- a/pkgs/development/compilers/dotnet/packages.nix +++ b/pkgs/development/compilers/dotnet/packages.nix @@ -37,6 +37,8 @@ in { passthru = { inherit (vmr) icu targetRid; + # ilcompiler is currently broken: https://github.com/dotnet/source-build/issues/1215 + hasILCompiler = false; }; meta = vmr.meta // {