at 23.05-pre 59 lines 2.1 kB view raw
1{ stdenv, lib, darwin, fetchFromGitHub 2, tbb, gtk3, glfw, pkg-config, freetype, Carbon, AppKit, capstone, dbus 3}: 4 5let 6 disableLTO = stdenv.cc.isClang && stdenv.isDarwin; # workaround issue #19098 7in stdenv.mkDerivation rec { 8 pname = "tracy"; 9 version = "0.8.2.1"; 10 11 src = fetchFromGitHub { 12 owner = "wolfpld"; 13 repo = "tracy"; 14 rev = "v${version}"; 15 sha256 = "sha256-SVzNy0JP/JrUYgelypBn8SPO+Ksm1rq2yGnxk1hCLkQ="; 16 }; 17 18 nativeBuildInputs = [ pkg-config ]; 19 20 buildInputs = [ glfw capstone ] 21 ++ lib.optionals stdenv.isDarwin [ Carbon AppKit freetype ] 22 ++ lib.optionals stdenv.isLinux [ gtk3 tbb dbus ]; 23 24 NIX_CFLAGS_COMPILE = [ ] 25 # Apple's compiler finds a format string security error on 26 # ../../../server/TracyView.cpp:649:34, preventing building. 27 ++ lib.optional stdenv.isDarwin "-Wno-format-security" 28 ++ lib.optional stdenv.isLinux "-ltbb" 29 ++ lib.optional stdenv.cc.isClang "-faligned-allocation" 30 ++ lib.optional disableLTO "-fno-lto"; 31 32 NIX_CFLAGS_LINK = lib.optional disableLTO "-fno-lto"; 33 34 buildPhase = '' 35 make -j $NIX_BUILD_CORES -C profiler/build/unix release 36 make -j $NIX_BUILD_CORES -C import-chrome/build/unix/ release 37 make -j $NIX_BUILD_CORES -C capture/build/unix/ release 38 make -j $NIX_BUILD_CORES -C update/build/unix/ release 39 ''; 40 41 installPhase = '' 42 install -D ./profiler/build/unix/Tracy-release $out/bin/Tracy 43 install -D ./import-chrome/build/unix/import-chrome-release $out/bin/import-chrome 44 install -D ./capture/build/unix/capture-release $out/bin/capture 45 install -D ./update/build/unix/update-release $out/bin/update 46 ''; 47 48 postFixup = lib.optionalString stdenv.isDarwin '' 49 install_name_tool -change libcapstone.4.dylib ${capstone}/lib/libcapstone.4.dylib $out/bin/Tracy 50 ''; 51 52 meta = with lib; { 53 description = "A real time, nanosecond resolution, remote telemetry frame profiler for games and other applications"; 54 homepage = "https://github.com/wolfpld/tracy"; 55 platforms = platforms.linux ++ platforms.darwin; 56 license = licenses.bsd3; 57 maintainers = with maintainers; [ mpickering nagisa ]; 58 }; 59}