You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

136 lines
6.0 KiB

  1. ;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*-
  2. ;;; Copyright (C) 2012 Ludovic Courtès <ludo@gnu.org>
  3. ;;;
  4. ;;; This file is part of Guix.
  5. ;;;
  6. ;;; Guix is free software; you can redistribute it and/or modify it
  7. ;;; under the terms of the GNU General Public License as published by
  8. ;;; the Free Software Foundation; either version 3 of the License, or (at
  9. ;;; your option) any later version.
  10. ;;;
  11. ;;; Guix is distributed in the hope that it will be useful, but
  12. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. ;;; GNU General Public License for more details.
  15. ;;;
  16. ;;; You should have received a copy of the GNU General Public License
  17. ;;; along with Guix. If not, see <http://www.gnu.org/licenses/>.
  18. (define-module (distro packages typesetting)
  19. #:use-module (guix packages)
  20. #:use-module (guix http)
  21. #:use-module (guix utils)
  22. #:use-module (guix build-system gnu))
  23. ;;; Commentary:
  24. ;;;
  25. ;;; Typesetting-related packages.
  26. ;;;
  27. ;;; Code:
  28. (define-public lout
  29. ;; This one is a bit tricky, because it doesn't follow the GNU Build System
  30. ;; rules. Instead, it has a makefile that has to be patched to set the
  31. ;; prefix, etc., and it has no makefile rules to build its doc.
  32. (let ((configure-phase
  33. '(lambda* (#:key outputs #:allow-other-keys)
  34. (let ((out (assoc-ref outputs "out"))
  35. (doc (assoc-ref outputs "doc")))
  36. (substitute* "makefile"
  37. (("^PREFIX[[:blank:]]*=.*$")
  38. (string-append "PREFIX = " out "\n"))
  39. (("^LOUTLIBDIR[[:blank:]]*=.*$")
  40. (string-append "LOUTLIBDIR = " out "/lib/lout\n"))
  41. (("^LOUTDOCDIR[[:blank:]]*=.*$")
  42. (string-append "LOUTDOCDIR = " doc "/doc/lout\n"))
  43. (("^MANDIR[[:blank:]]*=.*$")
  44. (string-append "MANDIR = " out "/man\n")))
  45. (mkdir out)
  46. (mkdir (string-append out "/bin"))
  47. (mkdir (string-append out "/lib"))
  48. (mkdir (string-append out "/man"))
  49. (mkdir-p (string-append doc "/doc/lout")))))
  50. (install-man-phase
  51. '(lambda* (#:key outputs #:allow-other-keys)
  52. (zero? (system* "make" "installman"))))
  53. (doc-phase
  54. '(lambda* (#:key outputs #:allow-other-keys)
  55. (define out
  56. (assoc-ref outputs "doc"))
  57. (setenv "PATH"
  58. (string-append (assoc-ref outputs "out")
  59. "/bin:" (getenv "PATH")))
  60. (chdir "doc")
  61. (every (lambda (doc)
  62. (format #t "doc: building `~a'...~%" doc)
  63. (with-directory-excursion doc
  64. (let ((file (string-append out "/doc/lout/"
  65. doc ".ps")))
  66. (and (or (file-exists? "outfile.ps")
  67. (zero? (system* "lout" "-r4" "-o"
  68. "outfile.ps" "all")))
  69. (begin
  70. (copy-file "outfile.ps" file)
  71. #t)
  72. (zero? (system* "ps2pdf"
  73. "-dPDFSETTINGS=/prepress"
  74. "-sPAPERSIZE=a4"
  75. file
  76. (string-append out "/doc/lout/"
  77. doc ".pdf")))))))
  78. '("design" "expert" "slides" "user")))))
  79. (package
  80. (name "lout")
  81. (version "3.39")
  82. (source (origin
  83. (method http-fetch)
  84. ;; FIXME: `http-get' doesn't follow redirects, hence the URL.
  85. (uri (string-append
  86. "http://download-mirror.savannah.gnu.org/releases/lout/lout-"
  87. version ".tar.gz"))
  88. (sha256
  89. (base32
  90. "12gkyqrn0kaa8xq7sc7v3wm407pz2fxg9ngc75aybhi5z825b9vq"))))
  91. (build-system gnu-build-system) ; actually, just a makefile
  92. (outputs '("out" "doc"))
  93. (inputs `(("ghostscript" ,(nixpkgs-derivation "ghostscript"))))
  94. (arguments `(#:modules ((guix build utils)
  95. (guix build gnu-build-system)
  96. (srfi srfi-1)) ; we need SRFI-1
  97. #:tests? #f ; no "check" target
  98. ;; Customize the build phases.
  99. #:phases (alist-replace
  100. 'configure ,configure-phase
  101. (alist-cons-after
  102. 'install 'install-man-pages
  103. ,install-man-phase
  104. (alist-cons-after
  105. 'install 'install-doc
  106. ,doc-phase
  107. %standard-phases)))))
  108. (description "Lout, a document layout system similar in style to LaTeX")
  109. (long-description
  110. "The Lout document formatting system is now reads a high-level description of
  111. a document similar in style to LaTeX and produces a PostScript or plain text
  112. output file.
  113. Lout offers an unprecedented range of advanced features, including optimal
  114. paragraph and page breaking, automatic hyphenation, PostScript EPS file
  115. inclusion and generation, equation formatting, tables, diagrams, rotation and
  116. scaling, sorted indexes, bibliographic databases, running headers and
  117. odd-even pages, automatic cross referencing, multilingual documents including
  118. hyphenation (most European languages are supported), formatting of computer
  119. programs, and much more, all ready to use. Furthermore, Lout is easily
  120. extended with definitions which are very much easier to write than troff of
  121. TeX macros because Lout is a high-level, purely functional language, the
  122. outcome of an eight-year research project that went back to the
  123. beginning.")
  124. (license "GPLv3+")
  125. (home-page "http://savannah.nongnu.org/projects/lout/"))))
  126. ;;; typesetting.scm ends here