diff mbox series

[bug#65706,v2] gnu: enblend-enfuse: Build documentation.

Message ID 1222de9925d3a85970baf278d17f393b5b14b48b.1693925945.git.mirai@makinata.eu
State New
Headers show
Series [bug#65706,v2] gnu: enblend-enfuse: Build documentation. | expand

Commit Message

Bruno Victal Sept. 5, 2023, 2:59 p.m. UTC
Notes:
* transfig is not needed according to the NEWS since 4.2.
* help2man is not optional.

* gnu/packages/photo.scm (enblend-enfuse)[native-inputs]: Remove libxml2,
tidy-html and transfig. Replace imagemagick with imagemagick/stable. Add
graphviz-minimal, font-ghostscript, librsvg, m4, perl-readonly,
texlive-texloganalyser, texlive-bold-extra, texlive-cm-mf-extra-bold,
texlive-comment, texlive-float, texlive-enumitem, texlive-mdwtools,
texlive-hyphenat, texlive-index, texlive-listings, texlive-microtype,
texlive-etoolbox, texlive-nag, texlive-ragged2e, texlive-shorttoc,
texlive-bigfoot, texlive-xstring and hevea.
[arguments]<#:phases>: Restyle. Add 'fontconfig-cache, 'exclude-doc-from-check
and 'install-doc. Replace 'build and 'install.
[outputs]: Add 'doc.
---
 gnu/packages/photo.scm | 101 ++++++++++++++++++++++++++++++++++-------
 1 file changed, 85 insertions(+), 16 deletions(-)


base-commit: 5ff0c8997a2ddf71af477883584a5f9ccd9b757f

Comments

Maxim Cournoyer Sept. 6, 2023, 9:01 p.m. UTC | #1
Hi,

Bruno Victal <mirai@makinata.eu> writes:

> Notes:
> * transfig is not needed according to the NEWS since 4.2.
> * help2man is not optional.
>
> * gnu/packages/photo.scm (enblend-enfuse)[native-inputs]: Remove libxml2,
> tidy-html and transfig. Replace imagemagick with imagemagick/stable. Add
> graphviz-minimal, font-ghostscript, librsvg, m4, perl-readonly,
> texlive-texloganalyser, texlive-bold-extra, texlive-cm-mf-extra-bold,
> texlive-comment, texlive-float, texlive-enumitem, texlive-mdwtools,
> texlive-hyphenat, texlive-index, texlive-listings, texlive-microtype,
> texlive-etoolbox, texlive-nag, texlive-ragged2e, texlive-shorttoc,
> texlive-bigfoot, texlive-xstring and hevea.
> [arguments]<#:phases>: Restyle. Add 'fontconfig-cache, 'exclude-doc-from-check
> and 'install-doc. Replace 'build and 'install.
> [outputs]: Add 'doc.

[...]

>      (inputs
>       (list boost
>             gsl
> @@ -395,16 +419,61 @@ (define-public enblend-enfuse
>             vigra
>             zlib))
>      (arguments
> -     (list #:configure-flags
> -           #~(list "--enable-openmp")
> -           #:phases
> -           #~(modify-phases %standard-phases
> -               (add-after 'unpack 'add-missing-include
> -                 (lambda _
> -                   (substitute* "src/minimizer.h"
> -                     ;; Fix error: ‘numeric_limits’ is not a member of ‘std’.
> -                     (("#include <vector>" line)
> -                      (string-append line "\n#include <limits>"))))))))
> +     (list
> +      #:configure-flags
> +      #~(list "--enable-openmp")
> +      #:phases
> +      #~(modify-phases %standard-phases
> +          (add-after 'unpack 'add-missing-include
> +            (lambda _
> +              (substitute* "src/minimizer.h"
> +                ;; Fix error: ‘numeric_limits’ is not a member of ‘std’.
> +                (("#include <vector>" line)
> +                 (string-append line "\n#include <limits>")))))
> +          (add-before 'build 'fontconfig-cache
> +            (lambda _
> +              (setenv "XDG_CACHE_HOME" (mkdtemp "/tmp/cache-XXXXXX"))))
> +          ;; XXX: There's some extreme sillyness when building the
> +          ;; documentation. It gets rebuilt thrice, during build, check and
> +          ;; install, possibly due to the effects of the invocation of
> +          ;; UPDATED_ON in doc/Makefile.
> +          ;; I suspect the package might also have reproducibility issues
> +          ;; with the manual and src/DefaultSig.pm. (not an exhaustive list)
> +          ;; It's worth asking upstream for help with adding support
> +          ;; for SOURCE_DATE_EPOCH.

Stylistic nitpick: we don't voice the comments using the first person
(e.g. 'I') in the code typically; we try to stick to being descriptive
and factual.

If it's worth asking upstream, we should ask them now, and link to the
upstream issue in the comment to track its resolution :-).

> +          (add-after 'configure 'exclude-doc-from-check
> +            (lambda _
> +              (substitute* "doc/Makefile"
> +                (("^(check:).+$" _ rule)
> +                 (string-append rule "\n")))))
> +          ;; XXX: Skip building the docs since they're rebuilt again
> +          ;; during install.
> +          (replace 'build
> +            (lambda args
> +              (with-directory-excursion "src"
> +                (apply (assoc-ref %standard-phases 'build) args))))
> +          ;; XXX: Save another doc rebuild when installing.
> +          (replace 'install
> +            ;; Intercept and insert a make-flag for this phase only.
> +            (lambda* (#:key make-flags #:allow-other-keys)
> +              (apply invoke "make" "install"
> +                     (cons "MAYBE_DOC=" make-flags))))
> +          ;; XXX: 'make install' doesn't install the docs.
> +          (add-after 'install 'install-doc
> +            (lambda* (#:key make-flags #:allow-other-keys)
> +              ;; Install examples first, for which the 'install' rule works.
> +              (with-directory-excursion "doc/examples"
> +                (apply invoke "make" "install" make-flags))
> +              ;; The docs have to be installed with specific rules.
> +              (with-directory-excursion "doc"
> +                (apply invoke "make"
> +                       "install-ps-local"
> +                       "install-html-local"
> +                       "install-dvi-local"
> +                       ;; Do not overwhelm the console by printing the source
> +                       ;; to stdout.
> +                       (cons "V=0" make-flags))))))))
> +    (outputs '("out" "doc"))

nitpick: it's more conventional to have the 'outputs' field before the
'build-system' one.

Otherwise, I built it locally and it LGTM.
diff mbox series

Patch

diff --git a/gnu/packages/photo.scm b/gnu/packages/photo.scm
index b290e2b29a..5157a24fb9 100644
--- a/gnu/packages/photo.scm
+++ b/gnu/packages/photo.scm
@@ -11,6 +11,7 @@ 
 ;;; Copyright © 2020. 2021, 2022 Vinicius Monego <monego@posteo.net>
 ;;; Copyright © 2022, 2023 John Kehayias <john.kehayias@protonmail.com>
 ;;; Copyright © 2022 Sharlatan Hellseher <sharlatanus@gmail.com>
+;;; Copyright © 2023 Bruno Victal <mirai@makinata.eu>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -60,6 +61,7 @@  (define-module (gnu packages photo)
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages graphics)
+  #:use-module (gnu packages graphviz)
   #:use-module (gnu packages gstreamer)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages image)
@@ -70,8 +72,10 @@  (define-module (gnu packages photo)
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages llvm)
   #:use-module (gnu packages lua)
+  #:use-module (gnu packages m4)
   #:use-module (gnu packages man)
   #:use-module (gnu packages maths)
+  #:use-module (gnu packages ocaml)
   #:use-module (gnu packages opencl)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
@@ -376,14 +380,34 @@  (define-public enblend-enfuse
      (list pkg-config
            perl
            perl-timedate
+           help2man
            ;; For building the documentation.
            gnuplot
-           help2man
-           imagemagick
-           libxml2
-           (texlive-updmap.cfg)
-           tidy-html
-           transfig))
+           graphviz-minimal  ; for 'dot'
+           font-ghostscript
+           imagemagick/stable
+           librsvg
+           m4
+           perl-readonly
+           texlive-texloganalyser
+           (texlive-updmap.cfg
+            (list texlive-bold-extra
+                  texlive-cm-mf-extra-bold
+                  texlive-comment
+                  texlive-float
+                  texlive-enumitem
+                  texlive-mdwtools
+                  texlive-hyphenat
+                  texlive-index
+                  texlive-listings
+                  texlive-microtype
+                  texlive-etoolbox  ;used but not propagated by microtype
+                  texlive-nag
+                  texlive-ragged2e
+                  texlive-shorttoc
+                  texlive-bigfoot
+                  texlive-xstring))
+           hevea))
     (inputs
      (list boost
            gsl
@@ -395,16 +419,61 @@  (define-public enblend-enfuse
            vigra
            zlib))
     (arguments
-     (list #:configure-flags
-           #~(list "--enable-openmp")
-           #:phases
-           #~(modify-phases %standard-phases
-               (add-after 'unpack 'add-missing-include
-                 (lambda _
-                   (substitute* "src/minimizer.h"
-                     ;; Fix error: ‘numeric_limits’ is not a member of ‘std’.
-                     (("#include <vector>" line)
-                      (string-append line "\n#include <limits>"))))))))
+     (list
+      #:configure-flags
+      #~(list "--enable-openmp")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'add-missing-include
+            (lambda _
+              (substitute* "src/minimizer.h"
+                ;; Fix error: ‘numeric_limits’ is not a member of ‘std’.
+                (("#include <vector>" line)
+                 (string-append line "\n#include <limits>")))))
+          (add-before 'build 'fontconfig-cache
+            (lambda _
+              (setenv "XDG_CACHE_HOME" (mkdtemp "/tmp/cache-XXXXXX"))))
+          ;; XXX: There's some extreme sillyness when building the
+          ;; documentation. It gets rebuilt thrice, during build, check and
+          ;; install, possibly due to the effects of the invocation of
+          ;; UPDATED_ON in doc/Makefile.
+          ;; I suspect the package might also have reproducibility issues
+          ;; with the manual and src/DefaultSig.pm. (not an exhaustive list)
+          ;; It's worth asking upstream for help with adding support
+          ;; for SOURCE_DATE_EPOCH.
+          (add-after 'configure 'exclude-doc-from-check
+            (lambda _
+              (substitute* "doc/Makefile"
+                (("^(check:).+$" _ rule)
+                 (string-append rule "\n")))))
+          ;; XXX: Skip building the docs since they're rebuilt again
+          ;; during install.
+          (replace 'build
+            (lambda args
+              (with-directory-excursion "src"
+                (apply (assoc-ref %standard-phases 'build) args))))
+          ;; XXX: Save another doc rebuild when installing.
+          (replace 'install
+            ;; Intercept and insert a make-flag for this phase only.
+            (lambda* (#:key make-flags #:allow-other-keys)
+              (apply invoke "make" "install"
+                     (cons "MAYBE_DOC=" make-flags))))
+          ;; XXX: 'make install' doesn't install the docs.
+          (add-after 'install 'install-doc
+            (lambda* (#:key make-flags #:allow-other-keys)
+              ;; Install examples first, for which the 'install' rule works.
+              (with-directory-excursion "doc/examples"
+                (apply invoke "make" "install" make-flags))
+              ;; The docs have to be installed with specific rules.
+              (with-directory-excursion "doc"
+                (apply invoke "make"
+                       "install-ps-local"
+                       "install-html-local"
+                       "install-dvi-local"
+                       ;; Do not overwhelm the console by printing the source
+                       ;; to stdout.
+                       (cons "V=0" make-flags))))))))
+    (outputs '("out" "doc"))
     (home-page "https://enblend.sourceforge.net/")
     (synopsis "Tools for combining and blending images")
     (description