diff options
author | Randy Eckenrode <randy@largeandhighquality.com> | 2023-06-01 18:50:02 -0400 |
---|---|---|
committer | Randy Eckenrode <randy@largeandhighquality.com> | 2023-06-01 21:02:49 -0400 |
commit | b7d4d9f519342669406874b78fbcf7f28384f39a (patch) | |
tree | 76c11d47a2fa432eea9c30385647c136e714beb4 /pkgs/tools/misc/getopt | |
parent | 323e9a44c251f87da3b77087b9e1f6f36eb719f8 (diff) | |
download | nixpkgs-b7d4d9f519342669406874b78fbcf7f28384f39a.tar nixpkgs-b7d4d9f519342669406874b78fbcf7f28384f39a.tar.gz nixpkgs-b7d4d9f519342669406874b78fbcf7f28384f39a.tar.bz2 nixpkgs-b7d4d9f519342669406874b78fbcf7f28384f39a.tar.lz nixpkgs-b7d4d9f519342669406874b78fbcf7f28384f39a.tar.xz nixpkgs-b7d4d9f519342669406874b78fbcf7f28384f39a.tar.zst nixpkgs-b7d4d9f519342669406874b78fbcf7f28384f39a.zip |
getopt: fix build on clang 16
Normally, when getopt builds on a non-glibc platform, it uses C library headers without including them. That’s fine unless your compiler is clang 16, which is strict about using functions without prototypes. Fortunately, Darwin’s headers are compatible enough as are Musl’s, so defining `__GNU_LIBRARY__` can be done unconditionally.
Diffstat (limited to 'pkgs/tools/misc/getopt')
-rw-r--r-- | pkgs/tools/misc/getopt/default.nix | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/pkgs/tools/misc/getopt/default.nix b/pkgs/tools/misc/getopt/default.nix index c3b94465aea..2090fcbd7aa 100644 --- a/pkgs/tools/misc/getopt/default.nix +++ b/pkgs/tools/misc/getopt/default.nix @@ -8,6 +8,10 @@ stdenv.mkDerivation rec { sha256 = "1zn5kp8ar853rin0ay2j3p17blxy16agpp8wi8wfg4x98b31vgyh"; }; + # This should be fine on Linux and Darwin. Clang 16 requires it because otherwise getopt will + # attempt to use C library functions without declaring them, which is raised as an error. + env.NIX_CFLAGS_COMPILE = "-D__GNU_LIBRARY__"; + makeFlags = [ "WITHOUT_GETTEXT=1" "LIBCGETOPT=0" |