From b5ca14bb98534a73d0113d8e4ce555c580553c15 Mon Sep 17 00:00:00 2001 From: Emily Date: Tue, 19 Nov 2024 11:39:30 +0000 Subject: [PATCH] libarchive: add patch to fix `.pc` file (cherry picked from commit 505530e3de15f4b3599416b15cb08a12fe7671ae) --- .../li/libarchive/fix-pkg-config-iconv.patch | 18 ++++++++++++++++++ pkgs/by-name/li/libarchive/package.nix | 16 ++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 pkgs/by-name/li/libarchive/fix-pkg-config-iconv.patch 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 8703c1a4faba..12f8c8292646 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