treewide: move NIX_CFLAGS_LINK vars into env for structuredAttrs (#492176)

This commit is contained in:
Gergő Gutyina 2026-02-28 01:03:38 +00:00 committed by GitHub
commit b25f654508
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 67 additions and 45 deletions

View file

@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
rm -rf libpng zlib zopfli
'';
NIX_CFLAGS_LINK = "-lzopfli";
env.NIX_CFLAGS_LINK = "-lzopfli";
installPhase = ''
install -Dt $out/bin apngasm

View file

@ -38,7 +38,7 @@ stdenv.mkDerivation (finalAttrs: {
]
++ lib.optional stdenv.hostPlatform.isFreeBSD ./include-static-dependencies.patch;
NIX_CFLAGS_LINK = [ "-lcrypt" ];
env.NIX_CFLAGS_LINK = toString [ "-lcrypt" ];
outputs = [
"out"

View file

@ -103,8 +103,19 @@ stdenv.mkDerivation (finalAttrs: {
libnsl
libnl
];
NIX_CFLAGS_LINK = "-lglib-2.0 -lpthread -ltirpc -lnl-3 -lnl-genl-3";
env.NIX_CFLAGS_COMPILE = toString [ "-I${libtirpc.dev}/include/tirpc" ];
env = {
NIX_CFLAGS_LINK = toString [
"-lglib-2.0"
"-lpthread"
"-ltirpc"
"-lnl-3"
"-lnl-genl-3"
];
NIX_CFLAGS_COMPILE = toString [
"-I${libtirpc.dev}/include/tirpc"
];
};
postPatch = ''
for patch in debian/patches/*.patch; do
patch < $patch

View file

@ -40,13 +40,12 @@ rustPlatform.buildRustPackage (finalAttrs: {
env = {
OPENSSL_NO_VENDOR = 1;
NIX_CFLAGS_LINK = toString [
"-L${lib.getLib openssl}/lib"
"-L${lib.getLib sqlite}/lib"
];
};
NIX_CFLAGS_LINK = [
"-L${lib.getLib openssl}/lib"
"-L${lib.getLib sqlite}/lib"
];
passthru.updateScript = unstableGitUpdater { };
meta = {

View file

@ -47,11 +47,15 @@ stdenv.mkDerivation (finalAttrs: {
];
nativeBuildInputs = [ makeWrapper ];
env.NIX_CFLAGS_COMPILE = toString [
"-I${lib.getInclude SDL2}/include/SDL2"
"-I${opusfile.dev}/include/opus"
];
NIX_CFLAGS_LINK = [ "-lSDL2" ];
env = {
NIX_CFLAGS_COMPILE = toString [
"-I${lib.getInclude SDL2}/include/SDL2"
"-I${opusfile.dev}/include/opus"
];
NIX_CFLAGS_LINK = toString [
"-lSDL2"
];
};
postInstall = ''
for i in `find $out/opt/iortcw -maxdepth 1 -type f -executable`; do

View file

@ -78,7 +78,10 @@ stdenv.mkDerivation (finalAttrs: {
'';
# Needed on Darwin.
NIX_CFLAGS_LINK = "-logg -lvorbis";
env.NIX_CFLAGS_LINK = toString [
"-logg"
"-lvorbis"
];
# Broken with libopus >= 1.6.0
doCheck = false;

View file

@ -93,7 +93,7 @@ stdenv.mkDerivation rec {
cp $notoFont $out/share/games/openspades/Resources/
'';
NIX_CFLAGS_LINK = "-lopenal";
env.NIX_CFLAGS_LINK = "-lopenal";
meta = {
description = "Compatible client of Ace of Spades 0.75";

View file

@ -85,7 +85,9 @@ stdenv.mkDerivation (finalAttrs: {
# cross compiles correctly but needs the following
lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ "--disable-tool-name-check" ];
NIX_CFLAGS_LINK = lib.optionalString stdenv.cc.isGNU "-lgcc_s";
env = lib.optionalAttrs stdenv.cc.isGNU {
NIX_CFLAGS_LINK = "-lgcc_s";
};
postPatch = ''
substituteInPlace contrib/client-tools/torify \

View file

@ -30,12 +30,21 @@ stdenv.mkDerivation (finalAttrs: {
sha256 = "1drhh08cqqkwv1yz3z4ngkplr23pqqrdx6cp8c3isy320gy25cvb";
};
# Workaround build failure on -fno-common toolchains:
# ld: r_gl.h:52: multiple definition of `qglGenBuffers';
# r_gl.h:52: first defined here
# TODO: drop once release contains upstream fix:
# https://github.com/ufoai/ufoai/commit/8a3075fffdad294e
env.NIX_CFLAGS_COMPILE = "-fcommon";
env = {
# Workaround build failure on -fno-common toolchains:
# ld: r_gl.h:52: multiple definition of `qglGenBuffers';
# r_gl.h:52: first defined here
# TODO: drop once release contains upstream fix:
# https://github.com/ufoai/ufoai/commit/8a3075fffdad294e
NIX_CFLAGS_COMPILE = "-fcommon";
NIX_CFLAGS_LINK = toString [
# to avoid occasional runtime error in finding libgcc_s.so.1
"-lgcc_s"
# tests are underlinked against libm:
# ld: release-linux-x86_64/testall/client/sound/s_mix.c.o: undefined reference to symbol 'acos@@GLIBC_2.2.5'
"-lm"
];
};
preConfigure = ''tar xvf "${finalAttrs.srcData}"'';
@ -60,14 +69,6 @@ stdenv.mkDerivation (finalAttrs: {
cunit
];
NIX_CFLAGS_LINK = [
# to avoid occasional runtime error in finding libgcc_s.so.1
"-lgcc_s"
# tests are underlinked against libm:
# ld: release-linux-x86_64/testall/client/sound/s_mix.c.o: undefined reference to symbol 'acos@@GLIBC_2.2.5'
"-lm"
];
meta = {
homepage = "http://ufoai.org";
description = "Squad-based tactical strategy game in the tradition of X-Com";

View file

@ -28,7 +28,7 @@ stdenv.mkDerivation (finalAttrs: {
motif
];
NIX_CFLAGS_LINK = "-lXpm";
env.NIX_CFLAGS_LINK = "-lXpm";
configureFlags = [
"--with-x"

View file

@ -50,7 +50,7 @@ stdenv.mkDerivation rec {
sourceRoot = ".";
NIX_CFLAGS_LINK = [
env.NIX_CFLAGS_LINK = toString [
"-lopenal"
"-lfluidsynth"
];

View file

@ -103,18 +103,20 @@ stdenv.mkDerivation (finalAttrs: {
]
++ lib.optional withEditor wxGTK32;
env.NIX_CFLAGS_COMPILE = toString [
"-I${xorgproto}/include"
"-I${libx11.dev}/include"
"-I${libxcursor.dev}/include"
"-I${SDL2}/include/SDL2"
"-I${fmt_9.dev}/include"
"-I${nvidia-texture-tools.dev}/include"
];
env = {
NIX_CFLAGS_COMPILE = toString [
"-I${xorgproto}/include"
"-I${libx11.dev}/include"
"-I${libxcursor.dev}/include"
"-I${SDL2}/include/SDL2"
"-I${fmt_9.dev}/include"
"-I${nvidia-texture-tools.dev}/include"
];
NIX_CFLAGS_LINK = toString [
"-L${nvidia-texture-tools.lib}/lib/static"
];
NIX_CFLAGS_LINK = toString [
"-L${nvidia-texture-tools.lib}/lib/static"
];
};
patches = [
./rootdir_env.patch

View file

@ -60,7 +60,7 @@ stdenv.mkDerivation rec {
];
# Fix broken DT_NEEDED in lib/redland/librdf_storage_sqlite.so.
NIX_CFLAGS_LINK = "-lraptor2";
env.NIX_CFLAGS_LINK = "-lraptor2";
doCheck = false; # fails 1 out of 17 tests with a segmentation fault