From be3845b696f29bc49b430bbb2de2edeff2e2e534 Mon Sep 17 00:00:00 2001 From: jopejoe1 Date: Sun, 4 May 2025 11:40:46 +0200 Subject: [PATCH] libcdio: make manpages optional manpages fail to cross compile --- pkgs/by-name/li/libcdio/package.nix | 62 ++++++++++++++++++----------- 1 file changed, 39 insertions(+), 23 deletions(-) diff --git a/pkgs/by-name/li/libcdio/package.nix b/pkgs/by-name/li/libcdio/package.nix index 73f1f6de7667..94a8d43df4b4 100644 --- a/pkgs/by-name/li/libcdio/package.nix +++ b/pkgs/by-name/li/libcdio/package.nix @@ -11,6 +11,7 @@ ncurses, help2man, libiconv, + withMan ? stdenv.buildPlatform.canExecute stdenv.hostPlatform, }: stdenv.mkDerivation (finalAttrs: { @@ -28,26 +29,38 @@ stdenv.mkDerivation (finalAttrs: { NIX_CFLAGS_COMPILE = "-D_LARGEFILE64_SOURCE"; }; - postPatch = '' - patchShebangs . - echo " - @set UPDATED 1 January 1970 - @set UPDATED-MONTH January 1970 - @set EDITION ${finalAttrs.version} - @set VERSION ${finalAttrs.version} - " > doc/version.texi - ''; + postPatch = + '' + patchShebangs . + echo " + @set UPDATED 1 January 1970 + @set UPDATED-MONTH January 1970 + @set EDITION ${finalAttrs.version} + @set VERSION ${finalAttrs.version} + " > doc/version.texi + '' + + lib.optionalString (!withMan) '' + substituteInPlace src/Makefile.am \ + --replace-fail 'man_cd_drive = cd-drive.1' "" \ + --replace-fail 'man_cd_info = cd-info.1' "" \ + --replace-fail 'man_cd_read = cd-read.1' "" \ + --replace-fail 'man_iso_info = iso-info.1' "" \ + --replace-fail 'man_iso_read = iso-read.1' "" + ''; configureFlags = [ - (lib.enableFeature true "maintainer-mode") + (lib.enableFeature withMan "maintainer-mode") ]; - nativeBuildInputs = [ - pkg-config - help2man - autoreconfHook - texinfo - ]; + nativeBuildInputs = + [ + pkg-config + autoreconfHook + texinfo + ] + ++ lib.optionals withMan [ + help2man + ]; buildInputs = [ libcddb @@ -59,13 +72,16 @@ stdenv.mkDerivation (finalAttrs: { doCheck = !stdenv.hostPlatform.isDarwin; - outputs = [ - "out" - "lib" - "dev" - "info" - "man" - ]; + outputs = + [ + "out" + "lib" + "dev" + "info" + ] + ++ lib.optionals withMan [ + "man" + ]; passthru = { tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;