Subject: [PATCH 8/8] gnu: docbook-dsssl: Switch to copy-build-system.

From: Bruno Victal <[email-masked]>
Date: Wed, 26 Apr 2023 01:57:00 +0100

* gnu/packages/docbook.scm
(docbook-dsssl)[build-system]: Switch to copy-build-system.
[arguments]: Add phase to install documentation as separate output.
(docbook-dsssl-doc)[build-system]: Switch to copy-build-system.
[arguments]: Adapt to new build-system.
---
 gnu/packages/docbook.scm | 54 ++++++++++++++--------------------------
 1 file changed, 18 insertions(+), 36 deletions(-)

diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index ced174b3b8..4a911bcec7 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -514,25 +514,22 @@ (define-public docbook-dsssl
               (sha256
                (base32
                 "1g72y2yyc2k89kzs0lvrb9n7hjayw1hdskfpplpz97pf1c99wcig"))))
-    (build-system trivial-build-system)
+    (build-system copy-build-system)
     (outputs '("out" "doc"))
     (arguments
-     `(#:modules ((guix build utils))
-       #:builder
-       (begin
-         (use-modules (guix build utils))
-         (let ((source (assoc-ref %build-inputs "source"))
-               (dtd (string-append (assoc-ref %outputs "out")
-                                   "/sgml/dtd/docbook"))
-               (docbook-dsssl-doc (assoc-ref %build-inputs "docbook-dsssl-doc"))
-               (doc (assoc-ref %outputs "doc"))
-               (tar (assoc-ref %build-inputs "tar"))
-               (bzip2 (assoc-ref %build-inputs "bzip2")))
-           (setenv "PATH" (string-append tar "/bin" ":" bzip2 "/bin"))
-           (mkdir-p dtd)
-           (invoke "tar" "-xf" source "-C" dtd)
-           ;; The doc output contains 1.4 MiB of HTML documentation.
-           (symlink docbook-dsssl-doc doc)))))
+     (list
+      #:install-plan
+      #~`(("./" "sgml/dtd/docbook/"
+           #:exclude ("doc" "docsrc")))
+      #:phases
+      #~(modify-phases %standard-phases
+          ;; The doc output contains 1.4 MiB of HTML documentation.
+          (add-after 'install 'install-doc
+            (lambda* (#:key inputs #:allow-other-keys)
+              (mkdir-p (string-append #$output:doc "/share/doc"))
+              (symlink (assoc-ref inputs "docbook-dsssl-doc")
+                       (format #f "~a/share/doc/~a-~a"
+                               #$output:doc #$name #$version)))))))
     (inputs
      (list docbook-dsssl-doc))
     (native-inputs
@@ -555,26 +552,11 @@ (define docbook-dsssl-doc
               (sha256
                (base32
                 "1plp5ngc96pbna4rwglp9glcadnirbm3hlcjb4gjvq1f8biic9lz"))))
-    (build-system trivial-build-system)
+    (build-system copy-build-system)
     (arguments
-     `(#:modules ((guix build utils))
-       #:builder
-       (begin
-         (use-modules (guix build utils))
-         (let ((source (assoc-ref %build-inputs "source"))
-               (docdir (string-append (assoc-ref %outputs "out")
-                                      "/share/doc/" "docbook-dsssl-" ,version))
-               (tar (assoc-ref %build-inputs "tar"))
-               (bzip2 (assoc-ref %build-inputs "bzip2")))
-           (setenv "PATH" (string-append tar "/bin" ":" bzip2 "/bin"))
-           (mkdir-p docdir)
-           ;; Extract the "doc" subdirectory.
-           (invoke "tar" "-xf" source "--strip-components=2"
-                   "--no-same-owner" "-C" docdir
-                   (string-append "docbook-dsssl-" ,version "/doc"))))))
-    (native-inputs
-     `(("bzip2" ,bzip2)
-       ("tar" ,tar)))
+     (list
+      #:install-plan
+      #~`(("doc/" #$(string-append "/share/doc/docbook-dsssl-" version)))))
     (home-page "https://docbook.org/")
     (synopsis "DocBook DSSSL style sheets documentation")
     (description "Documentation for the DocBook DSSSL style sheets.")
-- 
2.39.2