Unverified Commit 2726f38d authored by Weijia Wang's avatar Weijia Wang Committed by GitHub
Browse files

Merge pull request #310081 from pluiedev/zhf-24.05/async-profiler

async-profiler: 2.9 -> 3.0, migrate to by-name & modernize
parents 8e9fc102 46a3798b
Loading
Loading
Loading
Loading
+46 −0
Original line number Diff line number Diff line
{ lib, stdenv, fetchFromGitHub, jdk, makeWrapper }:

{
  lib,
  stdenv,
  fetchFromGitHub,
  jdk,
  makeWrapper,
}:
stdenv.mkDerivation rec {
  pname = "async-profiler";
  version = "2.9";
  version = "3.0";

  src = fetchFromGitHub {
    owner = "jvm-profiling-tools";
    repo = "async-profiler";
    rev = "v${version}";
    sha256 = "sha256-ngLUg6Fq6Ay06klGa/y8lod8W6rYMqhMhXFn5OBCSpk=";
    hash = "sha256-0CCJoRjRLq4LpiRD0ibzK8So9qSQymePCTYUI60Oy2k=";
  };

  nativeBuildInputs = [ makeWrapper ];

  buildInputs = [ jdk ];

  installPhase = ''
  installPhase =
    let
      ext = stdenv.hostPlatform.extensions.sharedLibrary;
    in
    ''
      runHook preInstall
    install -D "$src/profiler.sh" "$out/bin/async-profiler"
    install -D build/jattach "$out/bin/jattach"
    install -D build/libasyncProfiler.so "$out/lib/libasyncProfiler.so"
    install -D -t "$out/share/java/" build/*.jar
      install -D build/bin/asprof "$out/bin/async-profiler"
      install -D build/lib/libasyncProfiler${ext} "$out/lib/libasyncProfiler${ext}"
      runHook postInstall
    '';

  fixupPhase = ''
    substituteInPlace $out/bin/async-profiler \
      --replace 'JATTACH=$SCRIPT_DIR/build/jattach' \
                'JATTACH=${placeholder "out"}/bin/jattach' \
      --replace 'PROFILER=$SCRIPT_DIR/build/libasyncProfiler.so' \
                'PROFILER=${placeholder "out"}/lib/libasyncProfiler.so'

    wrapProgram $out/bin/async-profiler --prefix PATH : ${lib.makeBinPath [ jdk ]}
  '';

@@ -40,5 +41,6 @@ stdenv.mkDerivation rec {
    license = licenses.asl20;
    maintainers = with maintainers; [ mschuwalow ];
    platforms = platforms.all;
    mainProgram = "async-profiler";
  };
}
+0 −2
Original line number Diff line number Diff line
@@ -3310,8 +3310,6 @@ with pkgs;
  async = callPackage ../development/tools/async { };
  async-profiler = callPackage ../development/tools/async-profiler { };
  atheme = callPackage ../servers/irc/atheme { };
  atinout = callPackage ../tools/networking/atinout { };