diff --git a/pkgs/by-name/li/libfyaml/package.nix b/pkgs/by-name/li/libfyaml/package.nix index 26cc0461020b..7a7e5dc089c6 100644 --- a/pkgs/by-name/li/libfyaml/package.nix +++ b/pkgs/by-name/li/libfyaml/package.nix @@ -34,6 +34,10 @@ stdenv.mkDerivation (finalAttrs: { url = "https://github.com/pantoniou/libfyaml/commit/9192deaac095f9881cc1e5756dede683f36b09d6.diff"; hash = "sha256-cNL9wQtxIRg/ShZLJP4qHYNFRrYo9kRG+/U+3FiUeaI="; }) + # On Darwin, AX_PTHREAD returns empty PTHREAD_LIBS with -pthread in PTHREAD_CFLAGS; + # don't force -lpthread when PTHREAD_CFLAGS already provides pthread support. + # Pending PR: https://github.com/pantoniou/libfyaml/pull/294 + ./pthread-darwin.patch ]; nativeBuildInputs = [ diff --git a/pkgs/by-name/li/libfyaml/pthread-darwin.patch b/pkgs/by-name/li/libfyaml/pthread-darwin.patch new file mode 100644 index 000000000000..bada0d80d142 --- /dev/null +++ b/pkgs/by-name/li/libfyaml/pthread-darwin.patch @@ -0,0 +1,12 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -99,6 +99,7 @@ + AX_PTHREAD([], [AC_MSG_ERROR("Missing required pthread support")]) + +-# in some cases PTHREAD_LIBS is empty - force -lpthread */ +-if test "x$PTHREAD_LIBS" = "x"; then ++# In some cases PTHREAD_LIBS is empty; force -lpthread only when PTHREAD_CFLAGS ++# also provides no pthread support (e.g. on Darwin, -pthread in CFLAGS suffices). ++if test "x$PTHREAD_LIBS" = "x" && test "x$PTHREAD_CFLAGS" = "x"; then + PTHREAD_LIBS="-lpthread" + fi