Unverified Commit baa013b6 authored by Gaétan Lepage's avatar Gaétan Lepage Committed by GitHub
Browse files

apitrace: add enableGui option (#366643)

parents 579b3f42 a101d383
Loading
Loading
Loading
Loading
+60 −46
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
  libglvnd,
  gtest,
  brotli,
  enableGui ? true,
}:

stdenv.mkDerivation rec {
@@ -29,27 +30,38 @@ stdenv.mkDerivation rec {

  # LD_PRELOAD wrappers need to be statically linked to work against all kinds
  # of games -- so it's fine to use e.g. bundled snappy.
  buildInputs = [
  buildInputs =
    [
      libX11
      procps
    python3
      libdwarf
    qtbase
      gtest
      brotli
    ]
    ++ lib.optionals enableGui [
      qtbase
    ];

  nativeBuildInputs = [
  nativeBuildInputs =
    [
      cmake
      pkg-config
      python3
    ]
    ++ lib.optionals enableGui [
      wrapQtAppsHook
    ];

  cmakeFlags = [
    (lib.cmakeBool "ENABLE_GUI" enableGui)
  ];

  # Don't automatically wrap all binaries, I prefer to explicitly only wrap
  # `qapitrace`.
  dontWrapQtApps = true;

  postFixup = ''
  postFixup =
    ''

      # Since https://github.com/NixOS/nixpkgs/pull/60985, we add `/run-opengl-driver[-32]`
      # to the `RUNPATH` of dispatcher libraries `dlopen()` ing OpenGL drivers.
@@ -83,6 +95,8 @@ stdenv.mkDerivation rec {
        patchelf --set-rpath "${lib.makeLibraryPath [ libglvnd ]}:$(patchelf --print-rpath $i)" $i
      done

    ''
    + lib.optionalString enableGui ''
      wrapQtApp $out/bin/qapitrace
    '';