treewide: move CXXFLAGS into env for structuredAttrs (#490778)

This commit is contained in:
Jo
2026-02-19 13:30:37 +00:00
committed by GitHub
43 changed files with 98 additions and 73 deletions
@@ -139,7 +139,7 @@ stdenv.mkDerivation rec {
# Find FLTK without requiring an OpenGL library in buildInputs
++ lib.optional (guiModule == "fltk") "-DFLTK_SKIP_OPENGL=ON";
CXXFLAGS = [
env.CXXFLAGS = toString [
# GCC 13: error: 'uint8_t' does not name a type
"-include cstdint"
];
@@ -69,7 +69,7 @@ stdenv.mkDerivation rec {
zeromq
];
CXXFLAGS = [
env.CXXFLAGS = toString [
"-I${lib.getDev utf8cpp}/include/utf8cpp"
"-I${lib.getDev cxx-rs}/include"
];
@@ -191,7 +191,7 @@ stdenv.mkDerivation (finalAttrs: {
(lib.cmakeBool "USE_SVMLIGHT" withSvmLight)
];
CXXFLAGS = "-faligned-new";
env.CXXFLAGS = "-faligned-new";
doCheck = true;
@@ -71,7 +71,7 @@ stdenv.mkDerivation rec {
{} +
'';
CXXFLAGS = " --std=c++11 ";
env.CXXFLAGS = " --std=c++11 ";
nativeBuildInputs = [
pkg-config
+1 -1
View File
@@ -46,7 +46,7 @@ stdenv.mkDerivation (finalAttrs: {
];
# https://github.com/clMathLibraries/clFFT/issues/237
CXXFLAGS = "-std=c++98";
env.CXXFLAGS = "-std=c++98";
meta = {
description = "Library containing FFT functions written in OpenCL";
+4 -1
View File
@@ -42,7 +42,10 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
hardeningDisable = [ "fortify" ];
CXXFLAGS = lib.optionals withOpenMP [ "-fopenmp" ];
env = lib.optionalAttrs withOpenMP {
CXXFLAGS = "-fopenmp";
};
doCheck = true;
+1 -1
View File
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
SysCPU
]);
CXXFLAGS = "-std=c++98";
env.CXXFLAGS = "-std=c++98";
postInstall = ''
substituteInPlace $out/bin/compiler_test.pl \
+1 -1
View File
@@ -47,7 +47,7 @@ stdenv.mkDerivation {
]
++ lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ];
CXXFLAGS = [
env.CXXFLAGS = toString [
"-DCOMPILE_WITH_LZFSE=1"
"-llzfse"
];
+3 -2
View File
@@ -61,9 +61,10 @@ stdenv.mkDerivation (finalAttrs: {
"-DDRACO_TINYGLTF_PATH=${tinygltf}"
];
CXXFLAGS = [
env.CXXFLAGS = toString [
# error: expected ')' before 'value' in 'explicit GltfValue(uint8_t value)'
"-include cstdint"
"-include"
"cstdint"
];
passthru.updateScript = nix-update-script { };
+1 -1
View File
@@ -61,7 +61,7 @@ stdenv.mkDerivation (finalAttrs: {
strictDeps = true;
CXXFLAGS = "-std=c++11";
env.CXXFLAGS = "-std=c++11";
configureFlags = [
"--enable-liblilv"
"--with-extra-cppflags=-Dnullptr=0"
+1 -1
View File
@@ -28,7 +28,7 @@ stdenv.mkDerivation (finalAttrs: {
./autogen.sh
'';
CXXFLAGS = [
env.CXXFLAGS = toString [
"-O0"
"-I${lib.getDev utf8cpp}/include/utf8cpp"
];
+1 -1
View File
@@ -61,7 +61,7 @@ flutter332.buildFlutterApplication rec {
];
# https://github.com/juliansteenbakker/flutter_secure_storage/issues/965
CXXFLAGS = [ "-Wno-deprecated-literal-operator" ];
env.CXXFLAGS = toString [ "-Wno-deprecated-literal-operator" ];
# Based on https://github.com/ente-io/ente/blob/main/auth/linux/packaging/rpm/make_config.yaml
# and https://github.com/ente-io/ente/blob/main/auth/linux/packaging/enteauth.appdata.xml
+3 -3
View File
@@ -45,9 +45,9 @@ stdenv.mkDerivation (finalAttrs: {
"-DDISABLE_CRASH_LOG=TRUE"
];
CXXFLAGS = lib.optionals stdenv.cc.isClang [
"-std=c++17"
];
env = lib.optionalAttrs stdenv.cc.isClang {
CXXFLAGS = toString [ "-std=c++17" ];
};
doCheck = true;
+11 -9
View File
@@ -159,17 +159,19 @@ stdenv.mkDerivation (finalAttrs: {
enableParallelBuilding = true;
env.NIX_CFLAGS_COMPILE = toString [
"-Wno-error"
# https://github.com/signalwire/freeswitch/issues/2495
"-Wno-incompatible-pointer-types"
];
env = {
NIX_CFLAGS_COMPILE = toString [
"-Wno-error"
# https://github.com/signalwire/freeswitch/issues/2495
"-Wno-incompatible-pointer-types"
];
# Using c++14 because of build error
# gsm_at.h:94:32: error: ISO C++17 does not allow dynamic exception specifications
CXXFLAGS = "-std=c++14";
# Using c++14 because of build error
# gsm_at.h:94:32: error: ISO C++17 does not allow dynamic exception specifications
CXXFLAGS = "-std=c++14";
CFLAGS = "-D_ANSI_SOURCE";
CFLAGS = "-D_ANSI_SOURCE";
};
hardeningDisable = [ "format" ];
+1 -1
View File
@@ -91,7 +91,7 @@ stdenv.mkDerivation (finalAttrs: {
# Without the std explicitly set, we may run into abseil-cpp
# compilation errors.
CXXFLAGS = "-std=gnu++23";
env.CXXFLAGS = "-std=gnu++23";
nativeBuildInputs = [
autoreconfHook
+1 -1
View File
@@ -42,7 +42,7 @@ stdenv.mkDerivation (finalAttrs: {
];
# https://github.com/AGWA/git-crypt/issues/232
CXXFLAGS = [
env.CXXFLAGS = toString [
"-DOPENSSL_API_COMPAT=0x30000000L"
];
+1 -1
View File
@@ -41,7 +41,7 @@ stdenv.mkDerivation (finalAttrs: {
freetype
];
CXXFLAGS = [
env.CXXFLAGS = toString [
# GCC 13: error: 'uint32_t' has not been declared
"-include cstdint"
];
+1 -1
View File
@@ -33,7 +33,7 @@ stdenv.mkDerivation (finalAttrs: {
pkg-config
];
CXXFLAGS = "-std=c++98";
env.CXXFLAGS = "-std=c++98";
buildInputs = [
freetype
+1 -1
View File
@@ -49,7 +49,7 @@ stdenv.mkDerivation (finalAttrs: {
];
nativeBuildInputs = [ pkg-config ];
CXXFLAGS = [
env.CXXFLAGS = toString [
"-DHAVE_LROUND"
"-fpermissive"
];
+6 -6
View File
@@ -32,13 +32,13 @@ stdenv.mkDerivation (finalAttrs: {
HYPERROGUE_USE_GLEW = 1;
HYPERROGUE_USE_PNG = 1;
HYPERROGUE_USE_ROGUEVIZ = 1;
};
CXXFLAGS = [
"-I${lib.getDev SDL}/include/SDL"
"-DHYPERPATH='\"${placeholder "out"}/share/hyperrogue/\"'"
"-DRESOURCEDESTDIR=HYPERPATH"
];
CXXFLAGS = toString [
"-I${lib.getDev SDL}/include/SDL"
"-DHYPERPATH='\"${placeholder "out"}/share/hyperrogue/\"'"
"-DRESOURCEDESTDIR=HYPERPATH"
];
};
nativeBuildInputs = [
pkg-config
+2 -1
View File
@@ -32,7 +32,8 @@ stdenv.mkDerivation (finalAttrs: {
pcre
];
nativeBuildInputs = [ cmake ];
CXXFLAGS = [
env.CXXFLAGS = toString [
"-fPIC"
"-O2"
"-w"
+1 -1
View File
@@ -27,7 +27,7 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-JARpxp6Z2VioBfY0pZSyQU2mG/EllbaF3qteSFM9u8o=";
};
CXXFLAGS = [
env.CXXFLAGS = toString [
# GCC 13: error: 'int16_t' has not been declared in 'std'
"-include cstdint"
];
+1 -1
View File
@@ -41,7 +41,7 @@ stdenv.mkDerivation (finalAttrs: {
];
# compat with icu61+ https://github.com/unicode-org/icu/blob/release-64-2/icu4c/readme.html#L554
CXXFLAGS = [ "-DU_USING_ICU_NAMESPACE=1" ];
env.CXXFLAGS = toString [ "-DU_USING_ICU_NAMESPACE=1" ];
passthru = {
updateScript = gitUpdater { rev-prefix = "v"; };
+3 -1
View File
@@ -20,7 +20,9 @@ stdenv.mkDerivation (finalAttrs: {
patches = [ ./libpar2-0.4-external-verification.patch ];
CXXFLAGS = lib.optionalString stdenv.cc.isClang "-std=c++11";
env = lib.optionalAttrs stdenv.cc.isClang {
CXXFLAGS = "-std=c++11";
};
meta = {
homepage = "https://parchive.sourceforge.net/";
+1 -1
View File
@@ -32,7 +32,7 @@ flutter329.buildFlutterApplication rec {
];
# https://github.com/juliansteenbakker/flutter_secure_storage/issues/965
CXXFLAGS = [ "-Wno-deprecated-literal-operator" ];
env.CXXFLAGS = toString [ "-Wno-deprecated-literal-operator" ];
postInstall = ''
substituteInPlace snap/gui/org.proninyaroslav.libretrack.desktop \
+1 -1
View File
@@ -28,7 +28,7 @@ stdenv.mkDerivation (finalAttrs: {
buildInputs = [ gcc-unwrapped ];
CXXFLAGS = [ "-std=c++14" ];
env.CXXFLAGS = toString [ "-std=c++14" ];
configureFlags = [
"--disable-build-html"
+1 -1
View File
@@ -17,7 +17,7 @@ stdenv.mkDerivation {
nativeBuildInputs = [ autoreconfHook ];
CXXFLAGS = "-std=c++11";
env.CXXFLAGS = "-std=c++11";
meta = {
description = "Forked version of log4cpp that has been created for the Shibboleth project";
+1 -1
View File
@@ -21,7 +21,7 @@ buildNpmPackage rec {
nodejs = nodejs_20;
# Prevent Cypress binary download.
CYPRESS_INSTALL_BINARY = 0;
env.CYPRESS_INSTALL_BINARY = 0;
preConfigure = ''
# Make the build.zip target do nothing, since we will just copy these files later.
+1 -1
View File
@@ -35,7 +35,7 @@ flutter338.buildFlutterApplication {
];
# https://github.com/juliansteenbakker/flutter_secure_storage/issues/965
CXXFLAGS = [ "-Wno-deprecated-literal-operator" ];
env.CXXFLAGS = toString [ "-Wno-deprecated-literal-operator" ];
postInstall = ''
install -Dm644 flatpak/io.github.friesi23.mhabit.desktop --target-directory=$out/share/applications
+5 -3
View File
@@ -257,9 +257,11 @@ stdenv.mkDerivation (finalAttrs: {
]
++ lib.optional (builtins.elem "documentation" features_) "man";
CXXFLAGS = lib.optionals stdenv.hostPlatform.isDarwin [
"-D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0"
];
env = lib.optionalAttrs stdenv.hostPlatform.isDarwin {
CXXFLAGS = toString [
"-D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0"
];
};
mesonFlags = [
(lib.mesonBool "test" true)
+1 -1
View File
@@ -133,7 +133,7 @@ stdenv.mkDerivation (finalAttrs: {
"build" + lib.optionalString enableDoxygen " doxygen" + lib.optionalString withManual "sphinx";
# to prevent fatal error: 'backward_warning.h' file not found
CXXFLAGS = "-D_GLIBCXX_PERMIT_BACKWARD_HASH";
env.CXXFLAGS = "-D_GLIBCXX_PERMIT_BACKWARD_HASH";
# Make generated python bindings discoverable in customized python environment
passthru = {
+3 -2
View File
@@ -56,9 +56,10 @@ stdenv.mkDerivation (finalAttrs: {
qpdf
];
CXXFLAGS =
env = lib.optionalAttrs (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "13") {
# Pending upstream compatibility with GCC 13
lib.optional (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "13") "-Wno-changes-meaning";
CXXFLAGS = "-Wno-changes-meaning";
};
meta = {
description = "Simple application to extract, merge, rotate and reorder pages of PDF documents";
+4 -2
View File
@@ -59,9 +59,11 @@ stdenv.mkDerivation (finalAttrs: {
"-DNLOHMANN_JSON_ORIGIN=external"
"-DEXE_SQLITE3=${buildPackages.sqlite}/bin/sqlite3"
];
CXXFLAGS = [
env.CXXFLAGS = toString [
# GCC 13: error: 'int64_t' in namespace 'std' does not name a type
"-include cstdint"
"-include"
"cstdint"
];
preCheck =
+7 -4
View File
@@ -26,10 +26,13 @@ stdenv.mkDerivation (finalAttrs: {
"-DRAPIDFUZZ_BUILD_TESTING=ON"
];
CXXFLAGS = lib.optionals stdenv.cc.isClang [
# error: no member named 'fill' in namespace 'std'
"-include algorithm"
];
env = lib.optionalAttrs stdenv.cc.isClang {
CXXFLAGS = toString [
# error: no member named 'fill' in namespace 'std'
"-include"
"algorithm"
];
};
nativeCheckInputs = [
catch2_3
+1 -1
View File
@@ -27,7 +27,7 @@ stdenv.mkDerivation (finalAttrs: {
"prefix=${placeholder "out"}"
];
CXXFLAGS = [
env.CXXFLAGS = toString [
# GCC 13: error: 'intptr_t' does not name a type
"-include cstdint"
"-include system_error"
+1 -1
View File
@@ -36,7 +36,7 @@ flutter338.buildFlutterApplication {
];
# https://github.com/juliansteenbakker/flutter_secure_storage/issues/965
CXXFLAGS = [ "-Wno-deprecated-literal-operator" ];
env.CXXFLAGS = toString [ "-Wno-deprecated-literal-operator" ];
desktopItems = [
(makeDesktopItem {
+1 -1
View File
@@ -133,7 +133,7 @@ stdenv.mkDerivation (finalAttrs: {
]
);
CXXFLAGS = [
env.CXXFLAGS = toString [
# GCC 13: error: 'uintptr_t' in namespace 'std' does not name a type
"-include cstdint"
];
+1 -1
View File
@@ -40,7 +40,7 @@ stdenv.mkDerivation (finalAttrs: {
expat
];
CXXFLAGS = "-std=c++98";
env.CXXFLAGS = "-std=c++98";
meta = {
description = "Open source full text search server";
+1 -1
View File
@@ -125,7 +125,7 @@ stdenv.mkDerivation (finalAttrs: {
"-DOpenGL_GL_PREFERENCE=GLVND"
];
CXXFLAGS = [
env.CXXFLAGS = toString [
# GCC 13: error: 'snprintf' was not declared in this scope
"-include cstdio"
# GCC 13: error: 'runtime_error' is not a member of 'std'
+1 -1
View File
@@ -18,7 +18,7 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [ pkg-config ];
# use C++14 Standard until error handling code gets updated upstream
CXXFLAGS = [ "-std=c++14" ];
env.CXXFLAGS = toString [ "-std=c++14" ];
# disable flaky networking test
postPatch = ''
+14 -8
View File
@@ -20,14 +20,20 @@ stdenv.mkDerivation (finalAttrs: {
perl # for pod2man
];
CPPFLAGS = [
"-Dunix"
]
++ lib.optional (!stdenv.hostPlatform.isi686 && !stdenv.hostPlatform.isx86_64) "-DNOJIT";
CXXFLAGS = [
"-O3"
"-DNDEBUG"
];
env = {
CPPFLAGS = toString (
[
"-Dunix"
]
++ lib.optionals (!stdenv.hostPlatform.isi686 && !stdenv.hostPlatform.isx86_64) [
"-DNOJIT"
]
);
CXXFLAGS = toString [
"-O3"
"-DNDEBUG"
];
};
enableParallelBuilding = true;
@@ -68,7 +68,7 @@ stdenv.mkDerivation rec {
# Gcc blindly tries to optimize all float operations instead of just marked ones.
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122304
CXXFLAGS = "-ffp-contract=on";
env.CXXFLAGS = "-ffp-contract=on";
cmakeFlags = [
"-DOCIO_INSTALL_EXT_PACKAGES=NONE"
"-DOCIO_USE_SSE2NEON=OFF"
@@ -15,7 +15,9 @@ stdenv.mkDerivation rec {
patches = [ ./2.7.7-fixes.patch ];
buildInputs = [ jdk ];
CXXFLAGS = lib.optionalString stdenv.hostPlatform.isDarwin "-D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION";
env = lib.optionalAttrs stdenv.hostPlatform.isDarwin {
CXXFLAGS = "-D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION";
};
meta = {
description = "Powerful parser generator";