Skip to content

Commit 787a995

Browse files
drawbuJohnRTitor
authored andcommitted
agrep: unbreak
Starting with gcc14, implicit declaration are now a compiler error. By patching the package we successfully fix the build
1 parent e5b5b2a commit 787a995

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

pkgs/by-name/ag/agrep/package.nix

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
lib,
3-
stdenv,
43
fetchFromGitHub,
4+
fetchpatch,
5+
stdenv,
56
}:
67
let
78
# This repository has numbered versions, but not Git tags.
@@ -18,6 +19,29 @@ stdenv.mkDerivation {
1819
hash = "sha256-2J4bw5BVZgTEcIn9IuD5Q8/L+8tldDbToDefuxDf85g=";
1920
};
2021

22+
patches = [
23+
# Implicit declaration of functions & implicit int
24+
# https://github.com/Wikinaut/agrep/pull/31
25+
(fetchpatch {
26+
url = "https://patch-diff.githubusercontent.com/raw/Wikinaut/agrep/pull/31.patch";
27+
hash = "sha256-9ik2RANq12T/1vCUYTBNomzw+aJVa/LU2RsZovu3r3E=";
28+
})
29+
];
30+
31+
postPatch = ''
32+
# agrep only doesn't includes <sys/stat.h> for Linux
33+
# Starting from gcc14, this is a compiler error
34+
substituteInPlace checkfil.c recursiv.c \
35+
--replace-fail '#ifdef __APPLE__
36+
#include <sys/stat.h>
37+
#endif' '#include <sys/stat.h>'
38+
39+
substituteInPlace newmgrep.c \
40+
--replace-fail '#if defined(_WIN32) || defined(__APPLE__)
41+
#include <sys/stat.h>
42+
#endif' '#include <sys/stat.h>'
43+
'';
44+
2145
makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ];
2246

2347
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-std=c89";

0 commit comments

Comments
 (0)