xfig.scm 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
  3. ;;; Copyright © 2014 Federico Beffa <beffa@fbengineering.ch>
  4. ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
  5. ;;;
  6. ;;; This file is part of GNU Guix.
  7. ;;;
  8. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  9. ;;; under the terms of the GNU General Public License as published by
  10. ;;; the Free Software Foundation; either version 3 of the License, or (at
  11. ;;; your option) any later version.
  12. ;;;
  13. ;;; GNU Guix is distributed in the hope that it will be useful, but
  14. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. ;;; GNU General Public License for more details.
  17. ;;;
  18. ;;; You should have received a copy of the GNU General Public License
  19. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  20. (define-module (gnu packages xfig)
  21. #:use-module (guix packages)
  22. #:use-module ((guix licenses) #:select (bsd-2))
  23. #:use-module (guix download)
  24. #:use-module (guix build-system gnu)
  25. #:use-module (gnu packages)
  26. #:use-module (gnu packages freedesktop)
  27. #:use-module (gnu packages xorg)
  28. #:use-module (gnu packages image)
  29. #:use-module (gnu packages compression))
  30. (define-public xfig
  31. (package
  32. (name "xfig")
  33. (version "3.2.7a")
  34. (source
  35. (origin
  36. (method url-fetch)
  37. (uri (string-append "mirror://sourceforge/mcj/"
  38. name "-" version ".tar.xz"))
  39. (sha256
  40. (base32
  41. "096zgp0bqnxhgxbrv2jjylrjz3pr4da0xxznlk2z7ffxr5pri2fa"))))
  42. (build-system gnu-build-system)
  43. (native-inputs
  44. ;; For tests.
  45. `(("desktop-file-utils" ,desktop-file-utils)))
  46. (inputs
  47. `(("libxaw3d" ,libxaw3d)
  48. ("libjpeg" ,libjpeg-turbo)
  49. ("libpng" ,libpng)
  50. ("libxpm" ,libxpm)
  51. ("libx11" ,libx11)
  52. ("libxt" ,libxt)))
  53. (arguments
  54. `(#:phases
  55. (modify-phases %standard-phases
  56. (add-before 'install 'strip-bogus-exec-prefix
  57. (lambda* (#:key outputs #:allow-other-keys)
  58. (substitute* "xfig.desktop"
  59. ;; The patch-dot-desktop-files phase requires a relative name.
  60. (("Exec=/usr/bin/xfig") "Exec=xfig"))
  61. #t)))))
  62. (home-page "http://mcj.sourceforge.net/")
  63. (synopsis "Interactive drawing tool")
  64. (description
  65. "Xfig is an interactive drawing tool which runs under X Window System.
  66. In xfig, figures may be drawn using objects such as circles, boxes, lines,
  67. spline curves, text, etc. It is also possible to import images in formats
  68. such as GIF, JPEG, EPSF (PostScript), etc. Those objects can be created,
  69. deleted, moved or modified. Attributes such as colors or line styles can be
  70. selected in various ways. For text, 35 fonts are available.")
  71. (license bsd-2)))
  72. (define-public transfig
  73. (package
  74. (name "transfig")
  75. (version "3.2.5e")
  76. (source
  77. (origin
  78. (method url-fetch)
  79. (uri (string-append "mirror://sourceforge/mcj/mcj-source/transfig."
  80. version ".tar.gz"))
  81. (sha256
  82. (base32
  83. "0i3p7qmg2w8qrad3pn42b0miwarql7yy0gpd49b1bpal6bqsiicf"))))
  84. (build-system gnu-build-system)
  85. (native-inputs
  86. `(("imake" ,imake)
  87. ("makedepend" ,makedepend)))
  88. (inputs
  89. `(("xfig" ,xfig)
  90. ("libjpeg" ,libjpeg-turbo)
  91. ("libpng" ,libpng)
  92. ("libxpm" ,libxpm)
  93. ("libx11" ,libx11)
  94. ("zlib" ,zlib)))
  95. (arguments
  96. `(#:tests? #f
  97. #:phases
  98. (modify-phases %standard-phases
  99. (replace 'configure
  100. (lambda* (#:key inputs outputs #:allow-other-keys)
  101. (let ((imake (assoc-ref inputs "imake"))
  102. (out (assoc-ref outputs "out")))
  103. (substitute* '("fig2dev/Imakefile"
  104. "transfig/Imakefile")
  105. (("XCOMM (BINDIR = )[[:graph:]]*" _ front)
  106. (string-append front out "/bin"))
  107. (("XCOMM USEINLINE") "USEINLINE")
  108. ;; The variable name is deceptive. The directory is used as an
  109. ;; installation path for bitmaps.
  110. (("(XFIGLIBDIR =[[:blank:]]*)[[:graph:]]*" _ front)
  111. (string-append front out "/lib"))
  112. (("(XPMLIBDIR = )[[:graph:]]*" _ front)
  113. (string-append front (assoc-ref inputs "libxpm") "/lib"))
  114. (("(XPMINC = -I)[[:graph:]]*" _ front)
  115. (string-append front (assoc-ref inputs "libxpm") "/include/X11"))
  116. (("/usr/local/lib/fig2dev") (string-append out "/lib")))
  117. ;; The -a argument is required in order to pick up the correct paths
  118. ;; to several X header files.
  119. (invoke "xmkmf" "-a")
  120. (substitute* '("Makefile"
  121. "fig2dev/Makefile"
  122. "transfig/Makefile")
  123. ;; These imake variables somehow remain undefined
  124. (("DefaultGcc2[[:graph:]]*Opt") "-O2")
  125. ;; Reset a few variable defaults that are set in imake templates
  126. ((imake) out)
  127. (("(MANPATH = )[[:graph:]]*" _ front)
  128. (string-append front out "/share/man"))
  129. (("(CONFDIR = )([[:graph:]]*)" _ front default)
  130. (string-append front out default)))
  131. #t)))
  132. (add-after 'install 'install/doc
  133. (lambda _
  134. (invoke "make" "install.man"))))))
  135. (home-page "http://mcj.sourceforge.net/")
  136. (synopsis "Create portable LaTeX figures")
  137. (description
  138. "Transfig creates a makefile to translate figures described in Fig code
  139. or PIC into a specified LaTeX graphics language. PIC files are identified by
  140. the suffix \".pic\"; Fig files can be specified either with or without the
  141. suffix \".fig\". Transfig also creates a TeX macro file appropriate to the
  142. target language.")
  143. (license bsd-2)))