nixpkgs/pkgs/development/tools/analysis/qcachegrind/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

45 lines
1.4 KiB
Nix

{ lib, stdenv, qmake, qtbase, perl, php, kcachegrind, wrapQtAppsHook }:
stdenv.mkDerivation {
pname = "qcachegrind";
version = kcachegrind.version;
src = kcachegrind.src;
buildInputs = [ qtbase perl php ];
nativeBuildInputs = [ qmake wrapQtAppsHook ];
dontWrapQtApps = true;
postInstall = ''
mkdir -p $out/bin
cp -p converters/dprof2calltree $out/bin/dprof2calltree
cp -p converters/memprof2calltree $out/bin/memprof2calltree
cp -p converters/op2calltree $out/bin/op2calltree
cp -p converters/pprof2calltree $out/bin/pprof2calltree
chmod -R +x $out/bin/
'' + (if stdenv.hostPlatform.isDarwin then ''
mkdir -p $out/Applications
cp cgview/cgview.app/Contents/MacOS/cgview $out/bin
cp -a qcachegrind/qcachegrind.app $out/Applications
'' else ''
install qcachegrind/qcachegrind cgview/cgview -t "$out/bin"
install -Dm644 qcachegrind/qcachegrind.desktop -t "$out/share/applications"
install -Dm644 kcachegrind/32-apps-kcachegrind.png "$out/share/icons/hicolor/32x32/apps/kcachegrind.png"
install -Dm644 kcachegrind/48-apps-kcachegrind.png "$out/share/icons/hicolor/48x48/apps/kcachegrind.png"
'');
preFixup = ''
wrapQtApp "$out/bin/qcachegrind"
'';
meta = with lib; {
broken = stdenv.hostPlatform.isDarwin;
description = "Qt GUI to visualize profiling data";
license = licenses.gpl2Plus;
platforms = platforms.unix;
maintainers = with maintainers; [ periklis ];
};
}