Merge pull request #261589 from paveloom/tracy

tracy: 0.9.1 -> 0.10 + build and install more
This commit is contained in:
Weijia Wang 2023-10-17 13:06:01 +02:00 committed by GitHub
commit 85663ae462
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,28 +1,26 @@
{ lib
, stdenv
, fetchFromGitHub
, pkg-config
, capstone
, darwin
, dbus
, freetype
, glfw
, dbus
, hicolor-icon-theme
, pkg-config
, tbb
, darwin
}:
let
disableLTO = stdenv.cc.isClang && stdenv.isDarwin; # workaround issue #19098
in
stdenv.mkDerivation rec {
pname = "tracy";
version = "0.9.1";
version = "0.10";
src = fetchFromGitHub {
owner = "wolfpld";
repo = "tracy";
rev = "v${version}";
sha256 = "sha256-K1lQNRS8+ju9HyKNVXtHqslrPWcPgazzTitvwkIO3P4";
sha256 = "sha256-DN1ExvQ5wcIUyhMAfiakFbZkDsx+5l8VMtYGvSdboPA=";
};
patches = lib.optionals (stdenv.isDarwin && !(lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11")) [
@ -52,15 +50,18 @@ stdenv.mkDerivation rec {
++ lib.optional stdenv.isDarwin "-Wno-format-security"
++ lib.optional stdenv.isLinux "-ltbb"
++ lib.optional stdenv.cc.isClang "-faligned-allocation"
++ lib.optional disableLTO "-fno-lto");
# 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 LEGACY=1
make -j $NIX_BUILD_CORES -C import-chrome/build/unix/ release
make -j $NIX_BUILD_CORES -C capture/build/unix/ release
make -j $NIX_BUILD_CORES -C update/build/unix/ release
make -j $NIX_BUILD_CORES -C update/build/unix release
runHook postBuild
'';
@ -68,16 +69,35 @@ stdenv.mkDerivation rec {
installPhase = ''
runHook preInstall
install -D ./profiler/build/unix/Tracy-release $out/bin/Tracy
install -D ./import-chrome/build/unix/import-chrome-release $out/bin/import-chrome
install -D ./capture/build/unix/capture-release $out/bin/capture
install -D ./update/build/unix/update-release $out/bin/update
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
install_name_tool -change libcapstone.4.dylib ${capstone}/lib/libcapstone.4.dylib $out/bin/tracy
'';
meta = with lib; {
@ -85,6 +105,7 @@ stdenv.mkDerivation rec {
homepage = "https://github.com/wolfpld/tracy";
platforms = platforms.linux ++ platforms.darwin;
license = licenses.bsd3;
maintainers = with maintainers; [ mpickering nagisa ];
mainProgram = "tracy";
maintainers = with maintainers; [ mpickering nagisa paveloom ];
};
}