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>
5 ;;; This file is part of GNU Guix.
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; 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 xorg)
27 #:use-module (gnu packages image)
28 #:use-module (gnu packages groff)
29 #:use-module (gnu packages compression))
38 (uri (string-append "mirror://sourceforge/mcj/mcj-source/xfig."
39 version ".full.tar.gz"))
42 "1yd1jclvw5w3ja4jjzr1ysbn8iklh88wq84jn9d1gavrbfbqyqpa"))))
43 (build-system gnu-build-system)
46 ("makedepend" ,makedepend)
47 ("groff" ,groff))) ;for creating some doc
49 `(("libxaw3d" ,libxaw3d)
50 ;; Requires libjpeg>=9a, otherwise jmorecfg.h define an enum FALSE that
51 ;; conflicts with the FALSE macro from X11/Intrinsic.h
62 (modify-phases %standard-phases
64 (lambda* (#:key inputs outputs #:allow-other-keys)
65 (let ((imake (assoc-ref inputs "imake"))
66 (out (assoc-ref outputs "out")))
67 (substitute* "Imakefile"
68 (("XCOMM XAPPLOADDIR = /home/user/xfig *")
69 (string-append "XAPPLOADDIR = " out ,%app-defaults-dir))
70 (("XCOMM (BINDIR = )[[:graph:]]*" _ front)
71 (string-append front out "/bin"))
72 (("(PNGLIBDIR = )[[:graph:]]*" _ front)
73 (string-append front (assoc-ref inputs "libpng") "/lib"))
74 (("(PNGINC = -I)[[:graph:]]*" _ front)
75 (string-append front (assoc-ref inputs "libpng") "/include"))
76 (("(JPEGLIBDIR = )[[:graph:]]*" _ front)
77 (string-append front (assoc-ref inputs "libjpeg") "/lib"))
78 (("(JPEGINC = -I)[[:graph:]]*" _ front)
79 (string-append front (assoc-ref inputs "libjpeg") "/include"))
80 (("(ZLIBDIR = )[[:graph:]]*" _ front)
81 (string-append front (assoc-ref inputs "zlib") "/lib"))
82 (("(XPMLIBDIR = )[[:graph:]]*" _ front)
83 (string-append front (assoc-ref inputs "libxpm") "/lib"))
84 (("(XPMINC = -I)[[:graph:]]*" _ front)
85 (string-append front (assoc-ref inputs "libxpm") "/include"))
86 (("(XFIGLIBDIR = )[[:graph:]]*" _ front)
87 (string-append front out "/lib"))
88 (("(XFIGDOCDIR = )[[:graph:]]*" _ front)
89 (string-append front out "/share/doc"))
90 (("XCOMM USEINLINE") "USEINLINE"))
91 ;; The -a argument is required in order to pick up the correct paths
92 ;; to several X header files.
93 (zero? (system* "xmkmf" "-a"))
94 ;; Reset some variables that are inherited from imake templates
95 (substitute* "Makefile"
96 ;; These imake variables somehow remain undefined
97 (("DefaultGcc2[[:graph:]]*Opt") "-O2")
98 ;; Reset a few variable defaults that are set in imake templates
100 (("(MANPATH = )[[:graph:]]*" _ front)
101 (string-append front out "/share/man"))
102 (("(CONFDIR = )([[:graph:]]*)" _ front default)
103 (string-append front out default))))
106 'install 'install/libs
108 (zero? (system* "make" "install.libs"))))
110 'install 'install/doc
113 ;; The Doc/xfig_man.html file is expected by the install.html
114 ;; target, but is not present in the tarball, so generate it.
115 (use-modules (ice-9 popen))
116 (let* ((in (open-pipe* OPEN_READ
117 "groff" "-mandoc" "-Thtml"
119 (out (open-output-file "Doc/xfig_man.html")))
124 (zero? (system* "make" "install.doc"))))))))
125 (home-page "http://xfig.org/")
126 (synopsis "Interactive drawing tool")
128 "Xfig is an interactive drawing tool which runs under X Window System.
129 In xfig, figures may be drawn using objects such as circles, boxes, lines,
130 spline curves, text, etc. It is also possible to import images in formats
131 such as GIF, JPEG, EPSF (PostScript), etc. Those objects can be created,
132 deleted, moved or modified. Attributes such as colors or line styles can be
133 selected in various ways. For text, 35 fonts are available.")
136 (define-public transfig
143 (uri (string-append "mirror://sourceforge/mcj/mcj-source/transfig."
147 "0i3p7qmg2w8qrad3pn42b0miwarql7yy0gpd49b1bpal6bqsiicf"))))
148 (build-system gnu-build-system)
151 ("makedepend" ,makedepend)))
162 (modify-phases %standard-phases
164 (lambda* (#:key inputs outputs #:allow-other-keys)
165 (let ((imake (assoc-ref inputs "imake"))
166 (out (assoc-ref outputs "out")))
167 (substitute* '("fig2dev/Imakefile"
168 "transfig/Imakefile")
169 (("XCOMM (BINDIR = )[[:graph:]]*" _ front)
170 (string-append front out "/bin"))
171 (("XCOMM USEINLINE") "USEINLINE")
172 ;; The variable name is deceptive. The directory is used as an
173 ;; installation path for bitmaps.
174 (("(XFIGLIBDIR =[[:blank:]]*)[[:graph:]]*" _ front)
175 (string-append front out "/lib"))
176 (("(XPMLIBDIR = )[[:graph:]]*" _ front)
177 (string-append front (assoc-ref inputs "libxpm") "/lib"))
178 (("(XPMINC = -I)[[:graph:]]*" _ front)
179 (string-append front (assoc-ref inputs "libxpm") "/include/X11"))
180 (("/usr/local/lib/fig2dev") (string-append out "/lib")))
181 ;; The -a argument is required in order to pick up the correct paths
182 ;; to several X header files.
183 (zero? (system* "xmkmf" "-a"))
184 (substitute* '("Makefile"
187 ;; These imake variables somehow remain undefined
188 (("DefaultGcc2[[:graph:]]*Opt") "-O2")
189 ;; Reset a few variable defaults that are set in imake templates
191 (("(MANPATH = )[[:graph:]]*" _ front)
192 (string-append front out "/share/man"))
193 (("(CONFDIR = )([[:graph:]]*)" _ front default)
194 (string-append front out default))))))
195 (add-after 'install 'install/doc
197 (zero? (system* "make" "install.man")))))))
198 (home-page "http://www.xfig.org/")
199 (synopsis "Create portable LaTeX figures")
201 "Transfig creates a makefile to translate figures described in Fig code
202 or PIC into a specified LaTeX graphics language. PIC files are identified by
203 the suffix \".pic\"; Fig files can be specified either with or without the
204 suffix \".fig\". Transfig also creates a TeX macro file appropriate to the