at 24.05-pre 111 lines 3.9 kB view raw
1{ lib 2, stdenv 3, fetchFromGitHub 4 5, capstone 6, darwin 7, dbus 8, freetype 9, glfw 10, hicolor-icon-theme 11, pkg-config 12, tbb 13}: 14 15stdenv.mkDerivation rec { 16 pname = "tracy"; 17 version = "0.10"; 18 19 src = fetchFromGitHub { 20 owner = "wolfpld"; 21 repo = "tracy"; 22 rev = "v${version}"; 23 sha256 = "sha256-DN1ExvQ5wcIUyhMAfiakFbZkDsx+5l8VMtYGvSdboPA="; 24 }; 25 26 patches = lib.optionals (stdenv.isDarwin && !(lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11")) [ 27 ./0001-remove-unifiedtypeidentifiers-framework 28 ]; 29 30 nativeBuildInputs = [ pkg-config ]; 31 32 buildInputs = [ 33 capstone 34 freetype 35 glfw 36 ] ++ lib.optionals stdenv.isLinux [ 37 dbus 38 hicolor-icon-theme 39 tbb 40 ] ++ lib.optionals stdenv.isDarwin [ 41 darwin.apple_sdk.frameworks.AppKit 42 darwin.apple_sdk.frameworks.Carbon 43 ] ++ lib.optionals (stdenv.isDarwin && lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11") [ 44 darwin.apple_sdk.frameworks.UniformTypeIdentifiers 45 ]; 46 47 env.NIX_CFLAGS_COMPILE = toString ([ ] 48 # Apple's compiler finds a format string security error on 49 # ../../../server/TracyView.cpp:649:34, preventing building. 50 ++ lib.optional stdenv.isDarwin "-Wno-format-security" 51 ++ lib.optional stdenv.isLinux "-ltbb" 52 ++ lib.optional stdenv.cc.isClang "-faligned-allocation" 53 # workaround issue #19098 54 ++ lib.optional (stdenv.cc.isClang && stdenv.isDarwin) "-fno-lto"); 55 56 buildPhase = '' 57 runHook preBuild 58 59 make -j $NIX_BUILD_CORES -C capture/build/unix release 60 make -j $NIX_BUILD_CORES -C csvexport/build/unix release 61 make -j $NIX_BUILD_CORES -C import-chrome/build/unix release 62 make -j $NIX_BUILD_CORES -C library/unix release 63 make -j $NIX_BUILD_CORES -C profiler/build/unix release LEGACY=1 64 make -j $NIX_BUILD_CORES -C update/build/unix release 65 66 runHook postBuild 67 ''; 68 69 installPhase = '' 70 runHook preInstall 71 72 install -D -m 0755 capture/build/unix/capture-release $out/bin/capture 73 install -D -m 0755 csvexport/build/unix/csvexport-release $out/bin/tracy-csvexport 74 install -D -m 0755 import-chrome/build/unix/import-chrome-release $out/bin/import-chrome 75 install -D -m 0755 library/unix/libtracy-release.so $out/lib/libtracy.so 76 install -D -m 0755 profiler/build/unix/Tracy-release $out/bin/tracy 77 install -D -m 0755 update/build/unix/update-release $out/bin/update 78 79 mkdir -p $out/include/Tracy/client 80 mkdir -p $out/include/Tracy/common 81 mkdir -p $out/include/Tracy/tracy 82 83 cp -p public/client/*.{h,hpp} $out/include/Tracy/client 84 cp -p public/common/*.{h,hpp} $out/include/Tracy/common 85 cp -p public/tracy/*.{h,hpp} $out/include/Tracy/tracy 86 '' + lib.optionalString stdenv.isLinux '' 87 substituteInPlace extra/desktop/tracy.desktop \ 88 --replace Exec=/usr/bin/tracy Exec=tracy 89 90 install -D -m 0644 extra/desktop/application-tracy.xml $out/share/mime/packages/application-tracy.xml 91 install -D -m 0644 extra/desktop/tracy.desktop $out/share/applications/tracy.desktop 92 install -D -m 0644 icon/application-tracy.svg $out/share/icons/hicolor/scalable/apps/application-tracy.svg 93 install -D -m 0644 icon/icon.png $out/share/icons/hicolor/256x256/apps/tracy.png 94 install -D -m 0644 icon/icon.svg $out/share/icons/hicolor/scalable/apps/tracy.svg 95 '' + '' 96 runHook postInstall 97 ''; 98 99 postFixup = lib.optionalString stdenv.isDarwin '' 100 install_name_tool -change libcapstone.4.dylib ${capstone}/lib/libcapstone.4.dylib $out/bin/tracy 101 ''; 102 103 meta = with lib; { 104 description = "A real time, nanosecond resolution, remote telemetry frame profiler for games and other applications"; 105 homepage = "https://github.com/wolfpld/tracy"; 106 platforms = platforms.linux ++ platforms.darwin; 107 license = licenses.bsd3; 108 mainProgram = "tracy"; 109 maintainers = with maintainers; [ mpickering nagisa paveloom ]; 110 }; 111}