Unverified Commit 99b92cf3 authored by Mario Rodas's avatar Mario Rodas Committed by GitHub
Browse files

Merge pull request #288000 from trofi/timeloop-gcc-13-fix

timeloop: unstable-2022-11-29 -> 3.0.3, fix `gcc-13` build failure
parents 5dec53ad 3bbdc26d
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -15,13 +15,13 @@

stdenv.mkDerivation rec {
  pname = "timeloop";
  version = "unstable-2022-11-29";
  version = "3.0.3";

  src = fetchFromGitHub {
    owner = "NVlabs";
    repo = "timeloop";
    rev = "905ba953432c812772de935d57fd0a674a89d3c1";
    hash = "sha256-EXiWXf8hdX4vFRNk9wbFSOsix/zVkwrafGUtFrsoAN0=";
    rev = "v${version}";
    hash = "sha256-CGPhrBNzFdERAA/Eym2v0+FvFUe+VkBLnwYEqEMHE9k=";
  };

  nativeBuildInputs = [ scons ];
@@ -46,10 +46,14 @@ stdenv.mkDerivation rec {
  env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-fno-lto";

  postPatch = ''
    # Fix gcc-13 build failure due to missing includes:
    sed -e '1i #include <cstdint>' -i \
      include/compound-config/compound-config.hpp

    # use nix ar/ranlib
    substituteInPlace ./SConstruct \
      --replace "env.Replace(AR = \"gcc-ar\")" "" \
      --replace "env.Replace(RANLIB = \"gcc-ranlib\")" ""
      --replace-fail "env.Replace(AR = \"gcc-ar\")" "pass" \
      --replace-fail "env.Replace(RANLIB = \"gcc-ranlib\")" "pass"
    '' + lib.optionalString stdenv.isDarwin ''
    # prevent clang from dying on errors that gcc is fine with
    substituteInPlace ./src/SConscript --replace "-Werror" "-Wno-inconsistent-missing-override"