diff options
author | Randy Eckenrode <randy@largeandhighquality.com> | 2023-05-30 15:20:39 -0400 |
---|---|---|
committer | Randy Eckenrode <randy@largeandhighquality.com> | 2023-05-31 23:42:53 -0400 |
commit | 1364837d91fdf2647a7141f60ee8a78b1e1f16ff (patch) | |
tree | 84de599d75cd25e894a95f1deedc74d886763714 /pkgs/tools/archivers/unzip | |
parent | 4265b54868481d29d20a3ec59dbe00aed26ac7c6 (diff) |
unzip: fix configure script when using clang 16
Clang 16 makes implicit int and function declarations an error by default in any mode except for C89. The configure script has two of these that cause it to misdetect features when using Clang 16. * Implicit `int main` in the errno check. This is fixed by adding the missing `int`. * Implicit definitions of `opendir` and `closedir`. These are fixed by including the required headers.
Diffstat (limited to 'pkgs/tools/archivers/unzip')
-rw-r--r-- | pkgs/tools/archivers/unzip/default.nix | 4 | ||||
-rw-r--r-- | pkgs/tools/archivers/unzip/implicit-declarations-fix.patch | 21 |
2 files changed, 25 insertions, 0 deletions
diff --git a/pkgs/tools/archivers/unzip/default.nix b/pkgs/tools/archivers/unzip/default.nix index f61bc9df66d58..b0a4484e87f37 100644 --- a/pkgs/tools/archivers/unzip/default.nix +++ b/pkgs/tools/archivers/unzip/default.nix @@ -60,6 +60,9 @@ stdenv.mkDerivation rec { ]; sha256 = "sha256-on79jElQ+z2ULWAq14RpluAqr9d6itHiZwDkKubBzTc="; }) + # Clang 16 makes implicit declarations an error by default for C99 and newer, causing the + # configure script to fail to detect errno and the directory libraries on Darwin. + ./implicit-declarations-fix.patch ] ++ lib.optional enableNLS (fetchurl { url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/app-arch/unzip/files/unzip-6.0-natspec.patch?id=56bd759df1d0c750a065b8c845e93d5dfa6b549d"; @@ -67,6 +70,7 @@ stdenv.mkDerivation rec { sha256 = "67ab260ae6adf8e7c5eda2d1d7846929b43562943ec4aff629bd7018954058b1"; }); + nativeBuildInputs = [ bzip2 ]; buildInputs = [ bzip2 ] ++ lib.optional enableNLS libnatspec; diff --git a/pkgs/tools/archivers/unzip/implicit-declarations-fix.patch b/pkgs/tools/archivers/unzip/implicit-declarations-fix.patch new file mode 100644 index 0000000000000..df19bf1722f93 --- /dev/null +++ b/pkgs/tools/archivers/unzip/implicit-declarations-fix.patch @@ -0,0 +1,21 @@ +--- a/unix/configure 2009-04-16 15:25:12.000000000 -0400 ++++ b/unix/configure 2023-05-30 15:18:33.670321348 -0400 +@@ -408,7 +408,7 @@ + echo Check for errno declaration + cat > conftest.c << _EOF_ + #include <errno.h> +-main() ++int main() + { + errno = 0; + return 0; +@@ -419,6 +419,8 @@ + + echo Check for directory libraries + cat > conftest.c << _EOF_ ++#include <sys/types.h> ++#include <dirent.h> + int main() { return closedir(opendir(".")); } + _EOF_ + + |