Skip to content

Commit

Permalink
phps: Clean up NIX_CFLAGS_COMPILE
Browse files Browse the repository at this point in the history
concatenate all the flags from array and also move to `env` attribute
  • Loading branch information
jtojnar committed Jan 23, 2025
1 parent 249bd98 commit c948675
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions pkgs/phps.nix
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,32 @@ let
done
''
+ attrs.preConfigure;
}
// lib.optionalAttrs (prev.stdenv.cc.isClang) {
# Downgrade the following errors to warnings. `-Wint-conversion` only affects PHP 7.3.
NIX_CFLAGS_COMPILE =
(attrs.NIX_CFLAGS_COMPILE or "")
+ lib.optionalString (lib.versionOlder args.version "8.2") " -Wno-compare-distinct-pointer-types -Wno-implicit-const-int-float-conversion -Wno-deprecated-declarations -Wno-incompatible-function-pointer-types -Wno-incompatible-pointer-types-discards-qualifiers"
+ lib.optionalString (lib.versionOlder args.version "8.0") " -Wno-implicit-int -Wno-implicit-function-declaration"
+ lib.optionalString (
lib.versionAtLeast args.version "7.3" && lib.versionOlder args.version "7.4"
) " -Wno-int-conversion";

env =
let
extraCompileFlags = lib.optionals prev.stdenv.cc.isClang (
# Downgrade the following errors to warnings.
lib.optionals (lib.versionOlder args.version "8.2") [
"-Wno-compare-distinct-pointer-types"
"-Wno-implicit-const-int-float-conversion"
"-Wno-deprecated-declarations"
"-Wno-incompatible-function-pointer-types"
"-Wno-incompatible-pointer-types-discards-qualifiers"
]
++ lib.optionals (lib.versionOlder args.version "8.0") [
"-Wno-implicit-int"
"-Wno-implicit-function-declaration"
]
++ lib.optionals (lib.versionAtLeast args.version "7.3" && lib.versionOlder args.version "7.4") [
"-Wno-int-conversion"
]
);
in
attrs.env or { }
// lib.optionalAttrs (extraCompileFlags != [ ]) {
NIX_CFLAGS_COMPILE =
(attrs.env.NIX_CFLAGS_COMPILE or "") + lib.concatStringsSep " " extraCompileFlags;
};
};

# For passing libxml2 and pcre2 to php-packages.nix.
Expand Down

0 comments on commit c948675

Please sign in to comment.