gnucobol: use autoreconfHook on darwin too

This commit is contained in:
sempiternal-aurora
2026-09-01 00:12:32 +10:00
parent bbc4f9f965
commit 0d7ffa648b

View File

@@ -3,8 +3,6 @@
stdenv,
fetchurl,
autoreconfHook,
autoconf,
automake,
libtool,
pkg-config,
# libs
@@ -13,6 +11,7 @@
gmp,
libxml2,
ncurses,
unixodbc,
# docs
help2man,
texinfo,
@@ -47,18 +46,8 @@ stdenv.mkDerivation (finalAttrs: {
perl
texinfo
texliveBasic
]
++ (
if stdenv.hostPlatform.isDarwin then
# autoreconf runs aclocal before autoconf, which messes up some compiler
# definition and causes many tests to fail (with segfaults)
[
automake
autoconf
]
else
[ autoreconfHook ]
);
autoreconfHook
];
buildInputs = [
cjson
@@ -66,6 +55,9 @@ stdenv.mkDerivation (finalAttrs: {
gmp
libxml2
ncurses
]
++ lib.optionals stdenv.hostPlatform.isUnix [
unixodbc
];
outputs = [
@@ -94,13 +86,14 @@ stdenv.mkDerivation (finalAttrs: {
AT_SKIP_IF(\[true\])' tests/testsuite.src/run_file.at
'';
preAutoreconf = ''
gettextize --force
'';
preConfigure = lib.optionalString stdenv.hostPlatform.isDarwin ''
autoconf
aclocal
automake
# when building with nix on darwin, configure will use GNU strip,
# which fails due to using --strip-unneeded, which is not supported
substituteInPlace configure --replace-fail '"GNU strip"' 'FAKE GNU strip'
substituteInPlace configure --replace-fail '"GNU strip"' '"FAKE GNU strip"'
'';
# GCC 15 changed some warnings to errors, particularly around function pointer types
@@ -108,12 +101,21 @@ stdenv.mkDerivation (finalAttrs: {
# until gnucobol is updated to compile cleanly with GCC 15+/latest LLVM.
# See: https://gcc.gnu.org/gcc-15/porting_to.html
env.CFLAGS = "-std=gnu17";
env.CPPFLAGS = lib.optionalString stdenv.hostPlatform.isDarwin "-DREAD_WRITE_NEEDS_FLUSH";
enableParallelBuilding = true;
configureFlags = [
"--enable-cobc-internal-checks"
"--enable-hardening"
"--with-db"
"--with-indexed=db"
]
++ lib.optionals stdenv.hostPlatform.isUnix [
"--with-obdc"
];
installFlags = [
"localedir=$out/share/locale"
]
++ lib.optionals (stdenv.hostPlatform.isDarwin) [
"install-pdf"
"install-html"
];