Skip to content

Commit 61faebd

Browse files
authored
pbzip2: fix clang-19 build (NixOS#371515)
2 parents c5e7b24 + c63233b commit 61faebd

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

pkgs/by-name/pb/pbzip2/package.nix

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
lib,
33
stdenv,
44
fetchurl,
5+
fetchpatch,
56
bzip2,
67
}:
78

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

21-
buildInputs = [ bzip2 ];
22+
patches = [
23+
# https://libcxx.llvm.org/ReleaseNotes/19.html#deprecations-and-removals
24+
# https://bugs.launchpad.net/pbzip2/+bug/2081588
25+
(fetchpatch {
26+
url = "https://github.com/freebsd/freebsd-ports/raw/974d3ff054965d2bd2ab884a0579ed06c5a08b07/archivers/pbzip2/files/patch-BZ2StreamScanner.cpp";
27+
extraPrefix = "";
28+
hash = "sha256-dvXdp+5S41akavy+mvPGHpUxHxenXS7bbTVBVkIJj0s=";
29+
})
30+
(fetchpatch {
31+
url = "https://github.com/freebsd/freebsd-ports/raw/974d3ff054965d2bd2ab884a0579ed06c5a08b07/archivers/pbzip2/files/patch-BZ2StreamScanner.h";
32+
extraPrefix = "";
33+
hash = "sha256-/twP8HyHP4cAVgb5cUPq0CgDxUgDYPdd9haH9wDOrz8=";
34+
})
35+
];
2236

23-
preBuild = "substituteInPlace Makefile --replace g++ c++";
37+
postPatch = ''
38+
substituteInPlace pbzip2.cpp \
39+
--replace-fail '"PRIuMAX"' '" PRIuMAX "'
40+
'';
2441

25-
installFlags = [ "PREFIX=$(out)" ];
42+
buildInputs = [ bzip2 ];
2643

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

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

0 commit comments

Comments
 (0)