tcl: fix on static architectures

This is a bit of a silly one. It's a symbol redefinition problem caused
by autoconf being pessimistic, then a funny eval error where
`stdenv.hostPlatform.extensions.dynamicLibrary` is not defined, say,
when the platform does not support dynamic libraries.

Fixes: https://github.com/NixOS/nixpkgs/issues/380168
This commit is contained in:
Jade Lovelace 2025-02-07 19:54:41 +00:00 committed by Alyssa Ross
parent 23dbe21e46
commit b4b0914097

View file

@ -80,7 +80,14 @@ let
"--disable-zipfs"
]
++ [
# During cross compilation, the tcl build system assumes that libc
# functions are broken if it cannot test if they are broken or not and
# then causes a link error on static platforms due to symbol conflict.
# These functions are *checks notes* strtoul and strstr. These are
# never broken on modern platforms!
"tcl_cv_strtod_unbroken=ok"
"tcl_cv_strtoul_unbroken=ok"
"tcl_cv_strstr_unbroken=ok"
]
++ lib.optional stdenv.hostPlatform.is64bit "--enable-64bit";
@ -89,11 +96,17 @@ let
postInstall =
let
dllExtension = stdenv.hostPlatform.extensions.sharedLibrary;
staticExtension = stdenv.hostPlatform.extensions.staticLibrary;
in
''
make install-private-headers
ln -s $out/bin/tclsh${release} $out/bin/tclsh
if [[ -e $out/lib/libtcl${release}${staticExtension} ]]; then
ln -s $out/lib/libtcl${release}${staticExtension} $out/lib/libtcl${staticExtension}
fi
${lib.optionalString (!stdenv.hostPlatform.isStatic) ''
ln -s $out/lib/libtcl${release}${dllExtension} $out/lib/libtcl${dllExtension}
''}
'';
meta = with lib; {