From 498b5e578a29d3b5a4e0cb155db6e02f8442d34b Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Thu, 27 May 2021 22:53:40 +0200 Subject: [PATCH] cmake: Add man and info outputs By default, the cmake derivation contains the documentation in .rst format. This format is not well suited for interactive use. Therefore, we add both man and info outputs and convert the documentation to these formats using Sphinx. These formats are enabled by default only in cmake versions for interactive use (ncurses, Qt), because using Sphinx in the basic version leads to circular dependency (infinite recursion). Namely, Sphinx has imagemagick in its checkInputs and imagemagick has several transitive dependencies, which have cmake in nativeBuildInputs. --- .../tools/build-managers/cmake/default.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkgs/development/tools/build-managers/cmake/default.nix b/pkgs/development/tools/build-managers/cmake/default.nix index b04eac35b05c..702652db878b 100644 --- a/pkgs/development/tools/build-managers/cmake/default.nix +++ b/pkgs/development/tools/build-managers/cmake/default.nix @@ -8,6 +8,7 @@ , useOpenSSL ? !isBootstrap, openssl , useNcurses ? false, ncurses , withQt5 ? false, qtbase +, buildDocs ? (!isBootstrap && (useNcurses || withQt5)), sphinx, texinfo }: stdenv.mkDerivation (rec { @@ -35,14 +36,16 @@ stdenv.mkDerivation (rec { ] ++ lib.optional stdenv.isCygwin ./3.2.2-cygwin.patch; - outputs = [ "out" ]; + outputs = [ "out" ] + ++ lib.optionals buildDocs [ "man" "info" ]; setOutputFlags = false; setupHook = ./setup-hook.sh; depsBuildBuild = [ buildPackages.stdenv.cc ]; - nativeBuildInputs = [ setupHook pkg-config ]; + nativeBuildInputs = [ setupHook pkg-config ] + ++ lib.optionals buildDocs [ texinfo ]; buildInputs = [] ++ lib.optionals useSharedLibraries [ bzip2 curlMinimal expat libarchive xz zlib libuv rhash ] @@ -68,6 +71,11 @@ stdenv.mkDerivation (rec { "--docdir=share/doc/${pname}${version}" ] ++ (if useSharedLibraries then [ "--no-system-jsoncpp" "--system-libs" ] else [ "--no-system-libs" ]) # FIXME: cleanup ++ lib.optional withQt5 "--qt-gui" + ++ lib.optionals buildDocs [ + "--sphinx-build=${sphinx}/bin/sphinx-build" + "--sphinx-man" + "--sphinx-info" + ] # Workaround https://gitlab.kitware.com/cmake/cmake/-/issues/20568 ++ lib.optionals stdenv.hostPlatform.is32bit [ "CFLAGS=-D_FILE_OFFSET_BITS=64"