diff options
| author | Andrew Whatson <whatson@gmail.com> | 2021-08-27 14:15:36 +1000 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2021-09-13 12:31:11 +0200 |
| commit | 9266291b10196824a30797c769d5498ea8fb8fa3 (patch) | |
| tree | 482c00552c2b2e5be033205933a0dbc4846803ef /gnu | |
| parent | 844a6caa2e119f271f50f1344305f1acdf235076 (diff) | |
gnu: Add docbook2x.
* gnu/packages/docbook.scm (docbook2x): New variable.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu')
| -rw-r--r-- | gnu/packages/docbook.scm | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm index 6a69f8cf892..ba90376e8ba 100644 --- a/gnu/packages/docbook.scm +++ b/gnu/packages/docbook.scm | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | ;;; Copyright © 2020 Marius Bakke <marius@gnu.org> | 6 | ;;; Copyright © 2020 Marius Bakke <marius@gnu.org> |
| 7 | ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com> | 7 | ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com> |
| 8 | ;;; Copyright © 2021 Mark H Weaver <mhw@netris.org> | 8 | ;;; Copyright © 2021 Mark H Weaver <mhw@netris.org> |
| 9 | ;;; Copyright © 2021 Andrew Whatson <whatson@gmail.com> | ||
| 9 | ;;; | 10 | ;;; |
| 10 | ;;; This file is part of GNU Guix. | 11 | ;;; This file is part of GNU Guix. |
| 11 | ;;; | 12 | ;;; |
| @@ -24,10 +25,13 @@ | |||
| 24 | 25 | ||
| 25 | (define-module (gnu packages docbook) | 26 | (define-module (gnu packages docbook) |
| 26 | #:use-module (gnu packages) | 27 | #:use-module (gnu packages) |
| 28 | #:use-module (gnu packages bash) | ||
| 27 | #:use-module (gnu packages compression) | 29 | #:use-module (gnu packages compression) |
| 28 | #:use-module (gnu packages imagemagick) | 30 | #:use-module (gnu packages imagemagick) |
| 29 | #:use-module (gnu packages inkscape) | 31 | #:use-module (gnu packages inkscape) |
| 30 | #:use-module (gnu packages tex) | 32 | #:use-module (gnu packages tex) |
| 33 | #:use-module (gnu packages texinfo) | ||
| 34 | #:use-module (gnu packages perl) | ||
| 31 | #:use-module (gnu packages python) | 35 | #:use-module (gnu packages python) |
| 32 | #:use-module (gnu packages base) | 36 | #:use-module (gnu packages base) |
| 33 | #:use-module (gnu packages xml) | 37 | #:use-module (gnu packages xml) |
| @@ -35,6 +39,7 @@ | |||
| 35 | #:use-module (guix packages) | 39 | #:use-module (guix packages) |
| 36 | #:use-module (guix download) | 40 | #:use-module (guix download) |
| 37 | #:use-module ((guix build utils) #:select (alist-replace)) | 41 | #:use-module ((guix build utils) #:select (alist-replace)) |
| 42 | #:use-module (guix build-system gnu) | ||
| 38 | #:use-module (guix build-system trivial) | 43 | #:use-module (guix build-system trivial) |
| 39 | #:use-module (guix build-system python)) | 44 | #:use-module (guix build-system python)) |
| 40 | 45 | ||
| @@ -473,3 +478,92 @@ DB2LaTeX.") | |||
| 473 | (package/inherit dblatex | 478 | (package/inherit dblatex |
| 474 | (inputs (alist-replace "imagemagick" `(,imagemagick/stable) | 479 | (inputs (alist-replace "imagemagick" `(,imagemagick/stable) |
| 475 | (package-inputs dblatex)))))) | 480 | (package-inputs dblatex)))))) |
| 481 | |||
| 482 | (define-public docbook2x | ||
| 483 | (package | ||
| 484 | (name "docbook2x") | ||
| 485 | (version "0.8.8") | ||
| 486 | (source (origin | ||
| 487 | (method url-fetch) | ||
| 488 | (uri (string-append "mirror://sourceforge/docbook2x/docbook2x/" | ||
| 489 | version "/docbook2X-" version ".tar.gz")) | ||
| 490 | (sha256 | ||
| 491 | (base32 | ||
| 492 | "0ifwzk99rzjws0ixzimbvs83x6cxqk1xzmg84wa1p7bs6rypaxs0")))) | ||
| 493 | (build-system gnu-build-system) | ||
| 494 | (inputs | ||
| 495 | `(("bash-minimal" ,bash-minimal) | ||
| 496 | ("docbook-xml" ,docbook-xml) | ||
| 497 | ("perl" ,perl) | ||
| 498 | ("perl-xml-namespacesupport" ,perl-xml-namespacesupport) | ||
| 499 | ("perl-xml-parser" ,perl-xml-parser) | ||
| 500 | ("perl-xml-sax" ,perl-xml-sax) | ||
| 501 | ("perl-xml-sax-base" ,perl-xml-sax-base) | ||
| 502 | ("texinfo" ,texinfo) | ||
| 503 | ("xsltproc" ,libxslt))) | ||
| 504 | (arguments | ||
| 505 | `(#:phases | ||
| 506 | (modify-phases %standard-phases | ||
| 507 | (add-after 'configure 'patch-sources | ||
| 508 | (lambda* (#:key inputs outputs #:allow-other-keys) | ||
| 509 | ;; Fix failed substitution in config.pl | ||
| 510 | (substitute* "perl/config.pl" | ||
| 511 | (("\\$\\{prefix\\}") | ||
| 512 | (assoc-ref outputs "out"))) | ||
| 513 | ;; Fix a failing test (maybe it worked with old texinfo?) | ||
| 514 | (substitute* "test/complete-manuals/at1.xml" | ||
| 515 | (("<bridgehead>") | ||
| 516 | "<bridgehead renderas=\"sect2\">")) | ||
| 517 | ;; Patch all the tests use DocBook 4.5 | ||
| 518 | (substitute* (find-files "test" "\\.xml$") | ||
| 519 | (("\"-//OASIS//DTD DocBook XML V4\\..+//EN\"") | ||
| 520 | "\"-//OASIS//DTD DocBook XML V4.5//EN\"") | ||
| 521 | (("\"http://www\\.oasis-open\\.org/docbook/xml/4\\..+/docbookx.dtd\"") | ||
| 522 | "\"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd\"")) | ||
| 523 | ;; Set XML catalogs for tests to pass | ||
| 524 | (setenv "XML_CATALOG_FILES" | ||
| 525 | (string-append (assoc-ref inputs "docbook-xml") | ||
| 526 | "/xml/dtd/docbook/catalog.xml")))) | ||
| 527 | (add-after 'install 'wrap-programs | ||
| 528 | (lambda* (#:key inputs outputs #:allow-other-keys) | ||
| 529 | (let* ((out (assoc-ref outputs "out")) | ||
| 530 | (programs | ||
| 531 | (map (lambda (p) | ||
| 532 | (string-append out "/bin/" p)) | ||
| 533 | '("db2x_manxml" "db2x_texixml" "db2x_xsltproc" | ||
| 534 | "docbook2man" "docbook2texi"))) | ||
| 535 | (perl5lib | ||
| 536 | (map (lambda (i) | ||
| 537 | (string-append (assoc-ref inputs i) | ||
| 538 | "/lib/perl5/site_perl")) | ||
| 539 | '("perl-xml-namespacesupport" | ||
| 540 | "perl-xml-parser" | ||
| 541 | "perl-xml-sax" | ||
| 542 | "perl-xml-sax-base"))) | ||
| 543 | (xml-catalog-files | ||
| 544 | (list (string-append (assoc-ref inputs "docbook-xml") | ||
| 545 | "/xml/dtd/docbook/catalog.xml")))) | ||
| 546 | (map (lambda (program) | ||
| 547 | (wrap-program program | ||
| 548 | `("PERL5LIB" ":" prefix | ||
| 549 | ,perl5lib) | ||
| 550 | `("XML_CATALOG_FILES" " " prefix | ||
| 551 | ,xml-catalog-files))) | ||
| 552 | programs)))) | ||
| 553 | (add-after 'install 'create-symlinks | ||
| 554 | (lambda* (#:key outputs #:allow-other-keys) | ||
| 555 | (let ((out (assoc-ref outputs "out"))) | ||
| 556 | ;; Create db2x_* symlinks to satisfy some configure scripts | ||
| 557 | ;; which use these names to differentiate from an older | ||
| 558 | ;; docbook2man script provided by docbook-utils. | ||
| 559 | (map (lambda (prog) | ||
| 560 | (symlink prog (string-append out "/bin/db2x_" prog))) | ||
| 561 | '("docbook2man" "docbook2texi")))))))) | ||
| 562 | (home-page "http://docbook2x.sourceforge.net") | ||
| 563 | (synopsis "Convert DocBook to man page and Texinfo format") | ||
| 564 | (description | ||
| 565 | "docbook2X is a software package that converts DocBook documents into the | ||
| 566 | traditional Unix man page format and the GNU Texinfo format. Notable features | ||
| 567 | include table support for man pages, internationalization support, and easy | ||
| 568 | customization of the output using XSLT.") | ||
| 569 | (license license:expat))) | ||
