gnu: Add xfig.
[jackhill/guix/guix.git] / gnu / packages / xfig.scm
CommitLineData
b3f3fb82
EB
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
3;;;
4;;; This file is part of GNU Guix.
5;;;
6;;; GNU 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;;; GNU 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 GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19(define-module (gnu packages xfig)
20 #:use-module (guix packages)
21 #:use-module ((guix licenses) #:select (bsd-2))
22 #:use-module (guix download)
23 #:use-module (guix build-system gnu)
24 #:use-module (gnu packages)
25 #:use-module (gnu packages xorg)
26 #:use-module (gnu packages image)
27 #:use-module (gnu packages groff)
28 #:use-module (gnu packages compression))
29
30(define-public xfig
31 (package
32 (name "xfig")
33 (version "3.2.5c")
34 (source
35 (origin
36 (method url-fetch)
37 (uri (string-append "mirror://sourceforge/mcj/mcj-source/xfig."
38 version ".full.tar.gz"))
39 (sha256
40 (base32
41 "1yd1jclvw5w3ja4jjzr1ysbn8iklh88wq84jn9d1gavrbfbqyqpa"))))
42 (build-system gnu-build-system)
43 (native-inputs
44 `(("imake" ,imake)
45 ("makedepend" ,makedepend)
46 ("groff" ,groff))) ;for creating some doc
47 (inputs
48 `(("libxaw3d" ,libxaw3d)
49 ;; Requires libjpeg>=9a, otherwise jmorecfg.h define an enum FALSE that
50 ;; conflicts with the FALSE macro from X11/Intrinsic.h
51 ("libjpeg" ,libjpeg)
52 ("libpng" ,libpng)
53 ("libxpm" ,libxpm)
54 ("libx11" ,libx11)
55 ("libxmu" ,libxmu)
56 ("libxt" ,libxt)
57 ("zlib" ,zlib)))
58 (arguments
59 `(#:tests? #f
60 #:phases
61 (alist-replace
62 'configure
63 (lambda* (#:key inputs outputs #:allow-other-keys)
64 (let ((imake (assoc-ref inputs "imake"))
65 (out (assoc-ref outputs "out")))
66 (substitute* "Imakefile"
67 (("XCOMM (BINDIR = )[[:graph:]]*" _ front)
68 (string-append front out "/bin"))
69 (("(PNGLIBDIR = )[[:graph:]]*" _ front)
70 (string-append front (assoc-ref inputs "libpng") "/lib"))
71 (("(PNGINC = -I)[[:graph:]]*" _ front)
72 (string-append front (assoc-ref inputs "libpng") "/include"))
73 (("(JPEGLIBDIR = )[[:graph:]]*" _ front)
74 (string-append front (assoc-ref inputs "libjpeg") "/lib"))
75 (("(JPEGINC = -I)[[:graph:]]*" _ front)
76 (string-append front (assoc-ref inputs "libjpeg") "/include"))
77 (("(ZLIBDIR = )[[:graph:]]*" _ front)
78 (string-append front (assoc-ref inputs "zlib") "/lib"))
79 (("(XPMLIBDIR = )[[:graph:]]*" _ front)
80 (string-append front (assoc-ref inputs "libxpm") "/lib"))
81 (("(XPMINC = -I)[[:graph:]]*" _ front)
82 (string-append front (assoc-ref inputs "libxpm") "/include"))
83 (("(XFIGLIBDIR = )[[:graph:]]*" _ front)
84 (string-append front out "/lib"))
85 (("(XFIGDOCDIR = )[[:graph:]]*" _ front)
86 (string-append front out "/share/doc"))
87 (("XCOMM USEINLINE") "USEINLINE"))
88 ;; The -a argument is required in order to pick up the correct paths
89 ;; to several X header files.
90 (zero? (system* "xmkmf" "-a"))
91 ;; Reset some variables that are inherited from imake templates
92 (substitute* "Makefile"
93 ;; This imake variable somehow remains undefined
94 (("DefaultGcc2AMD64Opt") "-O2")
95 ;; Reset a few variable defaults that are set in imake templates
96 ((imake) out)
97 (("(MANPATH = )[[:graph:]]*" _ front)
98 (string-append front out "/share/man"))
99 (("(CONFDIR = )([[:graph:]]*)" _ front default)
100 (string-append front out default)))))
101 (alist-cons-after
102 'install 'install/libs
103 (lambda _
104 (zero? (system* "make" "install.libs")))
105 (alist-cons-after
106 'install 'install/doc
107 (lambda _
108 (begin
109 ;; The Doc/xfig_man.html file is expected by the install.html
110 ;; target, but is not present in the tarball, so generate it.
111 (use-modules (ice-9 popen))
112 (let* ((in (open-pipe* OPEN_READ
113 "groff" "-mandoc" "-Thtml"
114 "Doc/xfig.man"))
115 (out (open-output-file "Doc/xfig_man.html")))
116 (begin
117 (dump-port in out)
118 (close-pipe in)
119 (close-port out)))
120 (zero? (system* "make" "install.doc"))))
121 %standard-phases)))))
122 (home-page "http://xfig.org/")
123 (synopsis "Interactive drawing tool")
124 (description
125 "Xfig is an interactive drawing tool which runs under X Window System.
126In xfig, figures may be drawn using objects such as circles, boxes, lines,
127spline curves, text, etc. It is also possible to import images in formats
128such as GIF, JPEG, EPSF (PostScript), etc. Those objects can be created,
129deleted, moved or modified. Attributes such as colors or line styles can be
130selected in various ways. For text, 35 fonts are available.")
131 (license bsd-2)))