[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
07/111: gnu: Add texlive-hyphen-package.
From: |
guix-commits |
Subject: |
07/111: gnu: Add texlive-hyphen-package. |
Date: |
Tue, 16 Jul 2019 09:20:46 -0400 (EDT) |
rekado pushed a commit to branch wip-texlive
in repository guix.
commit e47dedbc5991e29b02ad2ac1697d4b113b89fd42
Author: Ricardo Wurmus <address@hidden>
Date: Sat Jul 13 23:56:35 2019 +0200
gnu: Add texlive-hyphen-package.
* gnu/packages/tex.scm (texlive-hyphen-package): New procedure.
---
gnu/packages/tex.scm | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 79 insertions(+)
diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index f56f427..bc89709 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -144,6 +144,85 @@ copied to their outputs; otherwise the
TEXLIVE-BUILD-SYSTEM is used."
(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)
- 09/111: gnu: Add texlive-hyphen-base., (continued)
- 09/111: gnu: Add texlive-hyphen-base., guix-commits, 2019/07/16
- 11/111: gnu: Add texlive-dehyph-exptl., guix-commits, 2019/07/16
- 13/111: gnu: texlive-fonts-cm: Remove cm-type1., guix-commits, 2019/07/16
- 03/111: guix: Add svn-multi-reference., guix-commits, 2019/07/16
- 08/111: gnu: Add texlive-unicode-data., guix-commits, 2019/07/16
- 12/111: gnu: texlive-dvips: Implement with simple-texlive-package., guix-commits, 2019/07/16
- 16/111: gnu: Add texlive-hyphen-afrikaans., guix-commits, 2019/07/16
- 10/111: gnu: Add texlive-hyph-utf8., guix-commits, 2019/07/16
- 19/111: gnu: Add texlive-hyphen-basque., guix-commits, 2019/07/16
- 15/111: gnu: Add texlive-tex-ini-files., guix-commits, 2019/07/16
- 07/111: gnu: Add texlive-hyphen-package.,
guix-commits <=
- 14/111: gnu: texlive-fonts-cm: Use simple-texlive-package., guix-commits, 2019/07/16
- 20/111: gnu: Add texlive-mkpattern., guix-commits, 2019/07/16
- 22/111: gnu: Add texlive-hyphen-bulgarian., guix-commits, 2019/07/16
- 18/111: gnu: Add texlive-hyphen-armenian., guix-commits, 2019/07/16
- 21/111: gnu: Add texlive-hyphen-belarusian., guix-commits, 2019/07/16
- 17/111: gnu: Add texlive-hyphen-ancientgreek., guix-commits, 2019/07/16
- 30/111: gnu: Add texlive-hyphen-dutch., guix-commits, 2019/07/16
- 25/111: gnu: Add texlive-hyphen-churchslavonic., guix-commits, 2019/07/16
- 31/111: gnu: Add texlive-hyphen-english., guix-commits, 2019/07/16
- 23/111: gnu: Add texlive-hyphen-catalan., guix-commits, 2019/07/16