Fix some BSD builds missing pthread functions

In addition to adding the missing thread deps in the last commit, we
also appear to need to skip `-Wl,--as-needed` flags that Meson wants to
use, but doesn't work with our *BSD toolchains.

See https://github.com/mesonbuild/meson/issues/3593
This commit is contained in:
John Ericson 2024-07-22 11:44:53 -04:00
parent d3cee8160c
commit d39bbcabb9

View file

@ -61,6 +61,12 @@ let
workDir = null;
};
# Work around weird `--as-needed` linker behavior with BSD, see
# https://github.com/mesonbuild/meson/issues/3593
bsdNoLinkAsNeeded = finalAttrs: prevAttrs: lib.optionalAttrs stdenv.hostPlatform.isBSD {
mesonFlags = [ (lib.mesonBool "b_asneeded" false) ] ++ prevAttrs.mesonFlags or [];
};
in
scope: {
inherit stdenv versionSuffix;
@ -130,5 +136,8 @@ scope: {
inherit resolvePath filesetToSource;
mkMesonDerivation = f: stdenv.mkDerivation (lib.extends localSourceLayer f);
mkMesonDerivation = f: stdenv.mkDerivation
(lib.extends
(lib.composeExtensions bsdNoLinkAsNeeded localSourceLayer)
f);
}