Unverified Commit 29e78f7c authored by David McFarland's avatar David McFarland Committed by GitHub
Browse files

avdump3: fix runtime on .NET 8 (#491267)

parents 19170f4d 3b97e45b
Loading
Loading
Loading
Loading
+27 −9
Original line number Diff line number Diff line
@@ -2,9 +2,12 @@
  lib,
  stdenv,
  fetchzip,
  autoPatchelfHook,
  makeBinaryWrapper,
  jq,
  dotnet-runtime,
  zlib,
  runtimeShell,
  libzen,
}:

stdenv.mkDerivation {
@@ -17,21 +20,36 @@ stdenv.mkDerivation {
    stripRoot = false;
  };

  nativeBuildInputs = [
    autoPatchelfHook
    makeBinaryWrapper
    jq
  ];

  buildInputs = [
    zlib
    libzen
    stdenv.cc.cc.lib
  ];

  installPhase = ''
    runHook preInstall

    mkdir -p $out/share/avdump3 $out/bin
    mv * $out/share/avdump3
    cat > $out/bin/avdump3 <<EOF
    #!${runtimeShell}
    export LD_LIBRARY_PATH="${lib.makeLibraryPath [ zlib ]}:\$LD_LIBRARY_PATH"
    exec ${dotnet-runtime}/bin/dotnet $out/share/avdump3/AVDump3CL.dll "\$@"
    EOF
    chmod +x $out/bin/avdump3

    # The app targets net6.0, which is EOL. Allow roll-forward to whatever
    # major version dotnet-runtime provides.
    jq '.runtimeOptions.rollForward = "major"' \
      $out/share/avdump3/AVDump3CL.runtimeconfig.json > tmp.json
    mv tmp.json $out/share/avdump3/AVDump3CL.runtimeconfig.json

    makeBinaryWrapper ${dotnet-runtime}/bin/dotnet $out/bin/avdump3 \
      --add-flags $out/share/avdump3/AVDump3CL.dll

    runHook postInstall
  '';

  dontPatchELF = true;

  meta = {
    mainProgram = "avdump3";
    description = "Tool for extracting audio/video metadata from media files and uploading it to AniDB";