Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tracy: split the package into tracy-wayland and tracy-glfw #320273

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions nixos/doc/manual/release-notes/rl-2411.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@

- `/share/vim-plugins` now only gets linked if `programs.vim.enable` is enabled

- The `tracy` package no longer works on X11, since it's moved to Wayland
support, which is the intended default behavior by Tracy maintainers.
X11 users have to switch to the new package `tracy-x11`.
- The profiler from the `tracy` package no longer works on X11, since it
requires Wayland now, which is the intended default behavior by Tracy
maintainers. X11 users have to switch to the new package `tracy-glfw`.

- The `services.prometheus.exporters.minio` option has been removed, as it's upstream implementation was broken and unmaintained.
Minio now has built-in [Prometheus metrics exposure](https://min.io/docs/minio/linux/operations/monitoring/collect-minio-metrics-using-prometheus.html), which can be used instead.
Expand Down
119 changes: 119 additions & 0 deletions pkgs/by-name/tr/tracy/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
{ lib
, stdenv
, fetchFromGitHub

, capstone
, darwin
, dbus
, freetype
, glfw
, hicolor-icon-theme
, pkg-config
, tbb

, withWayland ? stdenv.isLinux
, libxkbcommon
, wayland
}:

stdenv.mkDerivation rec {
pname = if (stdenv.isLinux && withWayland) then "tracy-wayland" else "tracy-glfw";
version = "0.10";

src = fetchFromGitHub {
owner = "wolfpld";
repo = "tracy";
rev = "v${version}";
sha256 = "sha256-DN1ExvQ5wcIUyhMAfiakFbZkDsx+5l8VMtYGvSdboPA=";
};

patches = lib.optionals (stdenv.isDarwin && !(lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11")) [
./0001-remove-unifiedtypeidentifiers-framework
];

nativeBuildInputs = [ pkg-config ];

buildInputs = [
capstone
freetype
glfw
] ++ lib.optionals stdenv.isLinux [
dbus
hicolor-icon-theme
tbb
] ++ lib.optionals (stdenv.isLinux && withWayland) [
libxkbcommon
wayland
] ++ 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
];

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.isDarwin "-Wno-format-security"
++ lib.optional stdenv.isLinux "-ltbb"
++ lib.optional stdenv.cc.isClang "-faligned-allocation"
# workaround issue #19098
++ lib.optional (stdenv.cc.isClang && stdenv.isDarwin) "-fno-lto");

buildPhase = ''
runHook preBuild

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.isLinux && !withWayland) "LEGACY=1"}
make -j $NIX_BUILD_CORES -C update/build/unix release

runHook postBuild
'';

installPhase = ''
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
'' + 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
'' + ''
runHook postInstall
'';

postFixup = lib.optionalString stdenv.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 = if (stdenv.isLinux && withWayland) then platforms.linux else platforms.linux ++ platforms.darwin;
license = licenses.bsd3;
mainProgram = "tracy";
maintainers = with maintainers; [ mpickering nagisa paveloom ];
};
}
122 changes: 5 additions & 117 deletions pkgs/by-name/tr/tracy/package.nix
Original file line number Diff line number Diff line change
@@ -1,119 +1,7 @@
{ lib
, stdenv
, fetchFromGitHub
{
stdenv,

, capstone
, darwin
, dbus
, freetype
, glfw
, hicolor-icon-theme
, pkg-config
, tbb

, withWayland ? stdenv.isLinux
, libxkbcommon
, wayland
tracy-glfw,
tracy-wayland,
}:

stdenv.mkDerivation rec {
pname = "tracy";
version = "0.10";

src = fetchFromGitHub {
owner = "wolfpld";
repo = "tracy";
rev = "v${version}";
sha256 = "sha256-DN1ExvQ5wcIUyhMAfiakFbZkDsx+5l8VMtYGvSdboPA=";
};

patches = lib.optionals (stdenv.isDarwin && !(lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11")) [
./0001-remove-unifiedtypeidentifiers-framework
];

nativeBuildInputs = [ pkg-config ];

buildInputs = [
capstone
freetype
glfw
] ++ lib.optionals (stdenv.isLinux && withWayland) [
libxkbcommon
wayland
] ++ 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
];

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.isDarwin "-Wno-format-security"
++ lib.optional stdenv.isLinux "-ltbb"
++ lib.optional stdenv.cc.isClang "-faligned-allocation"
# workaround issue #19098
++ lib.optional (stdenv.cc.isClang && stdenv.isDarwin) "-fno-lto");

buildPhase = ''
runHook preBuild

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.isLinux && !withWayland) "LEGACY=1"}
make -j $NIX_BUILD_CORES -C update/build/unix release

runHook postBuild
'';

installPhase = ''
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
'' + 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
'' + ''
runHook postInstall
'';

postFixup = lib.optionalString stdenv.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; [ mpickering nagisa paveloom ];
};
}
if (stdenv.isLinux) then tracy-wayland else tracy-glfw
3 changes: 2 additions & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7521,7 +7521,8 @@ with pkgs;

tracker = callPackage ../development/libraries/tracker { };

tracy-x11 = callPackage ../by-name/tr/tracy/package.nix { withWayland = false; };
tracy-glfw = callPackage ../by-name/tr/tracy/default.nix { withWayland = false; };
tracy-wayland = callPackage ../by-name/tr/tracy/default.nix { };

trivy = callPackage ../tools/admin/trivy { };

Expand Down