From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maxim Cournoyer Subject: bug#33497: [PATCHv2] Re: bug#33497: Our CMake package has no documentation Date: Wed, 20 Mar 2019 22:08:40 -0400 Message-ID: <87va0d568n.fsf_-_@gmail.com> References: <8736rp649l.fsf@apteryx.i-did-not-set--mail-host-address--so-tickle-me> <87y39h4pfk.fsf@gmail.com> <878sykiwwq.fsf@fastmail.com> <87o96glvvm.fsf@gmail.com> <874l81a26n.fsf@fastmail.com> <875zsd7coj.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:41547) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6nEx-0005kE-7l for bug-guix@gnu.org; Wed, 20 Mar 2019 22:15:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6n8i-0002gu-Em for bug-guix@gnu.org; Wed, 20 Mar 2019 22:09:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39012) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h6n8g-0002eg-7P for bug-guix@gnu.org; Wed, 20 Mar 2019 22:09:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h6n8f-0001xT-UW for bug-guix@gnu.org; Wed, 20 Mar 2019 22:09:01 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <875zsd7coj.fsf@gmail.com> (Maxim Cournoyer's message of "Wed, 20 Mar 2019 12:06:36 -0400") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Marius Bakke Cc: 33497@debbugs.gnu.org --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Here's an improved version, following some comments of Marius on #guix. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-cmake-Generate-documentation.patch Content-Transfer-Encoding: quoted-printable From=202f33a7321e5e37d37f57c229c8079cb4ffd10834 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Wed, 20 Mar 2019 21:38:19 -0400 Subject: [PATCH] cmake: Generate documentation. To prevent complicating the dependencies of a core tool, a new variant, CMAKE-MINIMAL is introduced and the CMake build system is configured to use= it by default. The regular CMAKE package gains a manpage, info manual as well as HTML documentation. Fixes issue #33497 (https://bugs.gnu.org/33497). * gnu/packages/cmake.scm (gnu): Use modules (gnu packages python-xyz), (gnu packages texinfo) and (srfi srfi-1). (cmake-minimal): Rename the original cmake variable to this. [phases]{configure}: Extract the configure script arguments to... [configure-flags]: here. [properties]: Set the HIDDEN? property to #t. (cmake): New variable, which inherits from CMAKE-MINIMAL. [phases]{move-html-doc}: Add phase. [native-inputs]: Add PYTHON-SPHINX and TEXINFO. [outputs]: Add the "doc" output. [properties]: Clear the inherited HIDDEN? property. * guix/build-system/cmake.scm (default-cmake): Use CMAKE-MINIMAL instead of CMAKE. =2D-- gnu/packages/cmake.scm | 94 +++++++++++++++++++++++++++---------- guix/build-system/cmake.scm | 2 +- 2 files changed, 70 insertions(+), 26 deletions(-) diff --git a/gnu/packages/cmake.scm b/gnu/packages/cmake.scm index 7772fbedb1..b999c0c170 100644 =2D-- a/gnu/packages/cmake.scm +++ b/gnu/packages/cmake.scm @@ -8,6 +8,8 @@ ;;; Copyright =C2=A9 2017, 2018 Marius Bakke ;;; Copyright =C2=A9 2018 Arun Isaac ;;; Copyright =C2=A9 2018 Tobias Geerinckx-Rice +;;; Copyright =C2=A9 2019 Maxim Cournoyer + ;;; ;;; This file is part of GNU Guix. ;;; @@ -39,11 +41,16 @@ #:use-module (gnu packages file) #:use-module (gnu packages libevent) #:use-module (gnu packages ncurses) =2D #:use-module (gnu packages xml)) + #:use-module (gnu packages python-xyz) + #:use-module (gnu packages texinfo) + #:use-module (gnu packages xml) + #:use-module (srfi srfi-1)) =20 =2D(define-public cmake +;;; This minimal variant of CMake does not include the documentation. It is +;;; used by the cmake-build-system. +(define-public cmake-minimal (package =2D (name "cmake") + (name "cmake-minimal") (version "3.14.0") (source (origin (method url-fetch) @@ -72,6 +79,23 @@ (build-system gnu-build-system) (arguments `(#:test-target "test" + #:configure-flags + (let ((out (assoc-ref %outputs "out")) + (parallel-job-count (number->string (parallel-job-count)))) + (list "--verbose" + (string-append "--parallel=3D" parallel-job-count) + (string-append "--prefix=3D" out) + "--system-libs" + "--no-system-jsoncpp" ; FIXME: Circular dependency. + ;; By default, the man pages and other docs land + ;; in PREFIX/man and PREFIX/doc, but we want them + ;; in share/{man,doc}. Note that unlike + ;; autoconf-generated configure scripts, cmake's + ;; configure prepends "PREFIX/" to what we pass + ;; to --mandir and --docdir. + "--mandir=3Dshare/man" + ,(string-append "--docdir=3Dshare/doc/cmake-" + (version-major+minor version)))) #:make-flags (let ((skipped-tests (list "BundleUtilities" ; This test fails on Guix. @@ -119,25 +143,10 @@ (setenv "CMAKE_INCLUDE_PATH" (or (getenv "CPATH") (getenv "C_INCLUDE_PATH"))) #t))) + ;; CMake uses its own configure script. (replace 'configure =2D (lambda* (#:key outputs #:allow-other-keys) =2D (let ((out (assoc-ref outputs "out"))) =2D (invoke =2D "./configure" "--verbose" =2D (string-append "--parallel=3D" (number->string (parallel= -job-count))) =2D (string-append "--prefix=3D" out) =2D "--system-libs" =2D "--no-system-jsoncpp" ; FIXME: Circular dependency. =2D ;; By default, the man pages and other docs land =2D ;; in PREFIX/man and PREFIX/doc, but we want them =2D ;; in share/{man,doc}. Note that unlike =2D ;; autoconf-generated configure scripts, cmake's =2D ;; configure prepends "PREFIX/" to what we pass =2D ;; to --mandir and --docdir. =2D "--mandir=3Dshare/man" =2D ,(string-append =2D "--docdir=3Dshare/doc/cmake-" =2D (version-major+minor version))))))))) + (lambda* (#:key (configure-flags '()) #:allow-other-keys) + (apply invoke "./configure" configure-flags)))))) (inputs `(("bzip2" ,bzip2) ("curl" ,curl) @@ -159,12 +168,47 @@ CMake is used to control the software compilation process using simple pla= tform and compiler independent configuration files. CMake generates native make= files and workspaces that can be used in the compiler environment of your choice= .") =2D (license (list license:bsd-3 ; cmake =2D license:bsd-4 ; cmcompress =2D license:bsd-2 ; cmlibarchive =2D license:expat ; cmjsoncpp is dual MIT/pub= lic domain + (properties '((hidden? . #t))) + (license (list license:bsd-3 ; cmake + license:bsd-4 ; cmcompress + license:bsd-2 ; cmlibarchive + license:expat ; cmjsoncpp is dual MIT/public dom= ain license:public-domain)))) ; cmlibarchive/archive_getdat= e.c =20 +(define-public cmake + (package + (inherit cmake-minimal) + (name "cmake") + (arguments + (substitute-keyword-arguments (package-arguments cmake-minimal) + ((#:configure-flags configure-flags ''()) + `(append ,configure-flags + ;; Extra configure flags used to generate the documentatio= n. + '("--sphinx-info" + "--sphinx-man" + "--sphinx-html"))) + ((#:phases phases) + `(modify-phases ,phases + (add-after 'install 'move-html-doc + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out")) + (doc (assoc-ref outputs "doc")) + (html (string-append "/share/doc/cmake-" + ,(version-major+minor + (package-version cmake-minimal= )) + "/html"))) + (copy-recursively (string-append out html) + (string-append doc html)) + (delete-file-recursively (string-append out html)) + #t))))))) + ;; Extra inputs required to build the documentation. + (native-inputs + `(,@(package-native-inputs cmake-minimal) + ("python-sphinx" ,python-sphinx) + ("texinfo" ,texinfo))) + (outputs '("out" "doc")) + (properties (alist-delete 'hidden? (package-properties cmake-minimal))= ))) + (define-public emacs-cmake-mode (package (inherit cmake) diff --git a/guix/build-system/cmake.scm b/guix/build-system/cmake.scm index ee116c5a4c..ca88fadddf 100644 =2D-- a/guix/build-system/cmake.scm +++ b/guix/build-system/cmake.scm @@ -48,7 +48,7 @@ =20 ;; Do not use `@' to avoid introducing circular dependencies. (let ((module (resolve-interface '(gnu packages cmake)))) =2D (module-ref module 'cmake))) + (module-ref module 'cmake-minimal))) =20 (define* (lower name #:key source inputs native-inputs outputs system target =2D-=20 2.20.1 --=-=-= Content-Type: text/plain Maxim --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEJ9WGpPiQCFQyn/CfEmDkZILmNWIFAlyS8igACgkQEmDkZILm NWIEYQ/+Jf2hwHsPwgPmpAxd09jqdNTrnG8dtlbEzdKA+ObJh6nxdkHObgSvCnjl oV7Sq4DJ0YFMQ5QcSwCoL/v/auMGKEE6CtOdxZn9ighVbbW3bnynJBddM9LsZxLR GfaiswavIJ0NDCLkdCWcdznvDmAHN4QjcmlDj7sV8yuFk6j7BffTuoEpp/tKlhoL vBtXb3Z+yWzrWidtgEqq2cJXCmb5cdL9wLidqhwd1mjdRHR6dQCSg7NUBN3MhyhF slDBojl6Cmxajkd8yuRmDJLfBDyRSza9ZLMyd/yMq384qFZaMuodNValu9jc7lzH 0L53MSyF9IHoPR3eCE/o1ibL/xZaa95+lD7EAr3reON94yITL/b0Ih/AI3JyhTKL NtEbZgFGsnIQ73qdIMbCtIpn3Jt0HggrXDc2REadAQ7gywlLsjWiTwzuyNwGDoNx Cj5/UNj3MstkJQlo1pl49geooG5IeuCTVvknzohyD5f7lefXMDfLuO0haPSrQ8vD C47drQt9Oz+aK06PlDC/M3XPEHWc7xU5cXh8tvikIR1kq9hvoP10QPXe1uA64Wp/ mEFO5HzkhS2Dyn7Jwc4bL/00aBfWu0QfTDN1ZuWY9Fn6RVDqlNO5BWsq8ZWTX6RX EUbCh1tTIPwr81lTanjxpQHzk/r5N4ZY+q3TF0gTUI+IhTkSrvA= =9Yzm -----END PGP SIGNATURE----- --==-=-=--