From cda171380c45b70443635b4c0cf918e314e1568d Mon Sep 17 00:00:00 2001 From: Vincenzo Mantova <1962985+xworld21@users.noreply.github.com> Date: Mon, 23 Mar 2026 20:12:46 +0000 Subject: [PATCH 1/3] libcupsfilter: link with iconv explicitly on Darwin --- pkgs/by-name/li/libcupsfilters/package.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkgs/by-name/li/libcupsfilters/package.nix b/pkgs/by-name/li/libcupsfilters/package.nix index 05e8fae55327..1ab40fcbd691 100644 --- a/pkgs/by-name/li/libcupsfilters/package.nix +++ b/pkgs/by-name/li/libcupsfilters/package.nix @@ -32,6 +32,18 @@ stdenv.mkDerivation { hash = "sha256-WEcg+NSsny/N1VAR1ejytM+3nOF3JlNuIUPf4w6N2ew="; }; + # Undefined symbols for architecture x86_64: + # "_iconv", referenced from: + # _cfFilterTextToText in libcupsfilters_la-texttotext.o + # "_iconv_close", referenced from: + # _cfFilterTextToText in libcupsfilters_la-texttotext.o + # "_iconv_open", referenced from: + # _cfFilterTextToText in libcupsfilters_la-texttotext.o + # ld: symbol(s) not found for architecture x86_64 + env = lib.optionalAttrs stdenv.hostPlatform.isDarwin { + NIX_LDFLAGS = "-liconv"; + }; + patches = [ (fetchpatch { # https://github.com/OpenPrinting/cups-filters/security/advisories/GHSA-893j-2wr2-wrh9 From 54f60bfa88c9dfa00c28d53321388a911af9ab5a Mon Sep 17 00:00:00 2001 From: Vincenzo Mantova <1962985+xworld21@users.noreply.github.com> Date: Mon, 23 Mar 2026 20:12:46 +0000 Subject: [PATCH 2/3] libcupsfilter: replace execvpe with execve on Darwin --- pkgs/by-name/li/libcupsfilters/execve.patch | 11 +++++++++++ pkgs/by-name/li/libcupsfilters/package.nix | 8 ++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 pkgs/by-name/li/libcupsfilters/execve.patch diff --git a/pkgs/by-name/li/libcupsfilters/execve.patch b/pkgs/by-name/li/libcupsfilters/execve.patch new file mode 100644 index 000000000000..264aec3b77d9 --- /dev/null +++ b/pkgs/by-name/li/libcupsfilters/execve.patch @@ -0,0 +1,11 @@ +--- a/cupsfilters/ghostscript.c ++++ b/cupsfilters/ghostscript.c +@@ -629,7 +629,7 @@ gs_spawn (const char *filename, + } + + // Execute Ghostscript command line ... +- execvpe(filename, gsargv, envp); ++ execve(filename, gsargv, envp); + if (log) log(ld, CF_LOGLEVEL_ERROR, + "cfFilterGhostscript: Unable to launch Ghostscript: %s: %s", + filename, strerror(errno)); diff --git a/pkgs/by-name/li/libcupsfilters/package.nix b/pkgs/by-name/li/libcupsfilters/package.nix index 1ab40fcbd691..984b9fb4ca0e 100644 --- a/pkgs/by-name/li/libcupsfilters/package.nix +++ b/pkgs/by-name/li/libcupsfilters/package.nix @@ -61,7 +61,9 @@ stdenv.mkDerivation { url = "https://github.com/OpenPrinting/libcupsfilters/commit/b69dfacec7f176281782e2f7ac44f04bf9633cfa.patch"; hash = "sha256-rPUbgtTu7j3uUZrtUhUPO1vFbV6naxIWsHf6x3JhS74="; }) - ]; + ] + # build on platforms without execvpe + ++ lib.optional stdenv.hostPlatform.isDarwin ./execve.patch; nativeBuildInputs = [ autoreconfHook @@ -89,7 +91,9 @@ stdenv.mkDerivation { "--with-ippfind-path=${lib.getExe' cups "ippfind"}" "--enable-imagefilters" "--with-test-font-path=${dejavu_fonts}/share/fonts/truetype/DejaVuSans.ttf" - ]; + ] + # build on platforms without execvpe (path to Ghostscript must be absolute) + ++ lib.optional stdenv.hostPlatform.isDarwin "--with-gs-path=${lib.getExe ghostscript}"; makeFlags = [ "CUPS_SERVERBIN=$(out)/lib/cups" "CUPS_DATADIR=$(out)/share/cups" From fcfbb7e3d0bea1d6110fe038f6c2fbb2ae809363 Mon Sep 17 00:00:00 2001 From: Vincenzo Mantova <1962985+xworld21@users.noreply.github.com> Date: Mon, 23 Mar 2026 20:12:46 +0000 Subject: [PATCH 3/3] libcupsfilter: build on all platforms --- pkgs/by-name/li/libcupsfilters/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/by-name/li/libcupsfilters/package.nix b/pkgs/by-name/li/libcupsfilters/package.nix index 984b9fb4ca0e..9a89e9b29886 100644 --- a/pkgs/by-name/li/libcupsfilters/package.nix +++ b/pkgs/by-name/li/libcupsfilters/package.nix @@ -104,6 +104,6 @@ stdenv.mkDerivation { homepage = "https://github.com/OpenPrinting/libcupsfilters"; description = "Backends, filters, and other software that was once part of the core CUPS distribution but is no longer maintained by Apple Inc"; license = lib.licenses.asl20; - platforms = lib.platforms.linux; + platforms = lib.platforms.all; }; }