treewide: move LDFLAGS into env for structuredAttrs (#473918)

This commit is contained in:
Wolfgang Walther
2026-01-07 20:51:58 +00:00
committed by GitHub
14 changed files with 55 additions and 40 deletions
@@ -135,12 +135,16 @@ stdenv.mkDerivation {
]
++ lib.optional emojiSupport "--enable-wide-glyphs";
LDFLAGS = [
"-lfontconfig"
"-lXrender"
"-lpthread"
];
CFLAGS = [ "-I${freetype.dev}/include/freetype2" ];
env = {
LDFLAGS = toString [
"-lfontconfig"
"-lXrender"
"-lpthread"
];
CFLAGS = toString [
"-I${freetype.dev}/include/freetype2"
];
};
preConfigure = ''
# without this the terminfo won't be compiled by tic, see man tic
+1 -1
View File
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
configureFlags = lib.optional (!gifview) "--disable-gifview";
LDFLAGS = lib.optionalString static "-static";
env.LDFLAGS = lib.optionalString static "-static";
doCheck = true;
checkPhase = ''
+1 -1
View File
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
# Explicitly link against libgcc_s, to work around the infamous
# "libgcc_s.so.1 must be installed for pthread_cancel to work".
LDFLAGS = lib.optionalString stdenv.hostPlatform.isLinux "-lgcc_s";
env.LDFLAGS = lib.optionalString stdenv.hostPlatform.isLinux "-lgcc_s";
buildInputs = [
ncurses
+1 -1
View File
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
];
# See https://trac.macports.org/ticket/60656
LDFLAGS = if stdenv.hostPlatform.isDarwin then "-Wl,-w" else null;
env = lib.optionalAttrs stdenv.hostPlatform.isDarwin { LDFLAGS = "-Wl,-w"; };
meta = {
description = "Color management engine";
+6 -4
View File
@@ -29,10 +29,12 @@ stdenv.mkDerivation (finalAttrs: {
configureFlags = [ "--sysconfdir=/etc" ];
LDFLAGS = lib.optionals stdenv.hostPlatform.isStatic [
"-static-libgcc"
"-static"
];
env = lib.optionalAttrs stdenv.hostPlatform.isStatic {
LDFLAGS = toString [
"-static-libgcc"
"-static"
];
};
meta = {
description = "AX.25 library for hamradio applications";
+3 -1
View File
@@ -67,7 +67,9 @@ stdenv.mkDerivation (finalAttrs: {
mesonFlags = [ (lib.mesonBool "tests" true) ];
LDFLAGS = lib.optionals stdenv.hostPlatform.isDarwin [ "-lomp" ];
env = lib.optionalAttrs stdenv.hostPlatform.isDarwin {
LDFLAGS = "-lomp";
};
doCheck = true;
@@ -64,7 +64,9 @@ stdenv.mkDerivation (finalAttrs: {
++ devExtraCmakeFlags;
# Musl's default stack size is too small for lld to be able to link Firefox.
LDFLAGS = lib.optionalString stdenv.hostPlatform.isMusl "-Wl,-z,stack-size=2097152";
env = lib.optionalAttrs stdenv.hostPlatform.isMusl {
LDFLAGS = "-Wl,-z,stack-size=2097152";
};
outputs = [
"out"
@@ -453,9 +453,9 @@ stdenv.mkDerivation (
'';
# E.g. Mesa uses the build-id as a cache key (see #93946):
LDFLAGS = optionalString (
enableSharedLibraries && !stdenv.hostPlatform.isDarwin
) "-Wl,--build-id=sha1";
env = lib.optionalAttrs (enableSharedLibraries && !stdenv.hostPlatform.isDarwin) {
LDFLAGS = "-Wl,--build-id=sha1";
};
cmakeBuildType = "Release";
+6 -8
View File
@@ -90,14 +90,6 @@ builder rec {
})
];
# Explicitly link against libgcc_s, to work around the infamous
# "libgcc_s.so.1 must be installed for pthread_cancel to work".
# don't have "libgcc_s.so.1" on darwin
LDFLAGS = lib.optionalString (
!stdenv.hostPlatform.isDarwin && !stdenv.hostPlatform.isMusl
) "-lgcc_s";
configureFlags = [
"--with-libreadline-prefix"
]
@@ -118,6 +110,12 @@ builder rec {
env = {
NIX_CFLAGS_COMPILE = "-std=gnu17";
}
// lib.optionalAttrs (!stdenv.hostPlatform.isDarwin && !stdenv.hostPlatform.isMusl) {
# Explicitly link against libgcc_s, to work around the infamous
# "libgcc_s.so.1 must be installed for pthread_cancel to work".
# don't have "libgcc_s.so.1" on darwin
LDFLAGS = "-lgcc_s";
};
postInstall = ''
+3 -1
View File
@@ -85,7 +85,9 @@ builder rec {
# "libgcc_s.so.1 must be installed for pthread_cancel to work".
# don't have "libgcc_s.so.1" on clang
LDFLAGS = lib.optionalString (stdenv.cc.isGNU && !stdenv.hostPlatform.isStatic) "-lgcc_s";
env = lib.optionalAttrs (stdenv.cc.isGNU && !stdenv.hostPlatform.isStatic) {
LDFLAGS = "-lgcc_s";
};
configureFlags = [
"--with-libreadline-prefix=${lib.getDev readline}"
+10 -8
View File
@@ -100,11 +100,16 @@ builder rec {
sha256 = "12wvwdna9j8795x59ldryv9d84c1j3qdk2iskw09306idfsis207";
});
# Explicitly link against libgcc_s, to work around the infamous
# "libgcc_s.so.1 must be installed for pthread_cancel to work".
# don't have "libgcc_s.so.1" on clang
LDFLAGS = lib.optionalString (stdenv.cc.isGNU && !stdenv.hostPlatform.isStatic) "-lgcc_s";
env = {
# Fix build with gcc15
NIX_CFLAGS_COMPILE = toString [ "-std=gnu17" ];
}
// lib.optionalAttrs (stdenv.cc.isGNU && !stdenv.hostPlatform.isStatic) {
# Explicitly link against libgcc_s, to work around the infamous
# "libgcc_s.so.1 must be installed for pthread_cancel to work".
# don't have "libgcc_s.so.1" on clang
LDFLAGS = "-lgcc_s";
};
configureFlags = [
"--with-libreadline-prefix=${lib.getDev readline}"
@@ -126,9 +131,6 @@ builder rec {
# https://github.com/NixOS/nixpkgs/pull/160051#issuecomment-1046193028
++ lib.optional (stdenv.hostPlatform.isDarwin) "--disable-lto";
# Fix build with gcc15
env.NIX_CFLAGS_COMPILE = toString [ "-std=gnu17" ];
postInstall = ''
wrapProgram $out/bin/guile-snarf --prefix PATH : "${gawk}/bin"
''
@@ -35,8 +35,6 @@ stdenv.mkDerivation rec {
"info"
];
LDFLAGS = lib.optionalString stdenv.hostPlatform.isSunOS "-lm -lmd -lmp -luutil -lnvpair -lnsl -lidmap -lavl -lsec";
configureFlags = [
"--disable-csharp"
]
@@ -102,6 +100,9 @@ stdenv.mkDerivation rec {
# https://github.com/Homebrew/homebrew-core/pull/199639
# https://savannah.gnu.org/bugs/index.php?66541
am_cv_func_iconv_works = "yes";
}
// lib.optionalAttrs stdenv.hostPlatform.isSunOS {
LDFLAGS = "-lm -lmd -lmp -luutil -lnvpair -lnsl -lidmap -lavl -lsec";
};
enableParallelBuilding = true;
@@ -29,8 +29,10 @@ buildPythonPackage rec {
dependencies = [ cffi ];
LDFLAGS = "-L${crc32c}/lib";
CFLAGS = "-I${crc32c}/include";
env = {
LDFLAGS = "-L${crc32c}/lib";
CFLAGS = "-I${crc32c}/include";
};
nativeCheckInputs = [
pytestCheckHook
@@ -119,7 +119,7 @@ stdenv.mkDerivation (finalAttrs: {
python3Packages.onnx
];
LDFLAGS = "-Wl,--allow-shlib-undefined";
env.LDFLAGS = "-Wl,--allow-shlib-undefined";
cmakeFlags = [
"-DMIGRAPHX_ENABLE_GPU=ON"