Merge pull request #118611 from risicle/ris-tracy-darwin-fix

tracy: force-disable LTO for darwin
This commit is contained in:
Sandro 2021-04-06 12:00:30 +02:00 committed by GitHub
commit a64eb90739
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,8 @@
{ stdenv, lib, darwin, fetchFromGitHub, tbb, gtk3, glfw, pkg-config, freetype, Carbon, AppKit, capstone }:
stdenv.mkDerivation rec {
let
disableLTO = stdenv.cc.isClang && stdenv.isDarwin; # workaround issue #19098
in stdenv.mkDerivation rec {
pname = "tracy";
version = "0.7.7";
@ -19,7 +21,10 @@ stdenv.mkDerivation rec {
NIX_CFLAGS_COMPILE = [ ]
++ lib.optional stdenv.isLinux "-ltbb"
++ lib.optional stdenv.cc.isClang "-faligned-allocation";
++ lib.optional stdenv.cc.isClang "-faligned-allocation"
++ lib.optional disableLTO "-fno-lto";
NIX_CFLAGS_LINK = lib.optional disableLTO "-fno-lto";
buildPhase = ''
make -j $NIX_BUILD_CORES -C profiler/build/unix release
@ -35,7 +40,7 @@ stdenv.mkDerivation rec {
install -D ./update/build/unix/update-release $out/bin/update
'';
fixupPhase = lib.optionalString stdenv.isDarwin ''
postFixup = lib.optionalString stdenv.isDarwin ''
install_name_tool -change libcapstone.4.dylib ${capstone}/lib/libcapstone.4.dylib $out/bin/Tracy
'';