diff --git a/pkgs/by-name/li/libarchive/fix-pkg-config-iconv.patch b/pkgs/by-name/li/libarchive/fix-pkg-config-iconv.patch new file mode 100644 index 000000000000..209a293b460b --- /dev/null +++ b/pkgs/by-name/li/libarchive/fix-pkg-config-iconv.patch @@ -0,0 +1,18 @@ +diff --git a/configure.ac b/configure.ac +index 0fdfaf06a5..d08611848c 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -453,13 +453,8 @@ + AC_CHECK_HEADERS([iconv.h],[],[],[#include ]) + if test "x$am_cv_func_iconv" = "xyes"; then + AC_CHECK_HEADERS([localcharset.h]) +- am_save_LIBS="$LIBS" + LIBS="${LIBS} ${LIBICONV}" +- if test -n "$LIBICONV"; then +- LIBSREQUIRED="$LIBSREQUIRED${LIBSREQUIRED:+ }iconv" +- fi + AC_CHECK_FUNCS([locale_charset]) +- LIBS="${am_save_LIBS}" + if test "x$ac_cv_func_locale_charset" != "xyes"; then + # If locale_charset() is not in libiconv, we have to find libcharset. + AC_CHECK_LIB(charset,locale_charset) diff --git a/pkgs/by-name/li/libarchive/package.nix b/pkgs/by-name/li/libarchive/package.nix index 306c92c6e71a..6ffa2b531441 100644 --- a/pkgs/by-name/li/libarchive/package.nix +++ b/pkgs/by-name/li/libarchive/package.nix @@ -40,6 +40,22 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-maV2+Whi4aDG1VLAYpOTxluO9I0zNiZ8fA3w7epGlDg="; }; + patches = [ + # The `.pc` file lists `iconv` in `Requires.private` when `-liconv` + # is required, even though common platforms in that situation like + # Darwin don’t ship a `.pc` file for their `libiconv`. This isn’t + # upstreamed as there are a handful of closed or regressed PRs + # trying to fix it already and it seems upstream added this to deal + # with some non‐portable MSYS2 thing or something. + # + # See: + # + # * + # * + # * + ./fix-pkg-config-iconv.patch + ]; + outputs = [ "out" "lib" "dev" ]; postPatch = let