Subject: [PATCH 09/35] gnu: Add texlive-fonts-cm.

From: Ricardo Wurmus <[email-masked]>
Date: Fri, 9 Jun 2017 12:45:33 +0200

* gnu/packages/tex.scm (texlive-fonts-cm): New variable.
---
 gnu/packages/tex.scm | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index 5a92b3ed1..201e0da78 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -432,6 +432,91 @@ converters, will completely supplant the older patterns.")
 build fonts using the Metafont system.")
     (license license:knuth)))
 
+(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)))
+              (sha256
+               (base32
+                "045k5b9rdmbxpy1a3006l1x96z1rd18vg3cwrvnld9bqybw5qz44"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:modules ((guix build gnu-build-system)
+                  (guix build utils)
+                  (srfi srfi-1)
+                  (srfi srfi-26))
+       #:tests? #f ; no tests
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (replace 'build
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((mf (assoc-ref inputs "texlive-metafont-base")))
+               ;; Tell mf where to find mf.base
+               (setenv "MFBASES" (string-append mf "/share/texmf-dist/web2c"))
+               ;; Tell mf where to look for source files
+               (setenv "MFINPUTS"
+                       (string-append (getcwd) ":"
+                                      mf "/share/texmf-dist/metafont/base")))
+             (mkdir "build")
+             (every (lambda (font)
+                      (format #t "building font ~a\n" font)
+                      (zero? (system* "mf" "-progname=mf"
+                                      "-output-directory=build"
+                                      (string-append "\\"
+                                                     "mode:=ljfour; "
+                                                     "mag:=1; "
+                                                     "batchmode; "
+                                                     "input " font))))
+                    '("cmb10" "cmbcsc10" "cmbsy10" "cmbtex10"
+                      "cmbtt8" "cmbtt9" "cmbtt10"
+                      "cmbx5" "cmbx6" "cmbx7" "cmbx8" "cmbx9" "cmbx10" "cmbx12"
+                      "cmbxsl10" "cmbxti10" "cmcsc10" "cmdunh10"
+                      "cmex10" "cmexb10" "cmff10" "cmfi10" "cmfib8"
+                      "cminch"
+                      "cmmi5" "cmmi6" "cmmi7" "cmmi8" "cmmi9" "cmmi10" "cmmi12"
+                      "cmmib10" "cmitt10"
+                      "cmr5" "cmr6" "cmr7" "cmr8" "cmr9" "cmr10" "cmr12" "cmr17"
+                      "cmsl8" "cmsl9" "cmsl10" "cmsl12" "cmsltt10"
+                      "cmss8" "cmss9" "cmss10" "cmss12" "cmss17"
+                      "cmssbx10" "cmssdc10"
+                      "cmssi8" "cmssi9" "cmssi10" "cmssi12" "cmssi17"
+                      "cmssq8" "cmssqi8"
+                      "cmsy5" "cmsy6" "cmsy7" "cmsy8" "cmsy9" "cmsy10"
+                      "cmtcsc10" "cmtex8" "cmtex9" "cmtex10"
+                      "cmti7" "cmti8" "cmti9" "cmti10" "cmti12"
+                      "cmtt8" "cmtt9" "cmtt10" "cmtt12"
+                      "cmttb10" "cmu10" "cmvtt10"))))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (tfm (string-append
+                          out "/share/texmf-dist/fonts/tfm/public/cm"))
+                    (mf  (string-append
+                          out "/share/texmf-dist/fonts/source/public/cm")))
+               (for-each (cut install-file <> tfm)
+                         (find-files "build" "\\.*"))
+               (for-each (cut install-file <> mf)
+                         (find-files "." "\\.mf"))
+               #t))))))
+    (native-inputs
+     `(("texlive-bin" ,texlive-bin)
+       ("texlive-metafont-base" ,texlive-metafont-base)))
+    (home-page "http://www.ctan.org/pkg/cm")
+    (synopsis "Computer Modern fonts for TeX")
+    (description "This package provides the Computer Modern fonts by Donald
+Knuth.  The Computer Modern font family is a large collection of text,
+display, and mathematical fonts in a range of styles, based on Monotype Modern
+8A.")
+    (license license:knuth)))
+
 (define texlive-texmf
   (package
    (name "texlive-texmf")
-- 
2.12.2