nixpkgs/pkgs/development/tools/tracy/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

112 lines
3.8 KiB
Nix
Raw Normal View History

2023-04-06 08:23:06 +00:00
{ lib
, stdenv
, fetchFromGitHub
2023-10-17 08:00:32 +00:00
2023-04-06 08:23:06 +00:00
, capstone
2023-10-17 08:00:32 +00:00
, darwin
, dbus
2023-04-06 08:23:06 +00:00
, freetype
, glfw
, hicolor-icon-theme
2023-10-17 08:00:32 +00:00
, pkg-config
2023-04-06 08:23:06 +00:00
, tbb
2022-04-26 22:40:31 +00:00
}:
2020-06-03 08:33:25 +00:00
2023-04-06 08:23:06 +00:00
stdenv.mkDerivation rec {
pname = "tracy";
2023-10-17 08:08:15 +00:00
version = "0.10";
2020-06-03 08:33:25 +00:00
src = fetchFromGitHub {
owner = "wolfpld";
repo = "tracy";
rev = "v${version}";
2023-10-17 08:08:15 +00:00
sha256 = "sha256-DN1ExvQ5wcIUyhMAfiakFbZkDsx+5l8VMtYGvSdboPA=";
2020-06-03 08:33:25 +00:00
};
2023-04-06 08:23:06 +00:00
patches = lib.optionals (stdenv.isDarwin && !(lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11")) [
./0001-remove-unifiedtypeidentifiers-framework
];
nativeBuildInputs = [ pkg-config ];
2020-06-03 08:33:25 +00:00
2023-04-06 08:23:06 +00:00
buildInputs = [
capstone
freetype
glfw
] ++ lib.optionals stdenv.isLinux [
dbus
hicolor-icon-theme
tbb
] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.AppKit
darwin.apple_sdk.frameworks.Carbon
] ++ lib.optionals (stdenv.isDarwin && lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11") [
darwin.apple_sdk.frameworks.UniformTypeIdentifiers
];
2020-06-03 08:33:25 +00:00
env.NIX_CFLAGS_COMPILE = toString ([ ]
2021-09-05 21:55:45 +00:00
# Apple's compiler finds a format string security error on
# ../../../server/TracyView.cpp:649:34, preventing building.
++ lib.optional stdenv.isDarwin "-Wno-format-security"
2020-06-03 08:33:25 +00:00
++ lib.optional stdenv.isLinux "-ltbb"
2021-04-05 15:26:01 +00:00
++ lib.optional stdenv.cc.isClang "-faligned-allocation"
2023-10-17 08:00:32 +00:00
# workaround issue #19098
++ lib.optional (stdenv.cc.isClang && stdenv.isDarwin) "-fno-lto");
2021-04-05 15:26:01 +00:00
2020-06-03 08:33:25 +00:00
buildPhase = ''
2023-04-06 08:23:06 +00:00
runHook preBuild
2023-10-17 08:36:33 +00:00
make -j $NIX_BUILD_CORES -C capture/build/unix release
make -j $NIX_BUILD_CORES -C csvexport/build/unix release
make -j $NIX_BUILD_CORES -C import-chrome/build/unix release
make -j $NIX_BUILD_CORES -C library/unix release
make -j $NIX_BUILD_CORES -C profiler/build/unix release LEGACY=1
2023-10-17 08:36:33 +00:00
make -j $NIX_BUILD_CORES -C update/build/unix release
2023-04-06 08:23:06 +00:00
runHook postBuild
2020-06-03 08:33:25 +00:00
'';
installPhase = ''
2023-04-06 08:23:06 +00:00
runHook preInstall
2023-10-17 08:36:33 +00:00
install -D -m 0755 capture/build/unix/capture-release $out/bin/capture
install -D -m 0755 csvexport/build/unix/csvexport-release $out/bin/tracy-csvexport
install -D -m 0755 import-chrome/build/unix/import-chrome-release $out/bin/import-chrome
install -D -m 0755 library/unix/libtracy-release.so $out/lib/libtracy.so
install -D -m 0755 profiler/build/unix/Tracy-release $out/bin/tracy
install -D -m 0755 update/build/unix/update-release $out/bin/update
2023-04-06 08:23:06 +00:00
2023-10-17 08:36:33 +00:00
mkdir -p $out/include/Tracy/client
mkdir -p $out/include/Tracy/common
mkdir -p $out/include/Tracy/tracy
cp -p public/client/*.{h,hpp} $out/include/Tracy/client
cp -p public/common/*.{h,hpp} $out/include/Tracy/common
cp -p public/tracy/*.{h,hpp} $out/include/Tracy/tracy
'' + lib.optionalString stdenv.isLinux ''
substituteInPlace extra/desktop/tracy.desktop \
--replace Exec=/usr/bin/tracy Exec=tracy
install -D -m 0644 extra/desktop/application-tracy.xml $out/share/mime/packages/application-tracy.xml
install -D -m 0644 extra/desktop/tracy.desktop $out/share/applications/tracy.desktop
install -D -m 0644 icon/application-tracy.svg $out/share/icons/hicolor/scalable/apps/application-tracy.svg
install -D -m 0644 icon/icon.png $out/share/icons/hicolor/256x256/apps/tracy.png
install -D -m 0644 icon/icon.svg $out/share/icons/hicolor/scalable/apps/tracy.svg
'' + ''
2023-04-06 08:23:06 +00:00
runHook postInstall
2020-06-03 08:33:25 +00:00
'';
postFixup = lib.optionalString stdenv.isDarwin ''
2023-10-17 08:36:33 +00:00
install_name_tool -change libcapstone.4.dylib ${capstone}/lib/libcapstone.4.dylib $out/bin/tracy
2020-08-27 00:04:54 +00:00
'';
meta = with lib; {
description = "A real time, nanosecond resolution, remote telemetry frame profiler for games and other applications";
2020-06-03 08:33:25 +00:00
homepage = "https://github.com/wolfpld/tracy";
platforms = platforms.linux ++ platforms.darwin;
license = licenses.bsd3;
2023-10-17 08:36:33 +00:00
mainProgram = "tracy";
2023-10-17 08:00:32 +00:00
maintainers = with maintainers; [ mpickering nagisa paveloom ];
2020-06-03 08:33:25 +00:00
};
}