unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob 1b24c3522e203e2adbbac9727c14e6ba39d8a457 50094 bytes (raw)
name: gnu/packages/docbook.scm 	 # note: path name is non-authoritative(*)

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
 
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014, 2021-2022 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
;;; Copyright © 2021, 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2021 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2021 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2021 Andrew Whatson <whatson@gmail.com>
;;; Copyright © 2023 Bruno Victal <mirai@makinata.eu>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages docbook)
  #:use-module (gnu packages)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages bash)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages groff)
  #:use-module (gnu packages imagemagick)
  #:use-module (gnu packages inkscape)
  #:use-module (gnu packages tex)
  #:use-module (gnu packages texinfo)
  #:use-module (gnu packages perl)
  #:use-module (gnu packages python)
  #:use-module (gnu packages base)
  #:use-module (gnu packages web)
  #:use-module (gnu packages web-browsers)
  #:use-module (gnu packages xfig)
  #:use-module (gnu packages xml)
  #:use-module (guix gexp)
  #:use-module (guix utils)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix build-system copy)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system python)
  #:use-module (srfi srfi-26))

;; The fetch-plan, install-plan and phases for docbook-xml tend to vary
;; between releases therefore we use a “template” package for the
;; transformations that are common to these packages.
(define* (docbook-xml-package source version)
  "Return a package for a docbook-xml package version @var{version} and
downloading from @var{source}, where @var{version} is a string and
@var{source} is a @code{<origin>} record."
  (package
    (name "docbook-xml")
    (version version)
    (source source)
    (build-system copy-build-system)
    (arguments
     (list
      #:modules '((guix build copy-build-system)
                  (guix build utils)
                  (srfi srfi-26))
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'fix-permissions
            (lambda _
              ;; These files do not need 0755 permission.
              (for-each (cut chmod <> #o644) (find-files "."))))
          (add-before 'install 'patch-catalog-xml
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((xsltproc (search-input-file inputs "/bin/xsltproc"))
                    (xslt-file #$(local-file
                                  (search-auxiliary-file
                                   "xml/patch-catalog-xml.xsl")))
                    ;; Avoid profile conflicts by installing to a
                    ;; versioned path.
                    (dest-path
                     (format #f "~a/xml/docbook/~a" #$output #$version)))
                (for-each
                 (lambda (catalog)
                   (let ((catalog* (string-append catalog ".new")))
                     (invoke xsltproc "--nonet" "--novalid" "--noout"
                             "--stringparam" "prefix" dest-path
                             "--output" catalog*
                             xslt-file catalog)
                     (rename-file catalog* catalog)))
                 (find-files "." "catalog\\.xml$"))))))))
    (native-inputs (list libxslt unzip))
    (home-page "https://docbook.org")
    (synopsis "DocBook XML DTDs for document authoring")
    (description
     "DocBook is general purpose XML and SGML document type particularly well
suited to books and papers about computer hardware and software (though it is
by no means limited to these applications.)  This package provides XML DTDs.")
    (license (license:x11-style "" "See file headers."))))

(define-public docbook-xml-5.1
  (let* ((version "5.1")
         (source (origin
                   (method url-fetch/zipbomb)
                   (uri (string-append "https://docbook.org/xml/" version
                                       "/docbook-v" version "-os.zip"))
                   (sha256
                    (base32
                     "0zqy9prj9wam9dn7v3mgr7ld1axqxdhgrmv06dviwg00ahv43wxk"))
                   (modules '((guix build utils)))
                   (snippet
                    ;; The .zip release mistakenly uses '5.1CR4' instead of
                    ;; '5.1' as intended by <https://docbook.org/xml/5.1/catalog.xml>.
                    #~(substitute* "schemas/catalog.xml"
                        (("5\\.1CR4") #$version)))))
         (template (docbook-xml-package source version)))
    (package
      (inherit template)
      (arguments
       (let ((dest-dir (format #f "xml/docbook/~a/" version)))
         (substitute-keyword-arguments (package-arguments template)
           ;; XXX: A default value must be provided otherwise this
           ;; substitution has no effect.
           ((#:install-plan _ #f)
            #~`(("schemas/" #$dest-dir)))))))))

(define-public docbook-xml-5.0.1
  (let* ((version "5.0.1")
         (source (origin
                   (method url-fetch)
                   (uri (string-append "https://docbook.org/xml/" version
                                       "/docbook-" version ".zip"))
                   (sha256
                    (base32
                     "1iz3hq1lqgnshvlz4j9gvh4jy1ml74qf90vqf2ikbq0h4i2xzybs"))))
         (template (docbook-xml-package source version)))
    (package
      (inherit template)
      (arguments
       (let ((dest-dir (format #f "xml/docbook/~a/" version)))
         (substitute-keyword-arguments (package-arguments template)
           ((#:install-plan _ #f)
            #~`(("catalog.xml" #$dest-dir)
                ("docbook.nvdl" #$dest-dir)
                ("dtd" #$dest-dir)
                ("rng" #$dest-dir)
                ("sch" #$dest-dir)
                ("xsd" #$dest-dir)))))))))

;; XXX: docbook-xml-4.x versions use the same #:install-plan but since the
;; paths are versioned we can't use (inherit …).
(define* (docbook-xml-4.x-package source version)
  "Return a template for a docbook-xml-4.x package version @var{version} and
downloading from @var{source}, where @var{version} is a string and
@var{source} is a @code{<origin>} record."
  (let ((base-template (docbook-xml-package source version)))
    (package
      (inherit base-template)
      (arguments
       (let* ((dest-dir (format #f "xml/docbook/~a/" version)))
         (substitute-keyword-arguments (package-arguments base-template)
           ((#:phases phases)
            ;; Some programs, such as kdoctools, instead of using
            ;; XML_CATALOG_FILES, prefer to use cmake to locate
            ;; the DTDs for docbook-xml-4.x packages but
            ;; since there's no agreed standard as to where these files
            ;; should be placed, in practice the .cmake files
            ;; end up searching for paths that are distribution specific.
            #~(modify-phases #$phases
                (add-after 'install 'symlink-alternate-path
                  (lambda _
                    ;; kdoctools searches under xml/dtd/docbook/
                    ;; which is the convention used by Nix.
                    (mkdir-p (string-append #$output "/xml/dtd"))
                    (symlink (string-append #$output "/" #$dest-dir)
                             (string-append #$output "/xml/dtd/docbook"))))))
           ((#:install-plan _ #f)
            #~`(("./" #$dest-dir
                 #:exclude-regexp ("ChangeLog$"
                                   "README$"
                                   "docbook\\.cat$"
                                   "\\.txt$"))))))))))

(define-public docbook-xml-4.5
  (let* ((version "4.5")
         (source (origin
                   (method url-fetch/zipbomb)
                   (uri (string-append "https://docbook.org/xml/" version
                                       "/docbook-xml-" version ".zip"))
                   (sha256
                    (base32
                     "1d671lcjckjri28xfbf6dq7y3xnkppa910w1jin8rjc35dx06kjf")))))
    (docbook-xml-4.x-package source version)))

(define-public docbook-xml-4.4
  (let* ((version "4.4")
         (source (origin
                   (method url-fetch/zipbomb)
                   (uri (string-append "https://docbook.org/xml/" version
                                       "/docbook-xml-" version ".zip"))
                   (sha256
                    (base32
                     "141h4zsyc71sfi2zzd89v4bb4qqq9ca1ri9ix2als9f4i3mmkw82")))))
    (docbook-xml-4.x-package source version)))

(define-public docbook-xml-4.3
  (let* ((version "4.3")
         (source (origin
                   (method url-fetch/zipbomb)
                   (uri (string-append "https://docbook.org/xml/" version
                                       "/docbook-xml-" version ".zip"))
                   (sha256
                    (base32
                     "0r1l2if1z4wm2v664sqdizm4gak6db1kx9y50jq89m3gxaa8l1i3")))))
    (docbook-xml-4.x-package source version)))

(define-public docbook-xml-4.2
  (let* ((version "4.2")
         (source (origin
                   (method url-fetch/zipbomb)
                   (uri (string-append "https://docbook.org/xml/" version
                                       "/docbook-xml-" version ".zip"))
                   (sha256
                    (base32
                     "18hgwvmywh6a5jh38szjmg3hg2r4v5lb6r3ydc3rd8cp9wg61i5c")))))
    (docbook-xml-4.x-package source version)))

(define-public docbook-xml-4.1.2
  (let* ((version "4.1.2")
         (source (origin
                   (method url-fetch/zipbomb)
                   (uri (string-append "https://docbook.org/xml/" version
                                       "/docbkx412.zip"))
                   (sha256
                    (base32
                     "0wkp5rvnqj0ghxia0558mnn4c7s3n501j99q2isp3sp0ci069w1h"))))
         (template (docbook-xml-4.x-package source version)))
    (package
      (inherit template)
      (arguments
       (substitute-keyword-arguments (package-arguments template)
         ((#:phases phases)
          #~(modify-phases #$phases
              (add-after 'unpack 'copy-catalog-file
                ;; docbook-xml-4.1.2 is unique in the fact that it doesn't come
                ;; with a catalog.xml file, requiring it to be generated by hand
                ;; from the docbook.cat SGML catalog. We could automatically
                ;; generate it here at the cost of enlarging the package
                ;; definition with a rudimentary (PEG) parser for the SGML
                ;; catalog but this is overkill since this file is unlikely to
                ;; change, therefore we ship a pre-generated catalog.xml.
                (lambda _
                  (copy-file
                   #$(local-file
                      (search-auxiliary-file
                       "xml/docbook-xml/catalog-4.1.2.xml"))
                   "catalog.xml")))
              (add-after 'patch-catalog-xml 'add-rewrite-entries
                (lambda* (#:key inputs #:allow-other-keys)
                  (let ((xmlcatalog (search-input-file inputs
                                                       "/bin/xmlcatalog"))
                        (dtd-path (format #f "~a/xml/docbook/~a"
                                          #$output #$version)))
                    (for-each
                     (lambda (type)
                       (invoke xmlcatalog "--noout"
                               "--add" type
                               "http://www.oasis-open.org/docbook/xml/4.1.2/"
                               (string-append "file://" dtd-path "/")
                               "catalog.xml"))
                     (list "rewriteSystem" "rewriteURI")))))))))
      (native-inputs
       (modify-inputs (package-native-inputs template)
         (prepend libxml2))))))

(define-public docbook-mathml-1.0
  (package
    (name "docbook-mathml")
    (version "1.0")
    (source (origin
              (method url-fetch)
              (uri
               (string-append "https://www.oasis-open.org/docbook/xml/mathml/"
                              version "/dbmathml.dtd"))
              (sha256
               (base32
                "10vmyl29j829w4xn928rznh163pf47gyzbbjjwqrbg2bidfnk7vp"))))
    (build-system copy-build-system)
    (arguments
     (let ((target (format #f "xml/docbook/mathml/~a/" version)))
       (list
        #:modules '((guix build copy-build-system)
                    (guix build utils)
                    (sxml simple)
                    (srfi srfi-1))
        #:phases
        #~(modify-phases %standard-phases
            (add-before 'install 'generate-catalog.xml
              (lambda _
                (let ((store-uri (string-append "file://"
                                                #$output "/"
                                                #$target "dbmathml.dtd")))
                  (call-with-output-file "catalog.xml"
                    (lambda (port)
                      (sxml->xml
                       `(*TOP*
                         (*PI* xml "version='1.0'")
                         (catalog (@ (xmlns "urn:oasis:names:tc:entity:xmlns:xml:catalog"))
                           (public (@ (publicId "-//OASIS//DTD DocBook MathML Module V1.0//EN")
                                      (uri ,store-uri)))
                           ,@(map
                              (lambda (scheme)
                                `(system
                                  (@ (systemId
                                      ,(string-append scheme
                                                      "://www.oasis-open.org/docbook/xml/"
                                                      "mathml/1.0/dbmathml.dtd"))
                                     (uri ,store-uri))))
                              '("http" "https"))))
                       port)))))))
        #:install-plan
        #~`(("catalog.xml" #$target)
            ("dbmathml.dtd" #$target)))))
    (propagated-inputs
     ;; These must be propagated for the package to make sense.
     ;; TODO: Package MathML2 DTD and propagate it as well.
     (list docbook-xml-4.1.2))
    (home-page
     "https://www.oasis-open.org/docbook/xml/mathml/1.0/index.1.shtml")
    (synopsis "MathML support for DocBook XML V4.1.2.")
    (description "The DocBook MathML Module is an extension to DocBook XML
V4.1.2 that adds support for MathML in equation markup.")
    (license (license:non-copyleft "" "See file headers."))))

(define-public docbook-xml docbook-xml-5.1)

;;; There's an issue in docbook-xsl 1.79.2 that causes manpages to be
;;; generated incorrectly and embed raw nroff syntax such as '.PP' when there
;;; is a namespace/non-namespace mismatch between the sources and the
;;; stylesheets used (see:
;;; https://github.com/docbook/xslt10-stylesheets/issues/109).
(define-public docbook-xsl
  (let ((commit "fe16c90013b64e316c3e21ef92d1e8813c10f88c")
        (revision "0")
        (base-version "1.79.2"))
    (package
      (name "docbook-xsl")
      (version (git-version base-version revision commit))
      (source (origin
                (method git-fetch)
                (uri (git-reference
                      (url "https://github.com/docbook/xslt10-stylesheets")
                      (commit commit)))
                (file-name (git-file-name name version))
                (modules '((guix build utils)))
                (snippet
                 #~(begin
                     ;; Multiple .jar files are bundled with the sources.
                     (for-each delete-file
                               (find-files "." "\\.jar$"))
                     ;; Do not build webhelp files, as they require a Saxon from
                     ;; 2005, which is not packaged in Guix.
                     (substitute* "xsl/Makefile"
                       ((" webhelp") ""))))
                (sha256
                 (base32
                  "1bl8dwrcy7skrlh80fpsmiw045bv2j0aym231ikcv3hvm2pi98dj"))))
      (build-system gnu-build-system)
      (arguments
       (list
        #:make-flags #~(list "XSLTENGINE=xsltproc")
        #:modules '((guix build gnu-build-system)
                    (guix build utils)
                    (sxml simple))
        #:phases
        #~(let ((dest-path (format #f "~a/xml/xsl/~a-~a"
                                   #$output #$name #$version)))
            (modify-phases %standard-phases
              (replace 'configure
                (lambda _
                  ;; The build systems insist on a ~/.xmlc, and it is simpler to
                  ;; create a dummy config file than to patch it into
                  ;; submission.
                  (setenv "HOME" "/tmp")
                  (call-with-output-file "/tmp/.xmlc"
                    (lambda (port)
                      (sxml->xml
                       '(*TOP*
                         (*PI* xml "version='1.0'")
                         (config
                          (java (@ (xml:id "bigmem"))
                                (java-options (@ (name "Xmx512m"))))
                          (xsltproc (@ (xml:id "xsltproc")
                                       (exec "xsltproc")))
                          (xmllint (@ (xml:id "xmllint")
                                      (exec "xmllint")))))
                       port)))))
              (add-before 'install 'generate-catalog.xml
                (lambda* (#:key make-flags #:allow-other-keys)
                  (apply invoke "make" "-C" "xsl" "catalog.xml" make-flags)))
              (add-after 'generate-catalog.xml 'patch-catalog.xml
                ;; Note: URI resolutions are not recursive.
                ;; A rewrite rule from:
                ;;   'http://docbook.sourceforge.net/release/xsl-ns/'
                ;; to
                ;;   'http://docbook.sourceforge.net/release/xsl/'
                ;; will not trigger the rewrite rule that ultimately
                ;; remaps to a /gnu/store URI, as can be seen by
                ;; invoking:
                ;; $ xmlcatalog "" \
                ;;     'http://docbook.sourceforge.net/release/xsl-ns/current/'
                ;; http://docbook.sourceforge.net/release/xsl/current/
                ;; $ xmlcatalog "" \
                ;;     'http://docbook.sourceforge.net/release/xsl/current/'
                ;; file://gnu/store/…/xml/xsl/…
                ;;
                ;; See XML Catalog specification, item 7.2.2. for
                ;; details.
                (lambda* (#:key inputs #:allow-other-keys)
                  (let ((xmlcatalog (search-input-file inputs
                                                       "/bin/xmlcatalog"))
                        (catalog-file "xsl/catalog.xml")
                        (store-uri (string-append "file://" dest-path "/")))
                    ;; Remove /snapshot/ references.
                    (for-each
                     (lambda (scheme)
                       (invoke xmlcatalog "--noout"
                               "--del"
                               (string-append
                                scheme
                                "://cdn.docbook.org/release/xsl/snapshot/")
                               catalog-file))
                     (list "http" "https"))
                    ;; Rewrite both http:// and https:// URIs.
                    (for-each
                     (lambda (path)
                       (for-each
                        (lambda (scheme)
                          (for-each
                           (lambda (entry-type)
                             (let ((uri (string-append scheme "://" path)))
                               (invoke xmlcatalog "--noout"
                                       "--add" entry-type uri store-uri
                                       catalog-file)))
                           (list "rewriteSystem" "rewriteURI")))
                        (list "http" "https")))
                     (list #$(format #f "cdn.docbook.org/release/xsl/~a/"
                                     base-version)
                           "cdn.docbook.org/release/xsl/current/"
                           ;; Re-add the no longer present compatibility entries for
                           ;; v.1.79.1 or earlier URIs.
                           "docbook.sourceforge.net/release/xsl/current/"
                           ;; Originally the
                           ;; "http://docbook.sourceforge.net/release/xsl/"
                           ;; URI referred to the non-namespaced docbook-xsl,
                           ;; with its namespaced version using a URI differing in
                           ;; the path component as '…/xsl-ns/'.
                           ;; At some point the namespaced version was made the
                           ;; canonical docbook-xsl package whilst preserving the
                           ;; original URI.
                           ;;
                           ;; For compatibility with XML files that still specify
                           ;; the legacy namespaced docbook-xsl URIs we re-add them
                           ;; here.
                           "docbook.sourceforge.net/release/xsl-ns/current/")))))
            (replace 'install
              (lambda _
                (let ((select-rx (make-regexp
                                  "(\\.xml$|\\.xsl$|\\.dtd$|\\.ent$)")))
                  ;; Install catalog.
                  (chdir "xsl")
                  (install-file "catalog.xml" dest-path)
                  (install-file "VERSION.xsl" dest-path)
                  ;; Install style sheets.
                  (for-each
                   (lambda (dir)
                     (for-each (lambda (f)
                                 (install-file
                                  f
                                  (string-append dest-path "/" (dirname f))))
                               (find-files dir select-rx)))
                   '("assembly" "common" "eclipse" "epub" "epub3" "fo"
                     "highlighting" "html" "htmlhelp" "javahelp" "lib"
                     "manpages" "params" "profiling" "roundtrip"
                     "template" "website"
                     "xhtml" "xhtml-1_1" "xhtml5")))))))))
      (native-inputs (list docbook-xml-4.4  ; for tests
                           libxml2
                           libxslt
                           perl
                           perl-xml-xpath))
      (home-page "https://docbook.org")
      (synopsis "DocBook XSL style sheets for document authoring")
      (description
       "This package provides XSL style sheets for DocBook.")
      (license (license:x11-style "" "See 'COPYING' file.")))))

(define-public docbook-xsl-1.79.1
  (package
    (name "docbook-xsl")
    (version "1.79.1")
    (source (origin
              (method url-fetch)
              ;; At the time, the non namespaced version was still the
              ;; default; our latest docbook-xsl is namespaced, so for
              ;; consistency preserves this property for older versions too.
              (uri (string-append "mirror://sourceforge/docbook/"
                                  name "-ns/" version "/"
                                  name "-ns-" version ".tar.bz2"))
              (sha256
               (base32
                "170ggf5dgjar65kkn5n33kvjr3pdinpj66nnxfx8b2avw0k91jin"))
              (modules '((guix build utils)))
              ;; Bundled binary files.
              (snippet
               #~(delete-file-recursively "tools"))))
    (build-system copy-build-system)
    (outputs '("out" "doc"))
    (arguments
     (list
      #:install-plan
      (let ((target (format #f "xml/xsl/~a-~a/" name version))
            (select-rx '("\\.xml$" "\\.xsl$" "\\.dtd$" "\\.ent$")))
        #~`(#$@(map
                (lambda (directory)
                  ;; XXX: When filters are used, the source basename
                  ;; isn't kept under the target path, append it again.
                  (let ((target* (string-append target directory)))
                    (list directory target* #:include-regexp select-rx)))
                (list "assembly" "common" "eclipse" "epub" "epub3" "fo"
                      "highlighting" "html" "htmlhelp" "javahelp" "lib"
                      "manpages" "params" "profiling" "roundtrip"
                      "template" "website"
                      "xhtml" "xhtml-1_1" "xhtml5"))
            ("catalog.xml" #$target)
            ("VERSION.xsl" #$target)))
      #:phases
      #~(let ((dest-path (format #f "~a/xml/xsl/~a-~a"
                                 #$output #$name #$version)))
          (modify-phases %standard-phases
            (add-before 'install 'patch-catalog-xml
              (lambda* (#:key inputs #:allow-other-keys)
                (let ((xmlcatalog (search-input-file inputs
                                                     "/bin/xmlcatalog"))
                      (catalog-files (find-files "." "catalog\\.xml$"))
                      (store-uri (string-append "file://" dest-path "/")))
                  (for-each
                   (lambda (catalog)
                     (for-each
                      (lambda (type)
                        ;; Patch /current/ references to point to /gnu/store/….
                        (invoke xmlcatalog "--noout"
                                "--add" type
                                "http://docbook.sourceforge.net/release/xsl-ns/current/"
                                store-uri
                                catalog)
                        ;; Patch versioned references to point to /gnu/store/….
                        (invoke xmlcatalog "--noout"
                                "--add" type
                                (format
                                 #f "http://docbook.sourceforge.net/release/xsl-ns/~a/"
                                 #$version)
                                store-uri
                                catalog))
                      (list "rewriteSystem" "rewriteURI")))
                   catalog-files))))
            ;; XXX: The copy-build-system doesn't seem to allow installing to a
            ;; different output.
            (add-after 'install 'install-doc
              (lambda _
                (let ((doc (format #f "~a/share/doc/~a-~a"
                                   #$output:doc #$name #$version)))
                  (install-file "NEWS" doc)
                  (install-file "RELEASE-NOTES.html" doc)
                  (copy-recursively "slides" doc)
                  (copy-recursively "webhelp" doc))))))))
    (native-inputs (list libxml2))
    (home-page "https://docbook.org")
    (synopsis "DocBook XSL namespaced style sheets for document authoring")
    (description "This package provides the @emph{namespaced} XSL style sheets
for DocBook.")
    (license (license:x11-style "" "See 'COPYING' file."))))

(define-public docbook-dsssl
  (package
    (name "docbook-dsssl")
    (version "1.79")
    (source (origin
              (method url-fetch)
              (uri (string-append "mirror://sourceforge/docbook/"
                                  name "/" version "/"
                                  name "-" version ".tar.bz2"))
              (sha256
               (base32
                "1g72y2yyc2k89kzs0lvrb9n7hjayw1hdskfpplpz97pf1c99wcig"))))
    (build-system copy-build-system)
    (outputs '("out" "doc"))
    (arguments
     (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
     (list bzip2 tar))
    (home-page "https://docbook.org/")
    (synopsis "DSSSL style sheets for DocBook")
    (description "This package provides DSSSL style sheets for DocBook.")
    (license (license:non-copyleft "file://README"))))

;;; Private variable, used as the 'doc' output of the docbook-dsssl package.
(define docbook-dsssl-doc
  (package
    (name "docbook-dsssl-doc")
    (version "1.79")
    (source (origin
              (method url-fetch)
              (uri (string-append "mirror://sourceforge/docbook/"
                                  name "/" version "/"
                                  name "-" version ".tar.bz2"))
              (sha256
               (base32
                "1plp5ngc96pbna4rwglp9glcadnirbm3hlcjb4gjvq1f8biic9lz"))))
    (build-system copy-build-system)
    (arguments
     (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.")
    (license (license:non-copyleft "file://doc/LEGALNOTICE.htm"))))

(define-public docbook-sgml-4.2
  (package
    (name "docbook-sgml")
    (version "4.2")
    (source (origin
              (method url-fetch/zipbomb)
              (uri (string-append
                    "https://www.oasis-open.org/docbook/sgml/4.2/docbook-"
                    version ".zip"))
              (sha256
               (base32
                "1hrm4qmmzi285bkxkc74lxvjvw2gbl7ycbaxhv31h9rl9g4x5sv7"))))
    (build-system copy-build-system)
    (arguments
     (list
      #:modules '((guix build copy-build-system)
                  (guix build utils)
                  (srfi srfi-26))
      #:install-plan
      #~`(("./" "sgml/dtd/docbook"
           #:exclude-regexp ("catalog\\.xml$"
                             "ChangeLog$"
                             "README$"
                             "\\.txt$")))
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'fix-permissions
            (lambda _
              (for-each (cut chmod <> #o644) (find-files "."))))
          (add-before 'install 'patch-iso-entities
            (lambda* (#:key inputs #:allow-other-keys)
              ;; Reference the ISO 8879 character entities.
              ;; e.g. "iso-lat1.gml" --> "<iso-entities-dir>/ISOlat1"
              (let ((iso-entities-dir
                     (assoc-ref %build-inputs "iso-8879-entities")))
                (substitute* "docbook.cat"
                  (("\"iso-(.*)\\.gml\"" _ name)
                   (string-append "\"" iso-entities-dir "/ISO" name "\"")))))))))
    (native-inputs
     (list unzip))
    (inputs
     (list iso-8879-entities))
    (home-page "https://docbook.org")
    (synopsis "DocBook SGML style sheets for document authoring")
    (description "This package provides SGML style sheets for DocBook.")
    (license (license:x11-style "" "See file headers."))))

(define-public docbook-sgml-4.1
  (package
    (inherit docbook-sgml-4.2)
    (version "4.1")
    (source (origin
              (method url-fetch/zipbomb)
              (uri (string-append "https://www.oasis-open.org/docbook/sgml/"
                                  version "/docbk41.zip"))
              (sha256
               (base32
                "04b3gp4zkh9c5g9kvnywdkdfkcqx3kjc04j4mpkr4xk7lgqgrany"))))))

(define-public docbook-sgml docbook-sgml-4.1)

(define-public docbook-sgml-3.1
  (package
    (inherit docbook-sgml)
    (version "3.1")
    (source (origin
              (method url-fetch/zipbomb)
              (uri (string-append "https://www.oasis-open.org/docbook/sgml/"
                                  version "/docbk31.zip"))
              (sha256
               (base32
                "0f25ch7bywwhdxb1qa0hl28mgq1blqdap3rxzamm585rf4kis9i0"))))))

;;; Private package referenced by docbook-sgml.
(define iso-8879-entities
  (package
    (name "iso-8879-entities")
    (version "0.0")                     ;no proper version
    (source (origin
              (method url-fetch/zipbomb)
              (uri "https://www.oasis-open.org/cover/ISOEnts.zip")
              (sha256
               (base32
                "1clrkaqnvc1ja4lj8blr0rdlphngkcda3snm7b9jzvcn76d3br6w"))))
    (build-system copy-build-system)
    (native-inputs (list unzip))
    (home-page "https://www.oasis-open.org/")
    (synopsis "ISO 8879 character entities")
    (description "ISO 8879 character entities that are typically used in
the in DocBook SGML DTDs.")
    (license (license:x11-style "" "See file headers."))))

(define-public dblatex
  (package
    (name "dblatex")
    (version "0.3.12")
    (source (origin
              (method url-fetch)
              (uri (string-append "mirror://sourceforge/dblatex/dblatex/"
                                  "dblatex-" version "/dblatex3-"
                                  version ".tar.bz2"))
              (sha256
               (base32
                "0yd09nypswy3q4scri1dg7dr99d7gd6r2dwx0xm81l9f4y32gs0n"))
              (patches
               (search-patches "dblatex-inkscape-1.0.patch"))))
    (build-system python-build-system)
    (arguments
     (list
      ;; Using setuptools causes an invalid "package_base" path in
      ;; out/bin/.dblatex-real due to a missing leading '/'.  This is caused
      ;; by dblatex's setup.py stripping the root path when creating the
      ;; script.  (dblatex's setup.py still uses distutils and thus has to
      ;; create the script by itself. The feature for creating scripts is one
      ;; of setuptools' features.)
      ;; See this thread for details:
      ;; https://lists.gnu.org/archive/html/guix-devel/2016-12/msg00030.html
      #:use-setuptools? #f
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'install 'split-outputs
            (lambda _
              (let ((old (string-append #$output "/share/doc"))
                    (new (string-append #$output:doc "/share/doc")))
                (mkdir-p (dirname new))
                (rename-file old new))))
          (add-after 'wrap 'wrap-dblatex
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((path
                     (search-path-as-list
                      '("bin")
                      '#$(map (cut this-package-input <>)
                              (list "libxslt" "imagemagick" "inkscape"
                                    "texlive-bin")))))
                ;; dblatex executes helper programs at runtime.
                (wrap-program (string-append #$output "/bin/dblatex")
                  `("PATH" ":" prefix ,path)
                  `("GUIX_TEXMF" prefix (,(getenv "GUIX_TEXMF")))))))
          (add-after 'check 'check-wrap
            (lambda* (#:key tests? #:allow-other-keys)
              (when tests?
                (unsetenv "GUIX_TEXMF")
                (invoke/quiet (string-append #$output "/bin/dblatex")
                              "--quiet" "tests/mathml/mmltest2.xml")))))))
    (native-inputs (list docbook-mathml-1.0))
    (inputs
     (list texlive-bin
           (texlive-updmap.cfg (list texlive-amsmath
                                     texlive-anysize
                                     texlive-appendix
                                     texlive-auxhook
                                     texlive-bigintcalc
                                     texlive-bin
                                     texlive-bitset
                                     texlive-bookmark
                                     texlive-changebar
                                     texlive-colortbl
                                     texlive-courier
                                     texlive-eepic
                                     texlive-epstopdf-pkg
                                     texlive-eso-pic
                                     texlive-etexcmds
                                     texlive-fancybox
                                     texlive-fancyhdr
                                     texlive-fancyvrb
                                     texlive-float
                                     texlive-footmisc
                                     texlive-gettitlestring
                                     texlive-graphics
                                     texlive-graphics-cfg
                                     texlive-helvetic
                                     texlive-hycolor
                                     texlive-hyperref
                                     texlive-infwarerr
                                     texlive-intcalc
                                     texlive-jknapltx
                                     texlive-kpathsea
                                     texlive-kvdefinekeys
                                     texlive-kvoptions
                                     texlive-kvsetkeys
                                     texlive-l3backend
                                     texlive-latex
                                     texlive-latex-bin
                                     texlive-letltxmacro
                                     texlive-listings
                                     texlive-ltxcmds
                                     texlive-multirow
                                     texlive-overpic
                                     texlive-pdfescape
                                     texlive-pdflscape
                                     texlive-pdfpages
                                     texlive-pdftexcmds
                                     texlive-psnfss
                                     texlive-refcount
                                     texlive-rerunfilecheck
                                     texlive-rsfs
                                     texlive-stmaryrd
                                     texlive-subfigure
                                     texlive-symbol
                                     texlive-times
                                     texlive-titlesec
                                     texlive-tools
                                     texlive-uniquecounter
                                     texlive-url
                                     texlive-wasysym
                                     texlive-zapfding))
           ;; FIXME: transfig causes the build to fail.
           ;;transfig                   ;for fig2dev
           imagemagick                  ;for convert
           inkscape                     ;for svg conversion
           docbook-xml
           libxslt))                    ;for xsltproc
    (outputs '("out" "doc"))
    ;; lib/dbtexmf/xslt/4xslt.py shows that this package
    ;; makes use of XML_CATALOG_FILES.
    ;; It also invokes xsltproc, that already has it
    ;; in its native-search-path so we don't need to
    ;; reinclude it.
    (native-search-paths (package-native-search-paths libxslt))
    (home-page "https://dblatex.sourceforge.net")
    (synopsis "DocBook to LaTeX Publishing")
    (description
     "DocBook to LaTeX Publishing transforms your SGML/XML DocBook documents
to DVI, PostScript or PDF by translating them in pure LaTeX as a first
process.  MathML 2.0 markups are supported too.  It started as a clone of
DB2LaTeX.")
    ;; lib/contrib/which is under an X11 license
    (license license:gpl2+)))

;; This is a variant of the 'dblatex' package that is not updated often.  It
;; is intended to be used as a native-input at build-time only, e.g. by
;; 'gtk-doc' for generating package documentation.  This allows the main
;; 'dblatex' and 'imagemagick' packages to be freely updated on the 'master'
;; branch without triggering an excessive number of rebuilds.
(define-public dblatex/stable
  (hidden-package
   (package/inherit dblatex
     (inputs (modify-inputs (package-inputs dblatex)
               (replace "imagemagick" imagemagick/stable)
               (replace "inkscape" inkscape/stable))))))

(define-public docbook-utils
  (package
    (name "docbook-utils")
    (version "0.6.14")
    (source (origin
              (method url-fetch)
              ;; The original sources are not accessible anymore.
              (uri (string-append "http://deb.debian.org/debian/pool/main/"
                                  "d/docbook-utils/docbook-utils_"
                                  version ".orig.tar.gz"))
              (sha256
               (base32
                "1scj5vgw1xz872pq54a89blcxqqm11p90yzv8a9mqq57x27apyj8"))
              (patches
               (search-patches "docbook-utils-documentation-edits.patch"
                               "docbook-utils-escape-characters.patch"
                               "docbook-utils-remove-jade-sp.patch"
                               "docbook-utils-respect-refentry-for-name.patch"
                               "docbook-utils-use-date-element.patch"
                               "docbook-utils-source-date-epoch.patch"))
              (modules '((guix build utils)))
              (snippet
               #~(begin
                   ;; Patch build system.
                   (substitute* (find-files "." "\\.((in)|(am))$")
                     ;; Do not hard-code SGML_CATALOG_FILES.
                     ((".*SGML_CATALOG_FILES=/etc/sgml/catalog.*") ""))

                   ;; Do not override the SGML_CATALOG_FILES environment
                   ;; variable.
                   (substitute* "bin/jw.in"
                     ((".*SGML_CATALOG_FILES=`find.*")
                      "")
                     (("SGML_CATALOG_FILES=`echo.*")
                      ":\n")
                     (("SGML_CATALOG_FILES=\"\"")
                      ":")
                     (("\\bwhich\\b")
                      "command -v"))

                   ;; Locate lynx, links or w3m from the PATH, not from
                   ;; /usr/bin.
                   (substitute* "backends/txt"
                     (("CONVERT=/usr/bin/")
                      "CONVERT=")
                     (("\\[ -x /usr/bin/([^ ]+) \\]" _ command)
                      (format #f "command -v ~a > /dev/null" command)))))))
    (arguments
     (list
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'autoreconf
            (lambda _
              (invoke "autoreconf" "-vif"))))))
    (native-inputs (list autoconf automake libtool))
    (build-system gnu-build-system)
    ;; Propagated for convenience.  All these tools are used at run time to
    ;; provide the complete functionality of the docbook-utils commands.
    (propagated-inputs
     (list texlive-jadetex
           docbook-sgml-3.1
           docbook-dsssl
           openjade
           opensp
           lynx
           perl-sgmls))
    (home-page "https://packages.debian.org/sid/docbook-utils")
    (synopsis "DocBook converter to other formats")
    (description "The docbook-utils package is a collection of utilities
intended to ease the use of SGML and XML.
@table @command
@item jw
Convert a SGML DocBook file to other formats such as Hyper Text Markup
Language (HTML), Rich Text Format (RTF), PostScript (PS), man, Portable
Document Format (PDF), TeX, Texinfo or plain text (txt).  It can be used
more conveniently via the following wrappers:
@table @command
@item docbook2dvi
Convert a SGML DocBook file to the DVI format.
@item docbook2html
Convert a SGML DocBook file to an HTML document.
@item docbook2man
Convert a SGML DocBook file a man page.
@item docbook2pdf
@itemx docbook2ps
@itemx docbook2rtf
@itemx docbook2tex
@itemx docbook2texi
Convert a SGML DocBook file to a PDF/PS/RTF/TeX document.
@item docbook2txt
Convert a SGML DocBook file to a plain text document.
@end table
@item sgmldiff
Detect the differences in markup between two SGML files.
@end table")
    (license license:gpl2+)))

(define-public docbook2x
  (package
    (name "docbook2x")
    (version "0.8.8")
    (source (origin
              (method url-fetch)
              (uri (string-append "mirror://sourceforge/docbook2x/docbook2x/"
                                  version "/docbook2X-" version ".tar.gz"))
              (sha256
               (base32
                "0ifwzk99rzjws0ixzimbvs83x6cxqk1xzmg84wa1p7bs6rypaxs0"))
              (patches
               (search-patches "docbook2x-filename-handling.patch"
                               "docbook2x-manpage-typo.patch"
                               "docbook2x-preprocessor-declaration.patch"
                               "docbook2x-static-datadir-evaluation.patch"))
              (modules '((guix build utils)))
              (snippet
               ;; Fix a failing test (maybe it worked with old texinfo?)
               #~(substitute* "test/complete-manuals/at1.xml"
                   (("<bridgehead>")
                    "<bridgehead renderas=\"sect2\">")))))
    (build-system gnu-build-system)
    (arguments
     (list
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'configure 'patch-sources
            (lambda* (#:key inputs #:allow-other-keys)
              ;; Patch all the tests use DocBook 4.5
              (substitute* (find-files "test" "\\.xml$")
                (("\"-//OASIS//DTD DocBook XML V4\\..+//EN\"")
                 "\"-//OASIS//DTD DocBook XML V4.5//EN\"")
                (("\"http://www\\.oasis-open\\.org/docbook/xml/4\\..+/docbookx.dtd\"")
                 "\"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd\""))
              ;; Set XML catalogs for tests to pass
              (setenv "XML_CATALOG_FILES"
                      (string-append (assoc-ref inputs "docbook-xml")
                                     "/xml/dtd/docbook/catalog.xml"))))
          (add-after 'unpack 'autoreconf
            (lambda _
              (invoke "autoreconf" "-vif")))
          (add-after 'install 'split-outputs
            (lambda _
              (let* ((old (string-append #$output "/share/doc"))
                     (new (string-append #$output:doc "/share/doc")))
                (mkdir-p (dirname new))
                (rename-file old new))))
          (add-after 'install 'wrap-programs
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let* ((programs
                      (map (lambda (p)
                             (search-input-file outputs
                                                (string-append "bin/" p)))
                           '("db2x_manxml" "db2x_texixml" "db2x_xsltproc"
                             "docbook2man" "docbook2texi")))
                     (perl5lib
                      '#$(map (lambda (i)
                                (file-append (this-package-input i)
                                             "/lib/perl5/site_perl"))
                              '("perl-xml-namespacesupport"
                                "perl-xml-parser"
                                "perl-xml-sax"
                                "perl-xml-sax-base")))
                     (xml-catalog-files
                      (list (search-input-file
                             inputs "xml/dtd/docbook/catalog.xml"))))
                (map (lambda (program)
                       (wrap-program program
                         `("PERL5LIB" ":" prefix ,perl5lib)
                         `("XML_CATALOG_FILES" " " prefix ,xml-catalog-files)))
                     programs))))
          (add-after 'install 'sgml-check
            ;; This is not covered by 'make check'.
            ;; Test that 'sgml2xml-isoent' works.
            (lambda* (#:key tests? #:allow-other-keys)
              (when tests?
                (invoke "make" "installcheck"))))
          (add-after 'install 'create-symlinks
            (lambda _
              ;; Create db2x_* symlinks to satisfy some configure scripts
              ;; which use these names to differentiate from an older
              ;; docbook2man script provided by docbook-utils.
              (map (lambda (prog)
                     (symlink prog (string-append #$output
                                                  "/bin/db2x_" prog)))
                   '("docbook2man" "docbook2texi")))))))
    (inputs
     (list bash-minimal
           opensp
           perl
           perl-xml-namespacesupport
           perl-xml-parser
           perl-xml-sax
           perl-xml-sax-base
           texinfo
           libxslt))
    (native-inputs
     (list autoconf automake libtool
           tidy-html
           ;; For tests
           docbook-xml-4.1.2 docbook-xml-4.2 docbook-xml-4.4
           docbook-xml-4.5
           groff-minimal libxml2))
    (outputs '("out" "doc"))
    (home-page "https://docbook2x.sourceforge.net")
    (synopsis "Convert DocBook to man page and Texinfo format")
    (description
     "docbook2X is a software package that converts DocBook documents into the
traditional Unix man page format and the GNU Texinfo format.  Notable features
include table support for man pages, internationalization support, and easy
customization of the output using XSLT.")
    (license license:expat)))

debug log:

solving 1b24c3522e ...
found 1b24c3522e in https://yhetil.org/guix-patches/42abfd4d4d494f69e2df3bde8931dfb28cd39c86.1692830149.git.mirai@makinata.eu/ ||
	https://yhetil.org/guix-patches/cc0fcd178acf30ea5665d5faf6f6b4d5b5a2cf19.1695478390.git.mirai@makinata.eu/
found 8cabaa780d in https://yhetil.org/guix-patches/3971596b65c5520b349e80cff4e07f67a840131b.1692830149.git.mirai@makinata.eu/ ||
	https://yhetil.org/guix-patches/885da30c1e3c238c75530544ff713ea7133ce7a7.1695478390.git.mirai@makinata.eu/
found 91b3eeeccb in https://yhetil.org/guix-patches/a4fb2620c5a9509730ee1981aa69e19fd1ba63f0.1695478390.git.mirai@makinata.eu/ ||
	https://yhetil.org/guix-patches/986bad59cde03edca033dff2af2fe6533a6a7540.1692830149.git.mirai@makinata.eu/
found 0ecaefe253 in https://yhetil.org/guix-patches/08e550bdd1eaa2aa6cb515349ecbb8ce7e27afbe.1695478390.git.mirai@makinata.eu/ ||
	https://yhetil.org/guix-patches/50ee9ef3617cf71b7d8e8a0a2acb594452fd0211.1692830149.git.mirai@makinata.eu/
found 37eaac0a59 in https://yhetil.org/guix-patches/5bfbc03650d355564bfb8ec93e17773a54ad0120.1695478390.git.mirai@makinata.eu/ ||
	https://yhetil.org/guix-patches/14a48854705a29c41699654199d3e24ccbccba49.1692830149.git.mirai@makinata.eu/
found 2d1c1f00ad in https://yhetil.org/guix-patches/6ae5c94fe1f102c7961dfc4f7c965cf8e6afcbdb.1695478390.git.mirai@makinata.eu/ ||
	https://yhetil.org/guix-patches/c158b9ccdac64bf378b11d5af04e5b3ee73481da.1692830149.git.mirai@makinata.eu/
found 6a138dcb77 in https://yhetil.org/guix-patches/b12e2391d88de365b8104a0fc9f0a35a6530b5fb.1692830149.git.mirai@makinata.eu/ ||
	https://yhetil.org/guix-patches/c295546b3f9c6f11757b1653de7aa2862b82b9d9.1695478390.git.mirai@makinata.eu/
found 994aa57f18 in https://yhetil.org/guix-patches/40aa16c4ec5e774fa7ad47a488eb1c89250490b1.1692830149.git.mirai@makinata.eu/ ||
	https://yhetil.org/guix-patches/dd229d3a7357a415c0670e9591ad8c74821b60cb.1695478390.git.mirai@makinata.eu/
found 47d3a04479 in https://yhetil.org/guix-patches/65fd1b35abc1b81ae36e4ed52bad3173d71a8f0a.1692830149.git.mirai@makinata.eu/ ||
	https://yhetil.org/guix-patches/842e6cb9d3a1c2acb26375983b6edd84064b263d.1695478390.git.mirai@makinata.eu/
found 83a5496a0e in https://yhetil.org/guix-patches/74a2b06314c7715c7121a63e398141a19d913295.1692830149.git.mirai@makinata.eu/ ||
	https://yhetil.org/guix-patches/0fb6a173cbcc7ae9bd0b2cd2362c9c599bb6a000.1695478390.git.mirai@makinata.eu/
found 55f99aae62 in https://yhetil.org/guix-patches/ea8bd84b73d478a4cd36a11bb9635159a1f08198.1692830149.git.mirai@makinata.eu/ ||
	https://yhetil.org/guix-patches/d59b0acc6d2a6952993bcfe6a3e0baa0bb1aa5d2.1695478390.git.mirai@makinata.eu/
found 4a0104c253 in https://yhetil.org/guix-patches/52bffd0b261be7dd2452c72d0cb498446b677ae0.1695478390.git.mirai@makinata.eu/ ||
	https://yhetil.org/guix-patches/0c3332e82119f2674bca5f4d0183dab75e187953.1692830149.git.mirai@makinata.eu/
found ec1b9acb36 in https://yhetil.org/guix-patches/9b73ea4fd58a27de130a1d799e5568457e85773c.1695478390.git.mirai@makinata.eu/ ||
	https://yhetil.org/guix-patches/ba143c688e39b94af2798ba742545cd75e38f102.1692830149.git.mirai@makinata.eu/
found 329d19a05d in https://yhetil.org/guix-patches/41989879ab49bc0fcc437d5f52839a3c57434ccc.1695478390.git.mirai@makinata.eu/ ||
	https://yhetil.org/guix-patches/943b678133cfef78ab30417b7b0184408b8d962a.1692830149.git.mirai@makinata.eu/
found 4461293e1e in https://git.savannah.gnu.org/cgit/guix.git
preparing index
index prepared:
100644 4461293e1edc9cf957b51e381de9fd7a69f45a58	gnu/packages/docbook.scm

applying [1/14] https://yhetil.org/guix-patches/41989879ab49bc0fcc437d5f52839a3c57434ccc.1695478390.git.mirai@makinata.eu/
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index 4461293e1e..329d19a05d 100644

Checking patch gnu/packages/docbook.scm...
Applied patch gnu/packages/docbook.scm cleanly.

skipping https://yhetil.org/guix-patches/943b678133cfef78ab30417b7b0184408b8d962a.1692830149.git.mirai@makinata.eu/ for 329d19a05d
index at:
100644 329d19a05dfcfa3e6f9453406bc0cb201cd9b8eb	gnu/packages/docbook.scm

applying [2/14] https://yhetil.org/guix-patches/9b73ea4fd58a27de130a1d799e5568457e85773c.1695478390.git.mirai@makinata.eu/
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index 329d19a05d..ec1b9acb36 100644

Checking patch gnu/packages/docbook.scm...
Applied patch gnu/packages/docbook.scm cleanly.

skipping https://yhetil.org/guix-patches/ba143c688e39b94af2798ba742545cd75e38f102.1692830149.git.mirai@makinata.eu/ for ec1b9acb36
index at:
100644 ec1b9acb3682070a9753b4e4bca270b96fc888ad	gnu/packages/docbook.scm

applying [3/14] https://yhetil.org/guix-patches/52bffd0b261be7dd2452c72d0cb498446b677ae0.1695478390.git.mirai@makinata.eu/
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index ec1b9acb36..4a0104c253 100644

Checking patch gnu/packages/docbook.scm...
Applied patch gnu/packages/docbook.scm cleanly.

skipping https://yhetil.org/guix-patches/0c3332e82119f2674bca5f4d0183dab75e187953.1692830149.git.mirai@makinata.eu/ for 4a0104c253
index at:
100644 4a0104c25336559d753b5846c3dd781c4a8ff8ae	gnu/packages/docbook.scm

applying [4/14] https://yhetil.org/guix-patches/ea8bd84b73d478a4cd36a11bb9635159a1f08198.1692830149.git.mirai@makinata.eu/
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index 4a0104c253..55f99aae62 100644

Checking patch gnu/packages/docbook.scm...
Applied patch gnu/packages/docbook.scm cleanly.

skipping https://yhetil.org/guix-patches/d59b0acc6d2a6952993bcfe6a3e0baa0bb1aa5d2.1695478390.git.mirai@makinata.eu/ for 55f99aae62
index at:
100644 55f99aae625300c8054c6e983ef20e67660d5812	gnu/packages/docbook.scm

applying [5/14] https://yhetil.org/guix-patches/74a2b06314c7715c7121a63e398141a19d913295.1692830149.git.mirai@makinata.eu/
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index 55f99aae62..83a5496a0e 100644

Checking patch gnu/packages/docbook.scm...
Applied patch gnu/packages/docbook.scm cleanly.

skipping https://yhetil.org/guix-patches/0fb6a173cbcc7ae9bd0b2cd2362c9c599bb6a000.1695478390.git.mirai@makinata.eu/ for 83a5496a0e
index at:
100644 83a5496a0ea4abc23f1ee399812848825755681a	gnu/packages/docbook.scm

applying [6/14] https://yhetil.org/guix-patches/65fd1b35abc1b81ae36e4ed52bad3173d71a8f0a.1692830149.git.mirai@makinata.eu/
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index 83a5496a0e..47d3a04479 100644

Checking patch gnu/packages/docbook.scm...
Applied patch gnu/packages/docbook.scm cleanly.

skipping https://yhetil.org/guix-patches/842e6cb9d3a1c2acb26375983b6edd84064b263d.1695478390.git.mirai@makinata.eu/ for 47d3a04479
index at:
100644 47d3a044792ac5fa8bec3e83ae7cd91829778523	gnu/packages/docbook.scm

applying [7/14] https://yhetil.org/guix-patches/40aa16c4ec5e774fa7ad47a488eb1c89250490b1.1692830149.git.mirai@makinata.eu/
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index 47d3a04479..994aa57f18 100644

Checking patch gnu/packages/docbook.scm...
Applied patch gnu/packages/docbook.scm cleanly.

skipping https://yhetil.org/guix-patches/dd229d3a7357a415c0670e9591ad8c74821b60cb.1695478390.git.mirai@makinata.eu/ for 994aa57f18
index at:
100644 994aa57f185ba9cd78f3fdc097d34dd298169dff	gnu/packages/docbook.scm

applying [8/14] https://yhetil.org/guix-patches/b12e2391d88de365b8104a0fc9f0a35a6530b5fb.1692830149.git.mirai@makinata.eu/
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index 994aa57f18..6a138dcb77 100644

Checking patch gnu/packages/docbook.scm...
Applied patch gnu/packages/docbook.scm cleanly.

skipping https://yhetil.org/guix-patches/c295546b3f9c6f11757b1653de7aa2862b82b9d9.1695478390.git.mirai@makinata.eu/ for 6a138dcb77
index at:
100644 6a138dcb77accef99790cff2b0fb86a98569d90c	gnu/packages/docbook.scm

applying [9/14] https://yhetil.org/guix-patches/6ae5c94fe1f102c7961dfc4f7c965cf8e6afcbdb.1695478390.git.mirai@makinata.eu/
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index 6a138dcb77..2d1c1f00ad 100644

Checking patch gnu/packages/docbook.scm...
Applied patch gnu/packages/docbook.scm cleanly.

skipping https://yhetil.org/guix-patches/c158b9ccdac64bf378b11d5af04e5b3ee73481da.1692830149.git.mirai@makinata.eu/ for 2d1c1f00ad
index at:
100644 2d1c1f00ad346860bda6a81c0d2665908f1c163b	gnu/packages/docbook.scm

applying [10/14] https://yhetil.org/guix-patches/5bfbc03650d355564bfb8ec93e17773a54ad0120.1695478390.git.mirai@makinata.eu/
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index 2d1c1f00ad..37eaac0a59 100644

Checking patch gnu/packages/docbook.scm...
Applied patch gnu/packages/docbook.scm cleanly.

skipping https://yhetil.org/guix-patches/14a48854705a29c41699654199d3e24ccbccba49.1692830149.git.mirai@makinata.eu/ for 37eaac0a59
index at:
100644 37eaac0a5969c847498c85a94f6ab8f5b7827195	gnu/packages/docbook.scm

applying [11/14] https://yhetil.org/guix-patches/08e550bdd1eaa2aa6cb515349ecbb8ce7e27afbe.1695478390.git.mirai@makinata.eu/
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index 37eaac0a59..0ecaefe253 100644

Checking patch gnu/packages/docbook.scm...
Applied patch gnu/packages/docbook.scm cleanly.

skipping https://yhetil.org/guix-patches/50ee9ef3617cf71b7d8e8a0a2acb594452fd0211.1692830149.git.mirai@makinata.eu/ for 0ecaefe253
index at:
100644 0ecaefe253dfc27f57cd1cc5e84c5a26c205144c	gnu/packages/docbook.scm

applying [12/14] https://yhetil.org/guix-patches/a4fb2620c5a9509730ee1981aa69e19fd1ba63f0.1695478390.git.mirai@makinata.eu/
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index 0ecaefe253..91b3eeeccb 100644

Checking patch gnu/packages/docbook.scm...
Applied patch gnu/packages/docbook.scm cleanly.

skipping https://yhetil.org/guix-patches/986bad59cde03edca033dff2af2fe6533a6a7540.1692830149.git.mirai@makinata.eu/ for 91b3eeeccb
index at:
100644 91b3eeeccbb60405f92745216fd2b9676f560833	gnu/packages/docbook.scm

applying [13/14] https://yhetil.org/guix-patches/3971596b65c5520b349e80cff4e07f67a840131b.1692830149.git.mirai@makinata.eu/
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index 91b3eeeccb..8cabaa780d 100644

Checking patch gnu/packages/docbook.scm...
Applied patch gnu/packages/docbook.scm cleanly.

skipping https://yhetil.org/guix-patches/885da30c1e3c238c75530544ff713ea7133ce7a7.1695478390.git.mirai@makinata.eu/ for 8cabaa780d
index at:
100644 8cabaa780d7bc23e2bb64ca025c67416f2de7858	gnu/packages/docbook.scm

applying [14/14] https://yhetil.org/guix-patches/42abfd4d4d494f69e2df3bde8931dfb28cd39c86.1692830149.git.mirai@makinata.eu/
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index 8cabaa780d..1b24c3522e 100644

Checking patch gnu/packages/docbook.scm...
Applied patch gnu/packages/docbook.scm cleanly.

skipping https://yhetil.org/guix-patches/cc0fcd178acf30ea5665d5faf6f6b4d5b5a2cf19.1695478390.git.mirai@makinata.eu/ for 1b24c3522e
index at:
100644 1b24c3522e203e2adbbac9727c14e6ba39d8a457	gnu/packages/docbook.scm

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).