Skip to content

Commit f1cf2b7

Browse files
authored
gawkextlib.{errno,gd,haru,lmdb,select}: fix (cross) build (NixOS#375045)
2 parents 03d12a6 + 47cbb54 commit f1cf2b7

File tree

1 file changed

+30
-8
lines changed

1 file changed

+30
-8
lines changed

pkgs/tools/text/gawk/gawkextlib.nix

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ let
3434
extraBuildInputs ? [ ],
3535
doCheck ? true,
3636
patches ? [ ],
37+
extraPostPatch ? "",
38+
env ? { },
39+
broken ? null,
3740
}:
3841
let
3942
is_extension = gawkextlib != null;
@@ -50,9 +53,11 @@ let
5053

5154
inherit patches;
5255

53-
postPatch = ''
54-
cd ${name}
55-
'';
56+
postPatch =
57+
''
58+
cd ${name}
59+
''
60+
+ extraPostPatch;
5661

5762
nativeBuildInputs = [
5863
autoconf
@@ -70,10 +75,12 @@ let
7075
setupHook = if is_extension then ./setup-hook.sh else null;
7176
inherit gawk;
7277

78+
inherit env;
79+
7380
inherit doCheck;
7481
nativeCheckInputs = [ more ];
7582

76-
meta = with lib; {
83+
meta = {
7784
homepage = "https://sourceforge.net/projects/gawkextlib/";
7885
description = "Dynamically loaded extension libraries for GNU AWK";
7986
mainProgram = "xmlgawk";
@@ -85,10 +92,10 @@ let
8592
database, use the GD graphics library, and perform unlimited
8693
precision MPFR calculations.
8794
'';
88-
license = licenses.gpl3Plus;
89-
platforms = platforms.unix;
90-
maintainers = with maintainers; [ tomberek ];
91-
};
95+
license = lib.licenses.gpl3Plus;
96+
platforms = lib.platforms.unix;
97+
maintainers = with lib.maintainers; [ tomberek ];
98+
} // lib.optionalAttrs (broken != null) { inherit broken; };
9299
}
93100
);
94101
gawkextlib = buildExtension {
@@ -112,11 +119,16 @@ let
112119
errno = buildExtension {
113120
inherit gawkextlib;
114121
name = "errno";
122+
extraPostPatch = ''
123+
substituteInPlace Makefile.am --replace-fail 'cpp -M' '${stdenv.cc.targetPrefix}cpp -M'
124+
'';
115125
};
116126
gd = buildExtension {
117127
inherit gawkextlib;
118128
name = "gd";
119129
extraBuildInputs = [ gd ];
130+
# GCC 14 makes this an error by default, remove when fixed upstream
131+
env.NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types";
120132
};
121133
haru = buildExtension {
122134
inherit gawkextlib;
@@ -127,6 +139,8 @@ let
127139
# https://github.com/libharu/libharu/commit/88271b73c68c521a49a15e3555ef00395aa40810
128140
./fix-typos-corrected-in-libharu-2.4.4.patch
129141
];
142+
# GCC 14 makes this an error by default, remove when fixed upstream
143+
env.NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types";
130144
};
131145
json = buildExtension {
132146
inherit gawkextlib;
@@ -136,6 +150,9 @@ let
136150
lmdb = buildExtension {
137151
inherit gawkextlib;
138152
name = "lmdb";
153+
extraPostPatch = ''
154+
substituteInPlace Makefile.am --replace-fail 'cpp -M' '${stdenv.cc.targetPrefix}cpp -M'
155+
'';
139156
extraBuildInputs = [ lmdb ];
140157
# mdb_env_open(env, /dev/null)
141158
#! No such device
@@ -175,6 +192,9 @@ let
175192
select = buildExtension {
176193
inherit gawkextlib;
177194
name = "select";
195+
extraPostPatch = ''
196+
substituteInPlace Makefile.am --replace-fail 'cpp -M' '${stdenv.cc.targetPrefix}cpp -M'
197+
'';
178198
};
179199
timex = buildExtension {
180200
inherit gawkextlib;
@@ -187,6 +207,8 @@ let
187207
expat
188208
libiconv
189209
];
210+
# gawk: xmlbase:14: fatal: load_ext: cannot open library `../.libs/xml.so`
211+
broken = !stdenv.buildPlatform.canExecute stdenv.hostPlatform;
190212
};
191213
};
192214
in

0 commit comments

Comments
 (0)