Unverified Commit 61faebd4 authored by Emily's avatar Emily Committed by GitHub
Browse files

pbzip2: fix clang-19 build (#371515)

parents c5e7b24a c63233b8
Loading
Loading
Loading
Loading
+21 −4
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
  lib,
  stdenv,
  fetchurl,
  fetchpatch,
  bzip2,
}:

@@ -18,13 +19,29 @@ stdenv.mkDerivation rec {
    sha256 = "1rnvgcdixjzbrmcr1nv9b6ccrjfrhryaj7jwz28yxxv6lam3xlcg";
  };

  buildInputs = [ bzip2 ];
  patches = [
    # https://libcxx.llvm.org/ReleaseNotes/19.html#deprecations-and-removals
    # https://bugs.launchpad.net/pbzip2/+bug/2081588
    (fetchpatch {
      url = "https://github.com/freebsd/freebsd-ports/raw/974d3ff054965d2bd2ab884a0579ed06c5a08b07/archivers/pbzip2/files/patch-BZ2StreamScanner.cpp";
      extraPrefix = "";
      hash = "sha256-dvXdp+5S41akavy+mvPGHpUxHxenXS7bbTVBVkIJj0s=";
    })
    (fetchpatch {
      url = "https://github.com/freebsd/freebsd-ports/raw/974d3ff054965d2bd2ab884a0579ed06c5a08b07/archivers/pbzip2/files/patch-BZ2StreamScanner.h";
      extraPrefix = "";
      hash = "sha256-/twP8HyHP4cAVgb5cUPq0CgDxUgDYPdd9haH9wDOrz8=";
    })
  ];

  preBuild = "substituteInPlace Makefile --replace g++ c++";
  postPatch = ''
    substituteInPlace pbzip2.cpp \
      --replace-fail '"PRIuMAX"' '" PRIuMAX "'
  '';

  installFlags = [ "PREFIX=$(out)" ];
  buildInputs = [ bzip2 ];

  env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=reserved-user-defined-literal";
  installFlags = [ "PREFIX=$(out)" ];

  meta = with lib; {
    homepage = "http://compression.ca/pbzip2/";