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 ;;; Copyright © 2021 Efraim Flashner <efraim@flashner.co.il>
6 ;;; Copyright © 2022 Ivan Vilata i Balaguer <ivan@selidor.net>
8 ;;; This file is part of GNU Guix.
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23 (define-module (gnu packages xfig)
24 #:use-module (guix packages)
25 #:use-module ((guix licenses) #:select (bsd-2))
26 #:use-module (guix download)
27 #:use-module (guix build-system gnu)
28 #:use-module (gnu packages)
29 #:use-module (gnu packages freedesktop)
30 #:use-module (gnu packages ghostscript)
31 #:use-module (gnu packages xorg)
32 #:use-module (gnu packages image)
33 #:use-module (gnu packages compression))
42 (uri (string-append "mirror://sourceforge/mcj/"
43 name "-" version ".tar.xz"))
46 "0fndgbm1mkqb1sn2v2kj3nx9mxj70jbp31y2bjvzcmmkry0q3k5j"))))
47 (build-system gnu-build-system)
50 (list desktop-file-utils ghostscript))
52 `(("libxaw3d" ,libxaw3d)
53 ("libjpeg" ,libjpeg-turbo)
60 (modify-phases %standard-phases
61 (add-before 'install 'strip-bogus-exec-prefix
62 (lambda* (#:key outputs #:allow-other-keys)
63 (substitute* "xfig.desktop"
64 ;; The patch-dot-desktop-files phase requires a relative name.
65 (("Exec=/usr/bin/xfig") "Exec=xfig"))
67 (home-page "http://mcj.sourceforge.net/")
68 (synopsis "Interactive drawing tool")
70 "Xfig is an interactive drawing tool which runs under X Window System.
71 In xfig, figures may be drawn using objects such as circles, boxes, lines,
72 spline curves, text, etc. It is also possible to import images in formats
73 such as GIF, JPEG, EPSF (PostScript), etc. Those objects can be created,
74 deleted, moved or modified. Attributes such as colors or line styles can be
75 selected in various ways. For text, 35 fonts are available.")
78 (define-public transfig
85 (uri (string-append "mirror://sourceforge/mcj/mcj-source/transfig."
89 "0i3p7qmg2w8qrad3pn42b0miwarql7yy0gpd49b1bpal6bqsiicf"))
92 "transfig-gcc10-fno-common.patch")))) ; fix GCC10 build
93 (build-system gnu-build-system)
95 (list imake makedepend))
98 ("libjpeg" ,libjpeg-turbo)
106 (modify-phases %standard-phases
108 (lambda* (#:key inputs outputs #:allow-other-keys)
109 (let ((imake (assoc-ref inputs "imake"))
110 (out (assoc-ref outputs "out")))
111 (substitute* '("fig2dev/Imakefile"
112 "transfig/Imakefile")
113 (("XCOMM (BINDIR = )[[:graph:]]*" _ front)
114 (string-append front out "/bin"))
115 (("XCOMM USEINLINE") "USEINLINE")
116 ;; The variable name is deceptive. The directory is used as an
117 ;; installation path for bitmaps.
118 (("(XFIGLIBDIR =[[:blank:]]*)[[:graph:]]*" _ front)
119 (string-append front out "/lib"))
120 (("(XPMLIBDIR = )[[:graph:]]*" _ front)
121 (string-append front (assoc-ref inputs "libxpm") "/lib"))
122 (("(XPMINC = -I)[[:graph:]]*" _ front)
123 (string-append front (assoc-ref inputs "libxpm") "/include/X11"))
124 (("/usr/local/lib/fig2dev") (string-append out "/lib")))
125 ;; The -a argument is required in order to pick up the correct paths
126 ;; to several X header files.
127 (invoke "xmkmf" "-a")
128 (substitute* '("Makefile"
130 "fig2dev/dev/Makefile"
132 ;; These imake variables somehow remain undefined
133 (("DefaultGcc2[[:graph:]]*Opt") "-O2")
134 ;; Reset a few variable defaults that are set in imake templates
136 (("(MANPATH = )[[:graph:]]*" _ front)
137 (string-append front out "/share/man"))
138 (("(CONFDIR = )([[:graph:]]*)" _ front default)
139 (string-append front out default))
140 ;; The "l" option was silently ignored until binutils 2.36,
141 ;; where it got a different purpose. So remove it to avoid
142 ;; "ar: libdeps specified more than once".
143 (("((AR|MODAR) = ar )clq" _ front)
144 (string-append front "cq")))
146 (add-after 'install 'install/doc
148 (invoke "make" "install.man"))))))
149 (home-page "http://mcj.sourceforge.net/")
150 (synopsis "Create portable LaTeX figures")
152 "Transfig creates a makefile to translate figures described in Fig code
153 or PIC into a specified LaTeX graphics language. PIC files are identified by
154 the suffix \".pic\"; Fig files can be specified either with or without the
155 suffix \".fig\". Transfig also creates a TeX macro file appropriate to the