+(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))
+