gnu: texlive: Make the package structure more modular.

* gnu/packages/texlive.scm (texlive-bin, texlive-texmf): New variables.
  The first one contains the binaries; the second one the texmf tree.
  (texlive): Drop output "data". Create the output "out" as the union
  of the suitable subdirectories of texlive-bin and texlive-texmf, and
  wrap the binaries, setting TEXMFCNF to the value corresponding to
  texlive-texmf.
This commit is contained in:
Andreas Enge 2015-03-14 22:42:41 +01:00
parent 576d38c846
commit 0aa34e820c
1 changed files with 166 additions and 82 deletions

View File

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014 Andreas Enge <andreas@enge.fr> ;;; Copyright © 2013, 2014, 2015 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org> ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org> ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
;;; ;;;
@ -23,7 +23,9 @@
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (guix download) #:use-module (guix download)
#:use-module (guix build-system gnu) #:use-module (guix build-system gnu)
#:use-module (guix build-system trivial)
#:use-module (gnu packages) #:use-module (gnu packages)
#:use-module (gnu packages bash)
#:use-module (gnu packages compression) #:use-module (gnu packages compression)
#:use-module (gnu packages fontutils) #:use-module (gnu packages fontutils)
#:use-module (gnu packages gd) #:use-module (gnu packages gd)
@ -31,6 +33,7 @@
#:use-module (gnu packages gtk) #:use-module (gnu packages gtk)
#:use-module (gnu packages icu4c) #:use-module (gnu packages icu4c)
#:use-module (gnu packages image) #:use-module (gnu packages image)
#:use-module (gnu packages lua)
#:use-module (gnu packages pdf) #:use-module (gnu packages pdf)
#:use-module (gnu packages perl) #:use-module (gnu packages perl)
#:use-module (gnu packages pkg-config) #:use-module (gnu packages pkg-config)
@ -57,18 +60,19 @@
(sha256 (base32 (sha256 (base32
"0qsr55ms1278dhmgixs5qqwd4fxhh369ihkki6wgh8xaqm8p48p0")))) "0qsr55ms1278dhmgixs5qqwd4fxhh369ihkki6wgh8xaqm8p48p0"))))
(define-public texlive (define-public texlive-bin
(package (package
(name "texlive") (name "texlive-bin")
(version "2014") (version "2014")
(source (origin (source
(origin
(method url-fetch) (method url-fetch)
(uri "ftp://tug.org/historic/systems/texlive/2014/texlive-20140525-source.tar.xz") (uri "ftp://tug.org/historic/systems/texlive/2014/texlive-20140525-source.tar.xz")
(sha256 (base32 (sha256 (base32
"1glmaw2jv42grbsn05kay825j66scimjqqc32776bb1356q4xfq8")))) "1glmaw2jv42grbsn05kay825j66scimjqqc32776bb1356q4xfq8"))))
(build-system gnu-build-system) (build-system gnu-build-system)
(inputs `(("texlive-extra-src" ,texlive-extra-src) (inputs
("texlive-texmf-src" ,texlive-texmf-src) `(("texlive-extra-src" ,texlive-extra-src)
("cairo" ,cairo) ("cairo" ,cairo)
("fontconfig" ,fontconfig) ("fontconfig" ,fontconfig)
("fontforge" ,fontforge) ("fontforge" ,fontforge)
@ -94,17 +98,10 @@
("zziplib" ,zziplib))) ("zziplib" ,zziplib)))
(native-inputs (native-inputs
`(("pkg-config" ,pkg-config))) `(("pkg-config" ,pkg-config)))
(outputs '("out" "data"))
(arguments (arguments
`(#:out-of-source? #t `(#:out-of-source? #t
#:configure-flags #:configure-flags
`("--disable-native-texlive-build" `("--disable-native-texlive-build"
;; Although the texmf-dist data is taken from texlive-texmf,
;; setting datarootdir is still useful:
;; "make install" creates symbolic links to scripts in this place.
,(string-append "--datarootdir=" (assoc-ref %outputs "data"))
,(string-append "--infodir=" (assoc-ref %outputs "out") "/share/info")
,(string-append "--mandir=" (assoc-ref %outputs "out") "/share/man")
"--with-system-cairo" "--with-system-cairo"
"--with-system-freetype2" "--with-system-freetype2"
"--with-system-gd" "--with-system-gd"
@ -130,10 +127,9 @@
(alist-cons-after (alist-cons-after
'install 'postinst 'install 'postinst
(lambda* (#:key inputs outputs #:allow-other-keys #:rest args) (lambda* (#:key inputs outputs #:allow-other-keys #:rest args)
(let ((texlive-extra (assoc-ref inputs "texlive-extra-src")) (let* ((out (assoc-ref outputs "out"))
(texlive-texmf (assoc-ref inputs "texlive-texmf-src")) (share (string-append out "/share"))
(out (assoc-ref outputs "out")) (texlive-extra (assoc-ref inputs "texlive-extra-src"))
(data (assoc-ref outputs "data"))
(unpack (assoc-ref %standard-phases 'unpack)) (unpack (assoc-ref %standard-phases 'unpack))
(patch-source-shebangs (patch-source-shebangs
(assoc-ref %standard-phases 'patch-source-shebangs))) (assoc-ref %standard-phases 'patch-source-shebangs)))
@ -143,51 +139,139 @@
(for-each symlink (for-each symlink
'("pdftex" "pdftex" "xetex" "luatex") '("pdftex" "pdftex" "xetex" "luatex")
'("latex" "pdflatex" "xelatex" "lualatex"))) '("latex" "pdflatex" "xelatex" "lualatex")))
(with-directory-excursion (string-append out "/share/man/man1/") (with-directory-excursion (string-append share "/man/man1/")
(symlink "luatex.1" "lualatex.1")) (symlink "luatex.1" "lualatex.1"))
;; Delete texmf-dist from "data", since it will be reinstalled
;; from texlive-texmf.
(system* "rm" "-r" (string-append data "/texmf-dist"))
;; Unpack texlive-extra and install tlpkg. ;; Unpack texlive-extra and install tlpkg.
(mkdir "texlive-extra") (mkdir "texlive-extra")
(with-directory-excursion "texlive-extra" (with-directory-excursion "texlive-extra"
(apply unpack (list #:source texlive-extra)) (apply unpack (list #:source texlive-extra))
(apply patch-source-shebangs (list #:source texlive-extra)) (apply patch-source-shebangs (list #:source texlive-extra))
(system* "mv" "tlpkg" data) (system* "mv" "tlpkg" share))))
(chdir "..")) %standard-phases)))
;; Unpack and install texlive-texmf. (synopsis "TeX Live, a package of the TeX typesetting system")
(mkdir "texlive-texmf")
(with-directory-excursion "texlive-texmf"
(apply unpack (list #:source texlive-texmf))
(apply patch-source-shebangs (list #:source texlive-texmf))
;; Register "data" for kpathsea in texmf.cnf.
(substitute* "texmf-dist/web2c/texmf.cnf"
(("TEXMFROOT = \\$SELFAUTOPARENT")
(string-append "TEXMFROOT = " data)))
(system* "mv" "texmf-dist" data)
(chdir ".."))
;; texmf.cnf must also be placed in "out", since kpsewhich does
;; not know about "data" until it has found this file.
(mkdir (string-append out "/share/texmf-dist"))
(mkdir (string-append out "/share/texmf-dist/web2c"))
(copy-file (string-append data "/texmf-dist/web2c/texmf.cnf")
(string-append out "/share/texmf-dist/web2c/texmf.cnf"))))
(alist-cons-after 'patch-shebangs 'texconfig
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
;; Configure the texlive system; inspired from
;; http://slackbuilds.org/repository/13.37/office/texlive/
(setenv "PATH" (string-append (getenv "PATH") ":" out "/bin"))
(system* "updmap-sys" "--nohash" "--syncwithtrees")
(system* "mktexlsr")
(system* "fmtutil-sys" "--all")))
%standard-phases))))
(synopsis "Tex Live, a package of the TeX typesetting system")
(description (description
"TeX Live provides a comprehensive TeX document production system. "TeX Live provides a comprehensive TeX document production system.
It includes all the major TeX-related programs, macro packages, and fonts It includes all the major TeX-related programs, macro packages, and fonts
that are free software, including support for many languages around the that are free software, including support for many languages around the
world.") world.
This package contains the binaries.")
(license (license:fsf-free "http://tug.org/texlive/copying.html"))
(home-page "http://www.tug.org/texlive/")))
(define-public texlive-texmf
(package
(name "texlive-texmf")
(version "2014")
(source texlive-texmf-src)
(build-system gnu-build-system)
(inputs
`(("texlive-bin" ,texlive-bin)
("lua" ,lua)
("perl" ,perl)
("python" ,python-2) ; incompatible with Python 3 (print syntax)
("ruby" ,ruby)
("tcsh" ,tcsh)))
(arguments
`(#:modules ((guix build gnu-build-system)
(guix build utils)
(srfi srfi-26))
#:imported-modules ((guix build gnu-build-system)
(guix build utils))
#:phases
(alist-cons-before
'texmf-config 'install
(lambda* (#:key outputs #:allow-other-keys)
(let ((share (string-append (assoc-ref outputs "out") "/share")))
(mkdir-p share)
(system* "mv" "texmf-dist" share)))
(alist-cons-after
'patch-source-shebangs 'texmf-config
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((share (string-append (assoc-ref outputs "out") "/share"))
(texmfroot (string-append share "/texmf-dist/web2c"))
(texmfcnf (string-append texmfroot "/texmf.cnf"))
(texbin (string-append (assoc-ref inputs "texlive-bin")
"/bin")))
;; Register SHARE as TEXMFROOT in texmf.cnf.
(substitute* texmfcnf
(("TEXMFROOT = \\$SELFAUTOPARENT")
(string-append "TEXMFROOT = " share)))
;; Configure the texmf-dist tree; inspired from
;; http://slackbuilds.org/repository/13.37/office/texlive/
(setenv "PATH" (string-append (getenv "PATH") ":" texbin))
(setenv "TEXMFCNF" texmfroot)
(system* "updmap-sys" "--nohash" "--syncwithtrees")
(system* "mktexlsr")
(system* "fmtutil-sys" "--all")))
(map (cut assq <> %standard-phases)
'(set-paths unpack patch-source-shebangs))))))
(synopsis "TeX Live, a package of the TeX typesetting system")
(description
"TeX Live provides a comprehensive TeX document production system.
It includes all the major TeX-related programs, macro packages, and fonts
that are free software, including support for many languages around the
world.
This package contains the complete tree of texmf-dist data.")
(license (license:fsf-free "http://tug.org/texlive/copying.html"))
(home-page "http://www.tug.org/texlive/")))
(define-public texlive
(package
(name "texlive")
(version "2014")
(source #f)
(build-system trivial-build-system)
(inputs `(("bash" ,bash) ; for wrap-program
("texlive-bin" ,texlive-bin)
("texlive-texmf" ,texlive-texmf)))
(arguments
`(#:modules ((guix build utils))
#:builder
;; Build the union of texlive-bin and texlive-texmf, but take the
;; conflicting subdirectory share/texmf-dist from texlive-texmf.
(begin
(use-modules (guix build utils))
(let ((out (assoc-ref %outputs "out"))
(bin (assoc-ref %build-inputs "texlive-bin"))
(texmf (assoc-ref %build-inputs "texlive-texmf"))
(bash (assoc-ref %build-inputs "bash")))
(mkdir out)
(with-directory-excursion out
(for-each
(lambda (name)
(symlink (string-append bin "/" name) name))
'("include" "lib"))
(mkdir "bin")
(with-directory-excursion "bin"
(setenv "PATH" (string-append bash "/bin"))
(for-each
(lambda (name)
(symlink name (basename name))
(wrap-program
(basename name)
`("TEXMFCNF" =
(,(string-append texmf "/share/texmf-dist/web2c")))))
(find-files (string-append bin "/bin/") "")))
(mkdir "share")
(with-directory-excursion "share"
(for-each
(lambda (name)
(symlink (string-append bin "/share/" name) name))
'("info" "man" "tlpkg"))
(for-each
(lambda (name)
(symlink (string-append texmf "/share/" name) name))
'("texmf-dist" "texmf-var"))))))))
(synopsis "TeX Live, a package of the TeX typesetting system")
(description
"TeX Live provides a comprehensive TeX document production system.
It includes all the major TeX-related programs, macro packages, and fonts
that are free software, including support for many languages around the
world.
This package contains the complete TeX Live distribution.")
(license (license:fsf-free "http://tug.org/texlive/copying.html")) (license (license:fsf-free "http://tug.org/texlive/copying.html"))
(home-page "http://www.tug.org/texlive/"))) (home-page "http://www.tug.org/texlive/")))