gnu: Add wlgreet.
[jackhill/guix/guix.git] / gnu / packages / xfig.scm
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>
7 ;;;
8 ;;; This file is part of GNU Guix.
9 ;;;
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.
14 ;;;
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.
19 ;;;
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/>.
22
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))
34
35 (define-public xfig
36 (package
37 (name "xfig")
38 (version "3.2.8b")
39 (source
40 (origin
41 (method url-fetch)
42 (uri (string-append "mirror://sourceforge/mcj/"
43 name "-" version ".tar.xz"))
44 (sha256
45 (base32
46 "0fndgbm1mkqb1sn2v2kj3nx9mxj70jbp31y2bjvzcmmkry0q3k5j"))))
47 (build-system gnu-build-system)
48 (native-inputs
49 ;; For tests.
50 (list desktop-file-utils ghostscript))
51 (inputs
52 `(("libxaw3d" ,libxaw3d)
53 ("libjpeg" ,libjpeg-turbo)
54 ("libpng" ,libpng)
55 ("libxpm" ,libxpm)
56 ("libx11" ,libx11)
57 ("libxt" ,libxt)))
58 (arguments
59 `(#:phases
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"))
66 #t)))))
67 (home-page "http://mcj.sourceforge.net/")
68 (synopsis "Interactive drawing tool")
69 (description
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.")
76 (license bsd-2)))
77
78 (define-public transfig
79 (package
80 (name "transfig")
81 (version "3.2.5e")
82 (source
83 (origin
84 (method url-fetch)
85 (uri (string-append "mirror://sourceforge/mcj/mcj-source/transfig."
86 version ".tar.gz"))
87 (sha256
88 (base32
89 "0i3p7qmg2w8qrad3pn42b0miwarql7yy0gpd49b1bpal6bqsiicf"))
90 (patches
91 (search-patches
92 "transfig-gcc10-fno-common.patch")))) ; fix GCC10 build
93 (build-system gnu-build-system)
94 (native-inputs
95 (list imake makedepend))
96 (inputs
97 `(("xfig" ,xfig)
98 ("libjpeg" ,libjpeg-turbo)
99 ("libpng" ,libpng)
100 ("libxpm" ,libxpm)
101 ("libx11" ,libx11)
102 ("zlib" ,zlib)))
103 (arguments
104 `(#:tests? #f
105 #:phases
106 (modify-phases %standard-phases
107 (replace 'configure
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"
129 "fig2dev/Makefile"
130 "fig2dev/dev/Makefile"
131 "transfig/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
135 ((imake) out)
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")))
145 #t)))
146 (add-after 'install 'install/doc
147 (lambda _
148 (invoke "make" "install.man"))))))
149 (home-page "http://mcj.sourceforge.net/")
150 (synopsis "Create portable LaTeX figures")
151 (description
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
156 target language.")
157 (license bsd-2)))