|
|
|
@@ -3,130 +3,135 @@
|
|
|
|
|
stdenv,
|
|
|
|
|
fetchFromGitHub,
|
|
|
|
|
|
|
|
|
|
cmake,
|
|
|
|
|
ninja,
|
|
|
|
|
pkg-config,
|
|
|
|
|
wayland-scanner,
|
|
|
|
|
|
|
|
|
|
capstone,
|
|
|
|
|
darwin,
|
|
|
|
|
dbus,
|
|
|
|
|
freetype,
|
|
|
|
|
glfw,
|
|
|
|
|
hicolor-icon-theme,
|
|
|
|
|
pkg-config,
|
|
|
|
|
tbb,
|
|
|
|
|
|
|
|
|
|
withGtkFileSelector ? false,
|
|
|
|
|
gtk3,
|
|
|
|
|
|
|
|
|
|
withWayland ? stdenv.hostPlatform.isLinux,
|
|
|
|
|
libglvnd,
|
|
|
|
|
libxkbcommon,
|
|
|
|
|
wayland,
|
|
|
|
|
wayland-protocols,
|
|
|
|
|
}:
|
|
|
|
|
|
|
|
|
|
assert withGtkFileSelector -> stdenv.isLinux;
|
|
|
|
|
assert withWayland -> stdenv.isLinux;
|
|
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
|
pname = "tracy";
|
|
|
|
|
version = "0.10";
|
|
|
|
|
pname = if withWayland then "tracy-wayland" else "tracy-glfw";
|
|
|
|
|
version = "0.11.1";
|
|
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
|
owner = "wolfpld";
|
|
|
|
|
repo = "tracy";
|
|
|
|
|
rev = "v${version}";
|
|
|
|
|
hash = "sha256-DN1ExvQ5wcIUyhMAfiakFbZkDsx+5l8VMtYGvSdboPA=";
|
|
|
|
|
hash = "sha256-HofqYJT1srDJ6Y1f18h7xtAbI/Gvvz0t9f0wBNnOZK8=";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
patches =
|
|
|
|
|
lib.optionals
|
|
|
|
|
(stdenv.hostPlatform.isDarwin && !(lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11"))
|
|
|
|
|
[
|
|
|
|
|
./0001-remove-unifiedtypeidentifiers-framework
|
|
|
|
|
];
|
|
|
|
|
patches = lib.optional (
|
|
|
|
|
stdenv.hostPlatform.isDarwin && lib.versionOlder stdenv.hostPlatform.darwinMinVersion "11"
|
|
|
|
|
) ./dont-use-the-uniformtypeidentifiers-framework.patch;
|
|
|
|
|
|
|
|
|
|
nativeBuildInputs = [ pkg-config ];
|
|
|
|
|
nativeBuildInputs =
|
|
|
|
|
[
|
|
|
|
|
cmake
|
|
|
|
|
ninja
|
|
|
|
|
pkg-config
|
|
|
|
|
]
|
|
|
|
|
++ lib.optionals stdenv.isLinux [ wayland-scanner ]
|
|
|
|
|
++ lib.optionals stdenv.cc.isClang [ stdenv.cc.cc.libllvm ];
|
|
|
|
|
|
|
|
|
|
buildInputs =
|
|
|
|
|
[
|
|
|
|
|
capstone
|
|
|
|
|
freetype
|
|
|
|
|
glfw
|
|
|
|
|
]
|
|
|
|
|
++ lib.optionals (stdenv.hostPlatform.isLinux && withWayland) [
|
|
|
|
|
libxkbcommon
|
|
|
|
|
wayland
|
|
|
|
|
]
|
|
|
|
|
++ lib.optionals stdenv.hostPlatform.isLinux [
|
|
|
|
|
dbus
|
|
|
|
|
hicolor-icon-theme
|
|
|
|
|
tbb
|
|
|
|
|
]
|
|
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
|
|
|
|
darwin.apple_sdk.frameworks.AppKit
|
|
|
|
|
darwin.apple_sdk.frameworks.Carbon
|
|
|
|
|
++ lib.optionals (stdenv.hostPlatform.isLinux && withGtkFileSelector) [ gtk3 ]
|
|
|
|
|
++ lib.optionals (stdenv.hostPlatform.isLinux && !withGtkFileSelector) [ dbus ]
|
|
|
|
|
++ lib.optionals (stdenv.hostPlatform.isLinux && withWayland) [
|
|
|
|
|
libglvnd
|
|
|
|
|
libxkbcommon
|
|
|
|
|
wayland
|
|
|
|
|
wayland-protocols
|
|
|
|
|
]
|
|
|
|
|
++
|
|
|
|
|
lib.optionals
|
|
|
|
|
(stdenv.hostPlatform.isDarwin && lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11")
|
|
|
|
|
[
|
|
|
|
|
darwin.apple_sdk.frameworks.UniformTypeIdentifiers
|
|
|
|
|
];
|
|
|
|
|
++ lib.optionals (stdenv.hostPlatform.isDarwin || (stdenv.hostPlatform.isLinux && !withWayland)) [
|
|
|
|
|
glfw
|
|
|
|
|
]
|
|
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.AppKit ]
|
|
|
|
|
++ lib.optionals (
|
|
|
|
|
stdenv.hostPlatform.isDarwin && lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11"
|
|
|
|
|
) [ darwin.apple_sdk.frameworks.UniformTypeIdentifiers ];
|
|
|
|
|
|
|
|
|
|
cmakeFlags =
|
|
|
|
|
[
|
|
|
|
|
"-DDOWNLOAD_CAPSTONE=off"
|
|
|
|
|
"-DTRACY_STATIC=off"
|
|
|
|
|
]
|
|
|
|
|
++ lib.optional (stdenv.isLinux && withGtkFileSelector) "-DGTK_FILESELECTOR=ON"
|
|
|
|
|
++ lib.optional (stdenv.isLinux && !withWayland) "-DLEGACY=on";
|
|
|
|
|
|
|
|
|
|
env.NIX_CFLAGS_COMPILE = toString (
|
|
|
|
|
[ ]
|
|
|
|
|
# Apple's compiler finds a format string security error on
|
|
|
|
|
# ../../../server/TracyView.cpp:649:34, preventing building.
|
|
|
|
|
++ lib.optional stdenv.hostPlatform.isDarwin "-Wno-format-security"
|
|
|
|
|
++ lib.optional stdenv.hostPlatform.isLinux "-ltbb"
|
|
|
|
|
++ lib.optional stdenv.cc.isClang "-faligned-allocation"
|
|
|
|
|
++ lib.optional (
|
|
|
|
|
stdenv.hostPlatform.isDarwin && lib.versionOlder stdenv.hostPlatform.darwinMinVersion "10.13"
|
|
|
|
|
) "-fno-aligned-allocation"
|
|
|
|
|
# Workaround for https://github.com/NixOS/nixpkgs/issues/19098
|
|
|
|
|
++ lib.optional (stdenv.cc.isClang && stdenv.hostPlatform.isDarwin) "-fno-lto"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
|
runHook preBuild
|
|
|
|
|
dontUseCmakeBuildDir = true;
|
|
|
|
|
|
|
|
|
|
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 \
|
|
|
|
|
${lib.optionalString (stdenv.hostPlatform.isLinux && !withWayland) "LEGACY=1"}
|
|
|
|
|
make -j $NIX_BUILD_CORES -C update/build/unix release
|
|
|
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
|
postConfigure = ''
|
|
|
|
|
cmake -B capture/build -S capture $cmakeFlags
|
|
|
|
|
cmake -B csvexport/build -S csvexport $cmakeFlags
|
|
|
|
|
cmake -B import/build -S import $cmakeFlags
|
|
|
|
|
cmake -B profiler/build -S profiler $cmakeFlags
|
|
|
|
|
cmake -B update/build -S update $cmakeFlags
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
installPhase =
|
|
|
|
|
postBuild = ''
|
|
|
|
|
ninja -C capture/build
|
|
|
|
|
ninja -C csvexport/build
|
|
|
|
|
ninja -C import/build
|
|
|
|
|
ninja -C profiler/build
|
|
|
|
|
ninja -C update/build
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
postInstall =
|
|
|
|
|
''
|
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
install -D -m 0555 capture/build/tracy-capture -t $out/bin
|
|
|
|
|
install -D -m 0555 csvexport/build/tracy-csvexport $out/bin
|
|
|
|
|
install -D -m 0555 import/build/{tracy-import-chrome,tracy-import-fuchsia} -t $out/bin
|
|
|
|
|
install -D -m 0555 profiler/build/tracy-profiler $out/bin/tracy
|
|
|
|
|
install -D -m 0555 update/build/tracy-update -t $out/bin
|
|
|
|
|
''
|
|
|
|
|
+ lib.optionalString stdenv.hostPlatform.isLinux ''
|
|
|
|
|
substituteInPlace extra/desktop/tracy.desktop \
|
|
|
|
|
--replace Exec=/usr/bin/tracy Exec=tracy
|
|
|
|
|
--replace-fail 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
|
|
|
|
|
''
|
|
|
|
|
+ ''
|
|
|
|
|
runHook postInstall
|
|
|
|
|
install -D -m 0444 extra/desktop/application-tracy.xml $out/share/mime/packages/application-tracy.xml
|
|
|
|
|
install -D -m 0444 extra/desktop/tracy.desktop $out/share/applications/tracy.desktop
|
|
|
|
|
install -D -m 0444 icon/application-tracy.svg $out/share/icons/hicolor/scalable/apps/application-tracy.svg
|
|
|
|
|
install -D -m 0444 icon/icon.png $out/share/icons/hicolor/256x256/apps/tracy.png
|
|
|
|
|
install -D -m 0444 icon/icon.svg $out/share/icons/hicolor/scalable/apps/tracy.svg
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
postFixup = lib.optionalString stdenv.hostPlatform.isDarwin ''
|
|
|
|
|
install_name_tool -change libcapstone.4.dylib ${capstone}/lib/libcapstone.4.dylib $out/bin/tracy
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
|
description = "Real time, nanosecond resolution, remote telemetry frame profiler for games and other applications";
|
|
|
|
|
homepage = "https://github.com/wolfpld/tracy";
|
|
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
|
|
|
|
license = licenses.bsd3;
|
|
|
|
|
mainProgram = "tracy";
|
|
|
|
|
maintainers = with maintainers; [
|
|
|
|
@@ -134,5 +139,6 @@ stdenv.mkDerivation rec {
|
|
|
|
|
nagisa
|
|
|
|
|
paveloom
|
|
|
|
|
];
|
|
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|