gnu: Add texlive-hyphen-belarusian.
[jackhill/guix/guix.git] / gnu / packages / tex.scm
index 5b29937..31dd67e 100644 (file)
   #:use-module (ice-9 match)
   #:use-module ((srfi srfi-1) #:hide (zip)))
 
+(define* (simple-texlive-package name locations hash
+                                 #:key trivial?)
+  "Return a template for a simple TeX Live package with the given NAME,
+downloading from a list of LOCATIONS in the TeX Live repository, and expecting
+the provided output HASH.  If TRIVIAL? is provided, all files will simply be
+copied to their outputs; otherwise the TEXLIVE-BUILD-SYSTEM is used."
+  (define with-documentation?
+    (and trivial?
+         (any (lambda (location)
+                (string-prefix? "/doc" location))
+              locations)))
+  (package
+    (name name)
+    (version (number->string %texlive-revision))
+    (source (texlive-origin name version
+                            locations hash))
+    (outputs (if with-documentation?
+                 '("out" "doc")
+                 '("out")))
+    (build-system (if trivial?
+                      gnu-build-system
+                      texlive-build-system))
+    (arguments
+     (let ((copy-files
+            `(lambda* (#:key outputs inputs #:allow-other-keys)
+               (let (,@(if with-documentation?
+                           `((doc (string-append (assoc-ref outputs "doc")
+                                                 "/share/texmf-dist/")))
+                           '())
+                     (out (string-append (assoc-ref outputs "out")
+                                         "/share/texmf-dist/")))
+                 ,@(if with-documentation?
+                       '((mkdir-p doc)
+                         (copy-recursively
+                          (string-append (assoc-ref inputs "source") "/doc")
+                          (string-append doc "/doc")))
+                       '())
+                 (mkdir-p out)
+                 (copy-recursively (assoc-ref inputs "source") out)
+                 ,@(if with-documentation?
+                       '((delete-file-recursively (string-append out "/doc")))
+                       '())
+                 #t))))
+       (if trivial?
+           `(#:tests? #f
+             #:phases
+             (modify-phases %standard-phases
+               (delete 'configure)
+               (replace 'build (const #t))
+               (replace 'install ,copy-files)))
+           `(#:phases
+             (modify-phases %standard-phases
+               (add-after 'install 'copy-files ,copy-files))))))
+    (home-page #f)
+    (synopsis #f)
+    (description #f)
+    (license #f)))
+
+(define hyph-utf8-scripts
+  (origin
+    (method svn-fetch)
+    (uri (texlive-ref "generic" "hyph-utf8"))
+    (file-name (string-append "hyph-utf8-scripts-"
+                              (number->string %texlive-revision)
+                              "-checkout"))
+    (sha256
+     (base32
+      "1ix8h637hwhz4vrdhilf84kzzdza0wi8fp26nh7iws0bq08sl517"))))
+
+(define (texlive-hyphen-package name code locations hash)
+  (let ((parent (simple-texlive-package
+                 name locations hash #:trivial? #t)))
+    (package
+      (inherit parent)
+      (arguments
+       (substitute-keyword-arguments (package-arguments parent)
+         ((#:modules _ '())
+          '((guix build gnu-build-system)
+            (guix build utils)
+            (ice-9 match)))
+         ((#:phases phases)
+          `(modify-phases ,phases
+             (replace 'build
+               (lambda* (#:key inputs outputs #:allow-other-keys)
+                 (let* ((out (assoc-ref outputs "out"))
+                        (root (string-append out "/share/texmf-dist"))
+                        (patterns
+                         (string-append root "/tex/generic/hyph-utf8/patterns/txt/"))
+                        (loaders
+                         (string-append root "/tex/generic/hyph-utf8/loadhyph"))
+                        (ptex
+                         (string-append root "/tex/generic/hyph-utf8/patterns/ptex"))
+                        (filter-expression
+                         (match ',code
+                           ((? string?)
+                            (format #f "\nlanguages.select!{|l| l.code == \"~a\"}\n" ',code))
+                           ((a b ...)
+                            (format #f "\nlanguages.select!{|l| [~{\"~a\",~}].include? l.code }\n" ',code)))))
+                   (mkdir "scripts")
+                   (copy-recursively
+                    (assoc-ref inputs "hyph-utf8-scripts") "scripts")
+
+                   ;; Prepare target directories
+                   (mkdir-p patterns)
+                   (mkdir-p loaders)
+                   (mkdir-p ptex)
+
+                   ;; Generate plain patterns
+                   (with-directory-excursion "scripts"
+                     (substitute* "languages.rb"
+                       (("../../../tex/generic/") "../tex/generic/"))
+                     (substitute* "generate-plain-patterns.rb"
+                       ;; Ruby 2 does not need this.
+                       (("require 'unicode'") "")
+                       (("Unicode.upcase\\(ch\\)") "ch.upcase")
+                       ;; Write directly to the output directory
+                       (("\\$path_root=File.*")
+                        (string-append "$path_root=\"" out "/share/texmf-dist/\"\n"))
+                       ;; Create quote directory when needed
+                       (("f = File.open\\(\"#\\{\\$path_quote\\}" m)
+                        (string-append "require 'fileutils'; FileUtils.mkdir_p $path_quote;" m))
+                       ;; Only generate patterns for this language.
+                       (("languages =.*" m)
+                        (string-append m filter-expression)))
+                     (invoke "ruby" "generate-plain-patterns.rb")
+
+                     ;; Build pattern loaders
+                     (substitute* "generate-pattern-loaders.rb"
+                       (("\\$path_tex_generic=File.*")
+                        (string-append "$path_tex_generic=\"" root "/tex/generic\"\n"))
+                       ;; Only generate loader for this language.
+                       (("languages =.*" m)
+                        (string-append m filter-expression)))
+                     (invoke "ruby" "generate-pattern-loaders.rb")
+
+                     ;; Build ptex patterns
+                     (substitute* "generate-ptex-patterns.rb"
+                       (("\\$path_root=File.*")
+                        (string-append "$path_root=\"" root "\"\n"))
+                       ;; Only generate ptex patterns for this language.
+                       (("languages =.*" m)
+                        (string-append m filter-expression)))
+                     (invoke "ruby" "generate-ptex-patterns.rb")))))))))
+      (native-inputs
+       `(("ruby" ,ruby)
+         ("hyph-utf8-scripts" ,hyph-utf8-scripts)))
+      (home-page "https://ctan.org/pkg/hyph-utf8"))))
+
 (define texlive-extra-src
   (origin
     (method url-fetch)
        (base32
         "0khyi6h015r2zfqgg0a44a2j7vmr1cy42knw7jbss237yvakc07y"))
       (patches
-       (list
-        ;; This is required for compatibility with Poppler 0.64.0 and to fix a
-        ;; segmentation fault in dvipdfm-x from XeTeX, and also contains a fix
-        ;; for CVE-2018-17407.
-        (origin
-          (method url-fetch)
-          (uri (string-append "http://www.linuxfromscratch.org/patches/blfs/"
-                              "svn/texlive-" version "-source-upstream_fixes-2.patch"))
-          (file-name "texlive-poppler-compat.patch")
-          (sha256
-           (base32
-            "04sxy1qv9y575mxwyg3y7rx7mh540pfjqx7yni7ncb5wjbq9pq1a")))
-        (search-patch "texlive-bin-luatex-poppler-compat.patch")
-        (search-patch "texlive-bin-pdftex-poppler-compat.patch")
-        (search-patch "texlive-bin-xetex-poppler-compat.patch")))))
+       (let ((arch-patch
+              (lambda (name revision hash)
+                (origin
+                  (method url-fetch)
+                  (uri (string-append "https://git.archlinux.org/svntogit/packages.git"
+                                      "/plain/trunk/" name "?h=packages/texlive-bin"
+                                      "&id=" revision))
+                  (file-name (string-append "texlive-bin-" name))
+                  (sha256 (base32 hash)))))
+             (arch-revision "e1975bce0b9d270d7c9773c5beb7e87d61ee8f57"))
+         (append (search-patches  "texlive-bin-CVE-2018-17407.patch"
+                                  "texlive-bin-luatex-poppler-compat.patch")
+                 (list
+                  (arch-patch "pdftex-poppler0.72.patch" arch-revision
+                              "0p46b6xxxg2s3hx67r0wpz16g3qygx65hpc581xs3jz5pvsiq3y7")
+                  (arch-patch "xetex-poppler-fixes.patch" arch-revision
+                              "1jj1p5zkjljb7id9pjv29cw0cf8mwrgrh4ackgzz9c200vaqpsvx")))))))
    (build-system gnu-build-system)
    (inputs
     `(("texlive-extra-src" ,texlive-extra-src)
             #t))
         (add-after 'unpack 'use-code-for-new-poppler
           (lambda _
-            (copy-file "texk/web2c/pdftexdir/pdftoepdf-newpoppler.cc"
+            (copy-file "texk/web2c/pdftexdir/pdftoepdf-poppler0.72.0.cc"
                        "texk/web2c/pdftexdir/pdftoepdf.cc")
-            (copy-file "texk/web2c/pdftexdir/pdftosrc-newpoppler.cc"
+            (copy-file "texk/web2c/pdftexdir/pdftosrc-poppler0.72.0.cc"
                        "texk/web2c/pdftexdir/pdftosrc.cc")
             #t))
         (add-after 'unpack 'disable-failing-test
@@ -261,99 +411,16 @@ This package contains the binaries.")
    (license (license:fsf-free "https://www.tug.org/texlive/copying.html"))
    (home-page "https://www.tug.org/texlive/")))
 
-(define-public texlive-dvips
+\f
+(define-public texlive-unicode-data
   (package
-    (name "texlive-dvips")
-    (version (number->string %texlive-revision))
-    (source (origin
-              (method svn-fetch)
-              (uri (svn-reference
-                    (url (string-append "svn://www.tug.org/texlive/tags/"
-                                        %texlive-tag "/Master/texmf-dist/"
-                                        "/dvips"))
-                    (revision %texlive-revision)))
-              (file-name (string-append name "-" version "-checkout"))
-              (sha256
-               (base32
-                "1ky6wc173jhf0b33lhyb4r3bx1d4bmiqkn6y1hxn92kwjdzl42p7"))))
-    (build-system trivial-build-system)
-    (arguments
-     `(#:modules ((guix build utils))
-       #:builder
-       (begin
-         (use-modules (guix build utils))
-         (let* ((root (string-append (assoc-ref %outputs "out")
-                                     "/share/texmf-dist"))
-                (dvips (string-append root "/dvips"))
-                (maps  (string-append root "/fonts/map/dvips"))
-                (encs  (string-append root "/fonts/enc/dvips/base")))
-           (mkdir-p dvips)
-           (copy-recursively (assoc-ref %build-inputs "source") dvips)
-           (mkdir-p maps)
-           (copy-recursively (assoc-ref %build-inputs "dvips-font-maps") maps)
-           (mkdir-p encs)
-           (copy-recursively (assoc-ref %build-inputs "dvips-base-enc") encs)
-           #t))))
-    (native-inputs
-     `(("dvips-font-maps"
-        ,(origin
-           (method svn-fetch)
-           (uri (svn-reference
-                 (url (string-append "svn://www.tug.org/texlive/tags/"
-                                     %texlive-tag "/Master/texmf-dist/"
-                                     "/fonts/map/dvips"))
-                 (revision %texlive-revision)))
-           (file-name (string-append "dvips-font-maps-" version "-checkout"))
-           (sha256
-            (base32
-             "0nxvfbb5vsvakiw0iviicghdc2sxk05cj056ilqnpa62fffc36a6"))))
-       ("dvips-base-enc"
-        ,(origin
-           (method svn-fetch)
-           (uri (svn-reference
-                 (url (string-append "svn://www.tug.org/texlive/tags/"
-                                     %texlive-tag "/Master/texmf-dist/"
-                                     "/fonts/enc/dvips/base"))
-                 (revision %texlive-revision)))
-           (file-name (string-append "dvips-base-enc-" version "-checkout"))
-           (sha256
-            (base32
-             "1xnf6ms0h87r55kxik4vicwr1907scj789lhqflqns8svvsli5iy"))))))
-    (home-page "https://www.ctan.org/pkg/dvips")
-    (synopsis "DVI to PostScript drivers")
-    (description "This package provides files needed for converting DVI files
-to PostScript.")
-    ;; Various free software licenses apply to individual files.
-    (license (list license:lppl1.3c+
-                   license:expat
-                   license:lgpl3+))))
-
-(define-public texlive-generic-unicode-data
-  (package
-    (name "texlive-generic-unicode-data")
-    (version (number->string %texlive-revision))
-    (source (origin
-              (method svn-fetch)
-              (uri (svn-reference
-                    (url (string-append "svn://www.tug.org/texlive/tags/"
-                                        %texlive-tag "/Master/texmf-dist/"
-                                        "/tex/generic/unicode-data"))
-                    (revision %texlive-revision)))
-              (file-name (string-append name "-" version "-checkout"))
-              (sha256
-               (base32
-                "0r1v16jyfpz6dwqsgm6b9jcj4kf2pkzc9hg07s6fx9g8ba8qglih"))))
-    (build-system trivial-build-system)
-    (arguments
-     `(#:modules ((guix build utils))
-       #:builder
-       (begin
-         (use-modules (guix build utils))
-         (let ((target (string-append (assoc-ref %outputs "out")
-                                      "/share/texmf-dist/tex/generic/unicode-data")))
-             (mkdir-p target)
-             (copy-recursively (assoc-ref %build-inputs "source") target)
-             #t))))
+    (inherit (simple-texlive-package
+              "texlive-unicode-data"
+              (list "/tex/generic/unicode-data/"
+                    "/doc/generic/unicode-data/")
+              (base32
+               "1j63kz29arfiydb8r1a53q1r4zyk1yjbcq0w9i93zddczgqzgbfb")
+              #:trivial? #t))
     (home-page "https://www.ctan.org/pkg/unicode-data")
     (synopsis "Unicode data and loaders for TeX")
     (description "This bundle provides generic access to Unicode Consortium
@@ -367,68 +434,63 @@ set up and one for initializing XeTeX character classes as has been carried
 out to date by @code{unicode-letters.tex}. ")
     (license license:lppl1.3c+)))
 
-(define-public texlive-generic-dehyph-exptl
+(define-public texlive-generic-unicode-data
+  (deprecated-package "texlive-generic-unicode-data" texlive-unicode-data))
+
+(define-public texlive-hyphen-base
+  (package
+    (inherit (simple-texlive-package
+              "texlive-hyphen-base"
+              (list "/tex/generic/config/language.dat"
+                    "/tex/generic/config/language.dat.lua"
+                    "/tex/generic/config/language.def"
+                    "/tex/generic/config/language.us"
+                    "/tex/generic/config/language.us.def"
+                    "/tex/generic/config/language.us.lua"
+                    "/tex/generic/hyphen/dumyhyph.tex"
+                    "/tex/generic/hyphen/hyphen.tex"
+                    "/tex/generic/hyphen/hypht1.tex"
+                    "/tex/generic/hyphen/zerohyph.tex")
+              (base32
+               "002g5zhzbj3ikgg8zidagdp605ac9f4qmfl148mp0mbpz1svk0ni")
+              #:trivial? #t))
+    (home-page "https://tug.org/texlive/")
+    (synopsis "Core hyphenation support files")
+    (description "This package includes Knuth's original @file{hyphen.tex},
+@file{zerohyph.tex} to disable hyphenation, @file{language.us} which starts
+the autogenerated files @file{language.dat} and @file{language.def} (and
+default versions of those), etc.")
+    (license license:knuth)))
+
+;; TODO: This package should not exist.  There should not be a single package
+;; containing all of /dvips.  These really belong to different packages.
+(define-public texlive-dvips
   (package
-    (name "texlive-generic-dehyph-exptl")
-    (version (number->string %texlive-revision))
-    (source (origin
-              (method svn-fetch)
-              (uri (svn-reference
-                    (url (string-append "svn://www.tug.org/texlive/tags/"
-                                        %texlive-tag "/Master/texmf-dist/"
-                                        "/tex/generic/dehyph-exptl"))
-                    (revision %texlive-revision)))
-              (file-name (string-append name "-" version "-checkout"))
-              (sha256
-               (base32
-                "03yj1di9py92drp6gpfva6q69vk2iixr79r7cp7ja570s3pr0m33"))))
-    (build-system trivial-build-system)
-    (arguments
-     `(#:modules ((guix build utils))
-       #:builder
-       (begin
-         (use-modules (guix build utils))
-         (let ((target (string-append (assoc-ref %outputs "out")
-                                      "/share/texmf-dist/tex/generic/dehyph-exptl")))
-           (mkdir-p target)
-           (copy-recursively (assoc-ref %build-inputs "source") target)
-           #t))))
-    (home-page "http://projekte.dante.de/Trennmuster/WebHome")
-    (synopsis "Hyphenation patterns for German")
-    (description "The package provides experimental hyphenation patterns for
-the German language, covering both traditional and reformed orthography.  The
-patterns can be used with packages Babel and hyphsubst from the Oberdiek
-bundle.")
-    ;; Hyphenation patterns are under the Expat license; documentation is
-    ;; under LPPL.
-    (license (list license:expat license:lppl))))
+    (inherit (simple-texlive-package
+              "texlive-dvips"
+              (list "/fonts/map/dvips/"
+                    "/fonts/enc/dvips/base/"
+                    "/dvips/")
+              (base32
+               "1di07wx8wjczddmagq5z082l2has3inzk5jwkqh4i6wv1qdfqpp6")
+              #:trivial? #t))
+    (home-page "https://www.ctan.org/pkg/dvips")
+    (synopsis "DVI to PostScript drivers")
+    (description "This package provides files needed for converting DVI files
+to PostScript.")
+    ;; Various free software licenses apply to individual files.
+    (license (list license:lppl1.3c+
+                   license:expat
+                   license:lgpl3+))))
 
-(define-public texlive-generic-tex-ini-files
+(define-public texlive-tex-ini-files
   (package
-    (name "texlive-generic-tex-ini-files")
-    (version (number->string %texlive-revision))
-    (source (origin
-              (method svn-fetch)
-              (uri (svn-reference
-                    (url (string-append "svn://www.tug.org/texlive/tags/"
-                                        %texlive-tag "/Master/texmf-dist/"
-                                        "/tex/generic/tex-ini-files"))
-                    (revision %texlive-revision)))
-              (file-name (string-append name "-" version "-checkout"))
-              (sha256
-               (base32
-                "1wh42n1lmzcvi3g6mm31nm3yd5ha5bl260xqc444jg1m9fdp3wz5"))))
-    (build-system trivial-build-system)
-    (arguments
-     `(#:modules ((guix build utils))
-       #:builder
-       (begin
-         (use-modules (guix build utils))
-         (let ((target (string-append (assoc-ref %outputs "out")
-                                      "/share/texmf-dist/tex/generic/tex-ini-files")))
-           (mkdir-p target)
-           (copy-recursively (assoc-ref %build-inputs "source") target)
-           #t))))
+    (inherit (simple-texlive-package
+              "texlive-tex-ini-files"
+              (list "/tex/generic/tex-ini-files/")
+              (base32
+               "0q1g62jg0qiqslm93ycvm30bw8ydmssjdshzsnzl7n2vpd62qfi2")
+              #:trivial? #t))
     (home-page "https://www.ctan.org/pkg/tex-ini-files")
     (synopsis "Files for creating TeX formats")
     (description "This bundle provides a collection of model \".ini\" files
@@ -438,62 +500,8 @@ allow existing format source files to be used with newer engines, for example
 to adapt the plain e-TeX source file to work with XeTeX and LuaTeX.")
     (license license:public-domain)))
 
-(define-public texlive-generic-hyph-utf8
-  (package
-    (name "texlive-generic-hyph-utf8")
-    (version (number->string %texlive-revision))
-    (source (origin
-              (method svn-fetch)
-              (uri (svn-reference
-                    (url (string-append "svn://www.tug.org/texlive/tags/"
-                                        %texlive-tag "/Master/texmf-dist/"
-                                        "/tex/generic/hyph-utf8"))
-                    (revision %texlive-revision)))
-              (file-name (string-append name "-" version "-checkout"))
-              (sha256
-               (base32
-                "1alnn9cd60m2c12vym9f9q22ap1ngywxpkjl9dk472why44g1dmy"))))
-    (build-system trivial-build-system)
-    (arguments
-     `(#:modules ((guix build utils))
-       #:builder
-       (begin
-         (use-modules (guix build utils))
-         (let ((target (string-append (assoc-ref %outputs "out")
-                                      "/share/texmf-dist/tex/generic/hyph-utf8")))
-           (mkdir-p target)
-           (copy-recursively (assoc-ref %build-inputs "source") target)
-           #t))))
-    (home-page "https://ctan.org/pkg/hyph-utf8")
-    (synopsis "Hyphenation patterns expressed in UTF-8")
-    (description "Modern native UTF-8 engines such as XeTeX and LuaTeX need
-hyphenation patterns in UTF-8 format, whereas older systems require
-hyphenation patterns in the 8-bit encoding of the font in use (such encodings
-are codified in the LaTeX scheme with names like OT1, T2A, TS1, OML, LY1,
-etc).  The present package offers a collection of conversions of existing
-patterns to UTF-8 format, together with converters for use with 8-bit fonts in
-older systems.  Since hyphenation patterns for Knuthian-style TeX systems are
-only read at iniTeX time, it is hoped that the UTF-8 patterns, with their
-converters, will completely supplant the older patterns.")
-    ;; Individual files each have their own license.  Most of these files are
-    ;; independent hyphenation patterns.
-    (license (list license:lppl1.0+
-                   license:lppl1.2+
-                   license:lppl1.3
-                   license:lppl1.3+
-                   license:lppl1.3a+
-                   license:lgpl2.1
-                   license:lgpl2.1+
-                   license:lgpl3+
-                   license:gpl2+
-                   license:gpl3+
-                   license:mpl1.1
-                   license:asl2.0
-                   license:expat
-                   license:bsd-3
-                   license:cc0
-                   license:public-domain
-                   license:wtfpl2))))
+(define-public texlive-generic-tex-ini-files
+  (deprecated-package "texlive-generic-tex-ini-files" texlive-tex-ini-files))
 
 (define-public texlive-metafont-base
   (package
@@ -619,19 +627,15 @@ documents.")
 
 (define-public texlive-fonts-cm
   (package
-    (name "texlive-fonts-cm")
-    (version (number->string %texlive-revision))
-    (source (origin
-              (method svn-fetch)
-              (uri (svn-reference
-                    (url (string-append "svn://www.tug.org/texlive/tags/"
-                                        %texlive-tag "/Master/texmf-dist/"
-                                        "/fonts/source/public/cm"))
-                    (revision %texlive-revision)))
-              (file-name (string-append name "-" version "-checkout"))
-              (sha256
-               (base32
-                "0vfjhidr9pha613h8mfhnpcpvld6ahdfb449918fpsfs93cppkyj"))))
+    (inherit (simple-texlive-package
+              "texlive-fonts-cm"
+              (list "/fonts/source/public/cm/"
+                    "/fonts/map/dvips/cm/cmtext-bsr-interpolated.map"
+                    "/doc/fonts/cm/README"
+                    "/doc/fonts/cm/README-cmps.txt")
+              (base32
+               "1h0q71paqmg1xjg6k35ni2i6m93kmlq9rdwm913xg9n4qngywl18")))
+    (outputs '("out" "doc"))
     (build-system gnu-build-system)
     (arguments
      `(#:modules ((guix build gnu-build-system)
@@ -649,58 +653,57 @@ documents.")
                (setenv "MFBASES" (string-append mf "/share/texmf-dist/web2c"))
                ;; Tell mf where to look for source files
                (setenv "MFINPUTS"
-                       (string-append (getcwd) ":"
+                       (string-append (getcwd) "/fonts/source/public/cm/:"
                                       mf "/share/texmf-dist/metafont/base")))
-             (mkdir "build")
-             (mkdir-p "pk/ljfour/public/cm/dpi600")
-             (for-each (lambda (font)
-                         (format #t "building font ~a\n" font)
-                         (invoke "mf" "-progname=mf"
-                                 "-output-directory=build"
-                                 (string-append "\\"
-                                                "mode:=ljfour; "
-                                                "mag:=1+0/600; "
-                                                "batchmode; "
-                                                "input "
-                                                (basename font ".mf")))
-                         (invoke "gftopk"
-                                 (string-append "build/"
-                                                (basename font ".mf") ".600gf")
-                                 (string-append "pk/ljfour/public/cm/dpi600/"
-                                                (basename font ".mf") ".pk")))
-                       (find-files "." "cm(.*[0-9]+.*|inch)\\.mf$"))
+             (for-each make-file-writable
+                       (cons "fonts/source/public/cm/"
+                             (find-files "fonts/source/public/cm/" ".*")))
+             (let ((build (string-append (getcwd) "/build"))
+                   (pkdir (string-append (getcwd) "/pk/ljfour/public/cm/dpi600")))
+               (mkdir-p pkdir)
+               (mkdir-p build)
+               (with-directory-excursion "fonts/source/public/cm/"
+                 (for-each (lambda (font)
+                             (format #t "building font ~a\n" font)
+                             (invoke "mf" "-progname=mf"
+                                     (string-append "-output-directory=" build)
+                                     (string-append "\\"
+                                                    "mode:=ljfour; "
+                                                    "mag:=1+0/600; "
+                                                    "scrollmode; "
+                                                    "input "
+                                                    (basename font ".mf")))
+                             (invoke "gftopk"
+                                     (string-append build "/"
+                                                    (basename font ".mf") ".600gf")
+                                     (string-append pkdir "/"
+                                                    (basename font ".mf") ".pk")))
+                           (find-files "." "cm(.*[0-9]+.*|inch)\\.mf$"))))
              #t))
          (replace 'install
            (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let* ((out   (assoc-ref outputs "out"))
-                    (fonts (string-append out "/share/texmf-dist/fonts/"))
-                    (pk    (string-append fonts "pk"))
-                    (tfm   (string-append fonts "tfm/public/cm"))
-                    (mf    (string-append fonts "source/public/cm"))
-                    (type1 (string-append fonts "type1/public/amsfonts/cm")))
+             (let* ((out    (assoc-ref outputs "out"))
+                    (doc    (assoc-ref outputs "doc"))
+                    (source (assoc-ref inputs "source"))
+                    (fonts  (string-append out "/share/texmf-dist/fonts/"))
+                    (pk     (string-append fonts "pk"))
+                    (tfm    (string-append fonts "tfm/public/cm"))
+                    (mf     (string-append fonts "source/public/cm")))
                (for-each (cut install-file <> tfm)
                          (find-files "build" "\\.*"))
                (for-each (cut install-file <> mf)
                          (find-files "." "\\.mf"))
                (copy-recursively "pk" pk)
-               (mkdir-p type1)
-               (copy-recursively (assoc-ref inputs "cm-type1") type1)
+               (copy-recursively
+                (string-append source "/doc")
+                (string-append doc "/doc"))
+               (install-file
+                (string-append source "/fonts/map/dvips/cm/cmtext-bsr-interpolated.map")
+                (string-append fonts "/map/dvips/cm/cmtext-bsr-interpolated.map"))
                #t))))))
     (native-inputs
      `(("texlive-bin" ,texlive-bin)
-       ("texlive-metafont-base" ,texlive-metafont-base)
-       ("cm-type1"
-        ,(origin
-           (method svn-fetch)
-           (uri (svn-reference
-                 (url (string-append "svn://www.tug.org/texlive/tags/"
-                                     %texlive-tag "/Master/texmf-dist/"
-                                     "/fonts/type1/public/amsfonts/cm"))
-                 (revision %texlive-revision)))
-           (file-name (string-append name "-type1-" version "-checkout"))
-           (sha256
-            (base32
-             "12jyl9jp3hidifa4l5pmi47p71d5mb5kj5rknxkygilix8yz2iy6"))))))
+       ("texlive-metafont-base" ,texlive-metafont-base)))
     (home-page "https://www.ctan.org/pkg/cm")
     (synopsis "Computer Modern fonts for TeX")
     (description "This package provides the Computer Modern fonts by Donald
@@ -1320,6 +1323,26 @@ by the amsfonts package.  It provides @code{amsfonts.sty}, with names of
 individual symbols defined in @code{amssymb.sty}.")
     (license license:silofl1.1)))
 
+(define-public texlive-mkpattern
+  (package
+    (inherit (simple-texlive-package
+              "texlive-mkpattern"
+              (list "/doc/plain/mkpattern/README"
+                    "/doc/plain/mkpattern/mkpatdoc.tex"
+                    "/doc/plain/mkpattern/mkpatter.pdf"
+                    "/doc/plain/mkpattern/mkpattern-exmpl.tex"
+                    "/tex/plain/mkpattern/mkpatter.tex")
+              (base32
+               "0sxnkbcc802jl3fj56x9hvg978bpv15lhrwj0aykb4syq29l47ga")
+              #:trivial? #t))
+    (home-page "https://ctan.org/pkg/mkpattern")
+    (synopsis "Utility for making hyphenation patterns")
+    (description "Mkpattern is a general purpose program for the generation of
+hyphenation patterns, with definition of letter sets and template-like
+constructions.  It also provides an easy way to handle different input and
+output encodings, and features generation of clean UTF-8 patterns.")
+    (license license:lppl)))
+
 ;; This provides etex.src which is needed to build various formats, including
 ;; luatex.fmt and pdflatex.fmt
 (define-public texlive-tex-plain
@@ -1356,6 +1379,291 @@ TeXbook, together with various supporting files (some also discussed in the
 book).")
     (license license:knuth)))
 
+(define-public texlive-hyphen-afrikaans
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-afrikaans" "af"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-af.tex")
+              (base32
+               "1vb3jccqnn1pm0680yqx52kvz595fmxnwa0cbf8qman6zglsssiw")))
+    (synopsis "Hyphenation patterns for Afrikaans")
+    (description "The package provides hyphenation patterns for the Afrikaans
+language.")
+    (license license:lppl1.3+)))
+
+(define-public texlive-hyphen-ancientgreek
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-ancientgreek" "grc"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-grc.tex"
+                    "/tex/generic/hyphen/grahyph5.tex"
+                    "/tex/generic/hyphen/ibyhyph.tex")
+              (base32
+               "0kwrqsz7wdr1d9kylzwp60ka3wfbj8iad029k5h6y94nb86mf7zv")))
+    (synopsis "Hyphenation patterns for ancient Greek")
+    (description "The package provides hyphenation patterns for ancient
+Greek.")
+    (license license:lppl1.3+)))
+
+(define-public texlive-hyphen-armenian
+  (let ((template (texlive-hyphen-package
+                   "texlive-hyphen-armenian" "hy"
+                   (list "/source/generic/hyph-utf8/languages/hy/generate_patterns_hy.rb")
+                   (base32
+                    "0z666y580w1kpxssdanz67ykq257lf11a1mnp1jrn08zijvfrw9c"))))
+    (package
+      (inherit template)
+      (arguments
+       (substitute-keyword-arguments (package-arguments template)
+         ((#:phases phases)
+          `(modify-phases ,phases
+             (add-before 'build 'build-patterns
+               (lambda _
+                 (let ((target (string-append (getcwd)
+                                              "/tex/generic/hyph-utf8/patterns/tex")))
+                   (mkdir-p target)
+                   (with-directory-excursion "source/generic/hyph-utf8/languages/hy/"
+                     (substitute* "generate_patterns_hy.rb"
+                       (("\\$file = File.new.*")
+                        (string-append "$file = File.new(\"" target
+                                       "/hyph-hy.tex\",\"w\")\n")))
+                     (invoke "ruby" "generate_patterns_hy.rb"))
+                   #t)))
+             (add-after 'install 'install-hyph-hy.tex
+               (lambda* (#:key inputs outputs #:allow-other-keys)
+                 (let* ((out (assoc-ref outputs "out"))
+                        (target (string-append out "/share/texmf-dist/tex")))
+                   (copy-recursively "tex" target)
+                   #t)))))))
+      (synopsis "Hyphenation patterns for Armenian")
+      (description "The package provides hyphenation patterns for the Armenian
+language.")
+      ;; Any version of the LGPL.
+      (license license:lgpl3+))))
+
+(define-public texlive-hyphen-basque
+  (let ((template (texlive-hyphen-package
+                    "texlive-hyphen-basque" "eu"
+                    (list "/source/generic/hyph-utf8/languages/eu/generate_patterns_eu.rb")
+                    (base32
+                     "1yhsbzf1g9dm70jfixsz51hsfvn26cwfkfxvhg7xv2piynr4v51l"))))
+    (package
+      (inherit template)
+      (arguments
+       (substitute-keyword-arguments (package-arguments template)
+         ((#:phases phases)
+          `(modify-phases ,phases
+             (add-before 'build 'build-patterns
+               (lambda _
+                 (let ((target (string-append (getcwd)
+                                              "/tex/generic/hyph-utf8/patterns/tex")))
+                   (mkdir-p target)
+                   (with-directory-excursion "source/generic/hyph-utf8/languages/eu/"
+                     (substitute* "generate_patterns_eu.rb"
+                       (("\\$file = File.new.*")
+                        (string-append "$file = File.new(\"" target
+                                       "/hyph-eu.tex\",\"w\")\n")))
+                     (invoke "ruby" "generate_patterns_eu.rb"))
+                   #t)))
+             (add-after 'install 'install-hyph-eu.tex
+               (lambda* (#:key inputs outputs #:allow-other-keys)
+                 (let* ((out (assoc-ref outputs "out"))
+                        (target (string-append out "/share/texmf-dist/tex")))
+                   (copy-recursively "tex" target)
+                   #t)))))))
+      (synopsis "Hyphenation patterns for Basque")
+      (description "The package provides hyphenation patterns for the Basque
+language.")
+      ;; "Free for any purpose".
+      (license (license:fsf-free
+                "/source/generic/hyph-utf8/languages/eu/generate_patterns_eu.rb")))))
+
+(define-public texlive-hyphen-belarusian
+  (package
+    (inherit (texlive-hyphen-package
+              "texlive-hyphen-belarusian" "be"
+              (list "/tex/generic/hyph-utf8/patterns/tex/hyph-be.tex")
+              (base32
+               "1xvffph824rg43gi2xs3ny9gzlp708fyxj9zfhckmg8pzh9vv3n6")))
+    (synopsis "Hyphenation patterns for Belarusian")
+    (description "The package provides hyphenation patterns for the Belarusian
+language.")
+    (license license:expat)))
+
+
+(define-public texlive-hyph-utf8
+  (package
+    (inherit (simple-texlive-package
+              "texlive-hyph-utf8"
+              (list "/source/generic/hyph-utf8/"
+                    "/source/luatex/hyph-utf8/"
+                    "/doc/luatex/hyph-utf8/"
+                    "/tex/luatex/hyph-utf8/etex.src"
+                    ;; Used to extract luatex-hyphen.lua
+                    "/tex/latex/base/docstrip.tex"
+
+                    ;; Documentation; we can't use the whole directory because
+                    ;; it includes files from other packages.
+                    "/doc/generic/hyph-utf8/CHANGES"
+                    "/doc/generic/hyph-utf8/HISTORY"
+                    "/doc/generic/hyph-utf8/hyph-utf8.pdf"
+                    "/doc/generic/hyph-utf8/hyph-utf8.tex"
+                    "/doc/generic/hyph-utf8/hyphenation-distribution.pdf"
+                    "/doc/generic/hyph-utf8/hyphenation-distribution.tex"
+                    "/doc/generic/hyph-utf8/img/miktex-languages.png"
+                    "/doc/generic/hyph-utf8/img/texlive-collection.png")
+              (base32
+               "10y8svgk68sivmgzrv8gv137r7kv49cs256cq2wja9ms437pxvbj")))
+    (outputs '("out" "doc"))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f ; there are none
+       #:modules ((guix build gnu-build-system)
+                  (guix build utils)
+                  (ice-9 match))
+       #:make-flags
+       (list "-C" "source/luatex/hyph-utf8/"
+             (string-append "DO_TEX = tex --interaction=nonstopmode '&tex' $<")
+             (string-append "RUNDIR =" (assoc-ref %outputs "out") "/share/texmf-dist/tex/luatex/hyph-utf8/")
+             (string-append "DOCDIR =" (assoc-ref %outputs "doc") "/share/texmf-dist/doc/luatex/hyph-utf8/")
+             ;; hyphen.cfg is neither included nor generated, so let's only build the lua file.
+             (string-append "UNPACKED = $(NAME).lua"))
+       #:phases
+       (modify-phases %standard-phases
+         ;; TeX isn't usable at this point, so we first need to generate the
+         ;; tex.fmt.
+         (replace 'configure
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             ;; Target directories must exist.
+             (mkdir-p (string-append (assoc-ref %outputs "out")
+                                     "/share/texmf-dist/tex/luatex/hyph-utf8/"))
+             (mkdir-p (string-append (assoc-ref %outputs "doc")
+                                     "/share/texmf-dist/doc/luatex/hyph-utf8/"))
+
+             ;; We cannot build the documentation because that requires a
+             ;; fully functional pdflatex, which depends on this package.
+             (substitute* "source/luatex/hyph-utf8/Makefile"
+               (("all: .*") "all: $(RUNFILES)\n"))
+
+             ;; Find required fonts for building tex.fmt
+             (setenv "TFMFONTS"
+                     (string-append (assoc-ref inputs "texlive-fonts-cm")
+                                    "/share/texmf-dist/fonts/tfm/public/cm:"
+                                    (assoc-ref inputs "texlive-fonts-knuth-lib")
+                                    "/share/texmf-dist/fonts/tfm/public/knuth-lib"))
+             ;; ...and find all tex files in this environment.
+             (setenv "TEXINPUTS"
+                     (string-append
+                      (getcwd) ":"
+                      (string-join
+                       (map (match-lambda ((_ . dir) dir)) inputs)
+                       "//:")))
+
+             ;; Generate tex.fmt.
+             (let ((where "source/luatex/hyph-utf8"))
+               (mkdir-p where)
+               (with-directory-excursion where
+                 (invoke "tex" "-ini"
+                         (string-append (assoc-ref inputs "texlive-tex-plain")
+                                        "/share/texmf-dist/tex/plain/config/tex.ini"))))))
+         (add-before 'build 'build-loaders-and-converters
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((root (string-append (assoc-ref outputs "out")
+                                         "/share/texmf-dist"))
+                    (conv
+                     (string-append root
+                                    "/tex/generic/hyph-utf8/conversions")))
+
+               ;; Build converters
+               (mkdir-p conv)
+               (with-directory-excursion "source/generic/hyph-utf8"
+                 (substitute* "generate-converters.rb"
+                   (("\\$path_root=File.*")
+                    (string-append "$path_root=\"" root "\"\n"))
+                   ;; Avoid error with newer Ruby.
+                   (("#1\\{%") "#1{%%"))
+                 (invoke "ruby" "generate-converters.rb"))
+               #t)))
+         (replace 'install
+           (lambda* (#:key source outputs #:allow-other-keys)
+             (let ((doc (assoc-ref outputs "doc"))
+                   (out (assoc-ref outputs "out")))
+               (mkdir-p doc)
+               (copy-recursively
+                (string-append source "/doc")
+                (string-append doc "/doc"))
+               (install-file
+                (string-append source "/tex/luatex/hyph-utf8/etex.src")
+                (string-append out "/share/texmf-dist/tex/luatex/hyph-utf8/")))
+             #t)))))
+    (native-inputs
+     `(("ruby" ,ruby)
+       ("texlive-bin" ,texlive-bin)
+       ;; The following packages are needed for build "tex.fmt", which we need
+       ;; for a working "tex".
+       ("texlive-tex-plain" ,texlive-tex-plain)
+       ("texlive-fonts-cm" ,texlive-fonts-cm)
+       ("texlive-fonts-knuth-lib" ,texlive-fonts-knuth-lib)
+       ("texlive-hyphen-base" ,texlive-hyphen-base)))
+    (home-page "https://ctan.org/pkg/hyph-utf8")
+    (synopsis "Hyphenation patterns expressed in UTF-8")
+    (description "Modern native UTF-8 engines such as XeTeX and LuaTeX need
+hyphenation patterns in UTF-8 format, whereas older systems require
+hyphenation patterns in the 8-bit encoding of the font in use (such encodings
+are codified in the LaTeX scheme with names like OT1, T2A, TS1, OML, LY1,
+etc).  The present package offers a collection of conversions of existing
+patterns to UTF-8 format, together with converters for use with 8-bit fonts in
+older systems.  Since hyphenation patterns for Knuthian-style TeX systems are
+only read at iniTeX time, it is hoped that the UTF-8 patterns, with their
+converters, will completely supplant the older patterns.")
+    ;; Individual files each have their own license.  Most of these files are
+    ;; independent hyphenation patterns.
+    (license (list license:lppl1.0+
+                   license:lppl1.2+
+                   license:lppl1.3
+                   license:lppl1.3+
+                   license:lppl1.3a+
+                   license:lgpl2.1
+                   license:lgpl2.1+
+                   license:lgpl3+
+                   license:gpl2+
+                   license:gpl3+
+                   license:mpl1.1
+                   license:asl2.0
+                   license:expat
+                   license:bsd-3
+                   license:cc0
+                   license:public-domain
+                   license:wtfpl2))))
+
+(define-public texlive-generic-hyph-utf8
+  (deprecated-package "texlive-generic-hyph-utf8" texlive-hyph-utf8))
+
+(define-public texlive-dehyph-exptl
+  (package
+    (inherit (simple-texlive-package
+              "texlive-dehyph-exptl"
+              (list "/tex/generic/dehyph-exptl/"
+                    "/doc/generic/dehyph-exptl/")
+              (base32
+               "1w2danvvy2f52hcb4acvjks53kcanwxr9s990fap6mj279hpgmh2")
+              #:trivial? #t))
+    (propagated-inputs
+     `(("texlive-hyphen-base" ,texlive-hyphen-base)
+       ("texlive-hyph-utf8" ,texlive-hyph-utf8)))
+    (home-page "http://projekte.dante.de/Trennmuster/WebHome")
+    (synopsis "Hyphenation patterns for German")
+    (description "The package provides experimental hyphenation patterns for
+the German language, covering both traditional and reformed orthography.  The
+patterns can be used with packages Babel and hyphsubst from the Oberdiek
+bundle.")
+    ;; Hyphenation patterns are under the Expat license; documentation is
+    ;; under LPPL.
+    (license (list license:expat license:lppl))))
+
+(define-public texlive-generic-dehyph-exptl
+  (deprecated-package "texlive-generic-dehyph-exptl" texlive-dehyph-exptl))
+
 (define-public texlive-latex-base
   (let ((texlive-dir
          (lambda (dir hash)
@@ -2385,16 +2693,18 @@ standard LaTeX packages."
            #:builder
            (begin
              (use-modules (ice-9 match)
+                          (ice-9 popen)
                           (srfi srfi-26)
                           (guix build union)
                           (guix build utils)
                           (guix build texlive-build-system))
              (let* ((out       (assoc-ref %outputs "out"))
                     (texmf.cnf (string-append out "/share/texmf-dist/web2c/texmf.cnf")))
-               ;; Build a modifiable union of all inputs (but exclude bash)
+               ;; Build a modifiable union of all inputs (but exclude bash and
+               ;; the updmap.cfg file)
                (match (filter (match-lambda
                                 ((name . _)
-                                 (not (string=? "bash" name))))
+                                 (not (member name '("bash" "updmap.cfg")))))
                               %build-inputs)
                  (((names . directories) ...)
                   (union-build (assoc-ref %outputs "out")
@@ -2411,19 +2721,47 @@ standard LaTeX packages."
                   (string-append "TEXMFROOT = " out "/share\n"))
                  (("^TEXMF = .*")
                   "TEXMF = $TEXMFROOT/share/texmf-dist\n"))
-               (setenv "PATH" (string-append (assoc-ref %build-inputs "bash")
-                                             "/bin"))
+               (setenv "PATH" (string-append
+                               (assoc-ref %build-inputs "bash") "/bin:"
+                               (assoc-ref %build-inputs "coreutils") "/bin:"
+                               (string-append out "/bin")))
                (for-each
                 (cut wrap-program <>
                      `("TEXMFCNF" ":" suffix (,(dirname texmf.cnf)))
                      `("TEXMF"    ":" suffix (,(string-append out "/share/texmf-dist"))))
                 (find-files (string-append out "/bin") ".*"))
+
+               ;; Remove invalid maps from config file.
+               (let ((port (open-pipe* OPEN_WRITE "updmap-sys"
+                                       "--syncwithtrees"
+                                       "--nohash"
+                                       (assoc-ref %build-inputs "updmap.cfg"))))
+                 (display "Y\n" port)
+                 (when (not (zero? (status:exit-val (close-pipe port))))
+                   (error "failed to filter updmap.cfg")))
+               ;; Generate maps.
+               (invoke "updmap-sys" "--force"
+                       (string-append out "/share/texmf-config/web2c/updmap.cfg"))
                #t))))
         (inputs
          `(("bash" ,bash)
            ,@(map (lambda (package)
                     (list (package-name package) package))
                   (append default-packages packages))))
+        (native-inputs
+         `(("coreutils" ,coreutils)
+           ("sed" ,sed)
+           ("updmap.cfg"
+            ,(origin
+               (method url-fetch)
+               (uri (string-append "https://tug.org/svn/texlive/tags/"
+                                   %texlive-tag "/Master/texmf-dist/web2c/updmap.cfg"
+                                   "?revision=" (number->string %texlive-revision)))
+               (file-name (string-append "updmap.cfg-"
+                                         (number->string %texlive-revision)))
+               (sha256
+                (base32
+                 "06mwpy5i218g5k3sf4gba0fmxgas82hkzx9fhwn67z5ik37d8apq"))))))
         (home-page (package-home-page texlive-bin))
         (synopsis "Union of TeX Live packages")
         (description "This package provides a subset of the TeX Live
@@ -3416,8 +3754,8 @@ command.")
     (description
      "Identify areas of text to be marked with changebars with the
 @code{\\cbstart} and @code{\\cbend} commands; the bars may be coloured.  The
-package uses 'drivers' to place the bars; the available drivers can work with
-@code{dvitoln03}, @code{dvitops}, @code{dvips}, the emTeX and TeXtures DVI
+package uses @code{drivers} to place the bars; the available drivers can work
+with @code{dvitoln03}, @code{dvitops}, @code{dvips}, the emTeX and TeXtures DVI
 drivers, and VTeX and pdfTeX.")
     (license license:lppl)))
 
@@ -4906,13 +5244,13 @@ than the bitmaps Metafont creates.")
 (define-public texlive-latex-acmart
   (package
     (name "texlive-latex-acmart")
-    (version "1.45")
+    (version "1.60")
     (source (origin
               (method svn-fetch)
               (uri (texlive-ref "latex" "acmart"))
               (sha256
                (base32
-                "10zs8ga88ksypv1v4p6mynmfa7749q2hgxlr4shnwfjd9wrb421q"))
+                "0n62cs8dhcbn29y9ij1nnyigzr76yhk36kyahhqkkmvbafbys9s7"))
               (file-name (string-append name "-" version "-checkout"))))
     (build-system texlive-build-system)
     (arguments '(#:tex-directory "latex/acmart"))
@@ -6020,7 +6358,7 @@ typearea (which are the main parts of the bundle).")
            (copy-recursively (assoc-ref %build-inputs "source") target)
            #t))))
     (home-page "https://www.ctan.org/pkg/listofitems")
-    (synopsis "Grab items in lists using user-specified seperation character")
+    (synopsis "Grab items in lists using user-specified separation character")
     (description
      "This package allows one to capture all the items of a list, for which
 the parsing character has been selected by the user, and to access any of