| 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 | |
| 21 | (define-module (gnu packages xfig) |
| 22 | #:use-module (guix packages) |
| 23 | #:use-module ((guix licenses) #:select (bsd-2)) |
| 24 | #:use-module (guix download) |
| 25 | #:use-module (guix build-system gnu) |
| 26 | #:use-module (gnu packages) |
| 27 | #:use-module (gnu packages freedesktop) |
| 28 | #:use-module (gnu packages xorg) |
| 29 | #:use-module (gnu packages image) |
| 30 | #:use-module (gnu packages compression)) |
| 31 | |
| 32 | (define-public xfig |
| 33 | (package |
| 34 | (name "xfig") |
| 35 | (version "3.2.7a") |
| 36 | (source |
| 37 | (origin |
| 38 | (method url-fetch) |
| 39 | (uri (string-append "mirror://sourceforge/mcj/" |
| 40 | name "-" version ".tar.xz")) |
| 41 | (sha256 |
| 42 | (base32 |
| 43 | "096zgp0bqnxhgxbrv2jjylrjz3pr4da0xxznlk2z7ffxr5pri2fa")))) |
| 44 | (build-system gnu-build-system) |
| 45 | (native-inputs |
| 46 | ;; For tests. |
| 47 | `(("desktop-file-utils" ,desktop-file-utils))) |
| 48 | (inputs |
| 49 | `(("libxaw3d" ,libxaw3d) |
| 50 | ("libjpeg" ,libjpeg-turbo) |
| 51 | ("libpng" ,libpng) |
| 52 | ("libxpm" ,libxpm) |
| 53 | ("libx11" ,libx11) |
| 54 | ("libxt" ,libxt))) |
| 55 | (arguments |
| 56 | `(#:phases |
| 57 | (modify-phases %standard-phases |
| 58 | (add-before 'install 'strip-bogus-exec-prefix |
| 59 | (lambda* (#:key outputs #:allow-other-keys) |
| 60 | (substitute* "xfig.desktop" |
| 61 | ;; The patch-dot-desktop-files phase requires a relative name. |
| 62 | (("Exec=/usr/bin/xfig") "Exec=xfig")) |
| 63 | #t))))) |
| 64 | (home-page "http://mcj.sourceforge.net/") |
| 65 | (synopsis "Interactive drawing tool") |
| 66 | (description |
| 67 | "Xfig is an interactive drawing tool which runs under X Window System. |
| 68 | In xfig, figures may be drawn using objects such as circles, boxes, lines, |
| 69 | spline curves, text, etc. It is also possible to import images in formats |
| 70 | such as GIF, JPEG, EPSF (PostScript), etc. Those objects can be created, |
| 71 | deleted, moved or modified. Attributes such as colors or line styles can be |
| 72 | selected in various ways. For text, 35 fonts are available.") |
| 73 | (license bsd-2))) |
| 74 | |
| 75 | (define-public transfig |
| 76 | (package |
| 77 | (name "transfig") |
| 78 | (version "3.2.5e") |
| 79 | (source |
| 80 | (origin |
| 81 | (method url-fetch) |
| 82 | (uri (string-append "mirror://sourceforge/mcj/mcj-source/transfig." |
| 83 | version ".tar.gz")) |
| 84 | (sha256 |
| 85 | (base32 |
| 86 | "0i3p7qmg2w8qrad3pn42b0miwarql7yy0gpd49b1bpal6bqsiicf")))) |
| 87 | (build-system gnu-build-system) |
| 88 | (native-inputs |
| 89 | `(("imake" ,imake) |
| 90 | ("makedepend" ,makedepend))) |
| 91 | (inputs |
| 92 | `(("xfig" ,xfig) |
| 93 | ("libjpeg" ,libjpeg-turbo) |
| 94 | ("libpng" ,libpng) |
| 95 | ("libxpm" ,libxpm) |
| 96 | ("libx11" ,libx11) |
| 97 | ("zlib" ,zlib))) |
| 98 | (arguments |
| 99 | `(#:tests? #f |
| 100 | #:phases |
| 101 | (modify-phases %standard-phases |
| 102 | (replace 'configure |
| 103 | (lambda* (#:key inputs outputs #:allow-other-keys) |
| 104 | (let ((imake (assoc-ref inputs "imake")) |
| 105 | (out (assoc-ref outputs "out"))) |
| 106 | (substitute* '("fig2dev/Imakefile" |
| 107 | "transfig/Imakefile") |
| 108 | (("XCOMM (BINDIR = )[[:graph:]]*" _ front) |
| 109 | (string-append front out "/bin")) |
| 110 | (("XCOMM USEINLINE") "USEINLINE") |
| 111 | ;; The variable name is deceptive. The directory is used as an |
| 112 | ;; installation path for bitmaps. |
| 113 | (("(XFIGLIBDIR =[[:blank:]]*)[[:graph:]]*" _ front) |
| 114 | (string-append front out "/lib")) |
| 115 | (("(XPMLIBDIR = )[[:graph:]]*" _ front) |
| 116 | (string-append front (assoc-ref inputs "libxpm") "/lib")) |
| 117 | (("(XPMINC = -I)[[:graph:]]*" _ front) |
| 118 | (string-append front (assoc-ref inputs "libxpm") "/include/X11")) |
| 119 | (("/usr/local/lib/fig2dev") (string-append out "/lib"))) |
| 120 | ;; The -a argument is required in order to pick up the correct paths |
| 121 | ;; to several X header files. |
| 122 | (invoke "xmkmf" "-a") |
| 123 | (substitute* '("Makefile" |
| 124 | "fig2dev/Makefile" |
| 125 | "transfig/Makefile") |
| 126 | ;; These imake variables somehow remain undefined |
| 127 | (("DefaultGcc2[[:graph:]]*Opt") "-O2") |
| 128 | ;; Reset a few variable defaults that are set in imake templates |
| 129 | ((imake) out) |
| 130 | (("(MANPATH = )[[:graph:]]*" _ front) |
| 131 | (string-append front out "/share/man")) |
| 132 | (("(CONFDIR = )([[:graph:]]*)" _ front default) |
| 133 | (string-append front out default))) |
| 134 | #t))) |
| 135 | (add-after 'install 'install/doc |
| 136 | (lambda _ |
| 137 | (invoke "make" "install.man")))))) |
| 138 | (home-page "http://mcj.sourceforge.net/") |
| 139 | (synopsis "Create portable LaTeX figures") |
| 140 | (description |
| 141 | "Transfig creates a makefile to translate figures described in Fig code |
| 142 | or PIC into a specified LaTeX graphics language. PIC files are identified by |
| 143 | the suffix \".pic\"; Fig files can be specified either with or without the |
| 144 | suffix \".fig\". Transfig also creates a TeX macro file appropriate to the |
| 145 | target language.") |
| 146 | (license bsd-2))) |