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
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 (BINDIR = )[[:graph:]]*" _ front)
69 (string-append front out "/bin"))
70 (("(PNGLIBDIR = )[[:graph:]]*" _ front)
71 (string-append front (assoc-ref inputs "libpng") "/lib"))
72 (("(PNGINC = -I)[[:graph:]]*" _ front)
73 (string-append front (assoc-ref inputs "libpng") "/include"))
74 (("(JPEGLIBDIR = )[[:graph:]]*" _ front)
75 (string-append front (assoc-ref inputs "libjpeg") "/lib"))
76 (("(JPEGINC = -I)[[:graph:]]*" _ front)
77 (string-append front (assoc-ref inputs "libjpeg") "/include"))
78 (("(ZLIBDIR = )[[:graph:]]*" _ front)
79 (string-append front (assoc-ref inputs "zlib") "/lib"))
80 (("(XPMLIBDIR = )[[:graph:]]*" _ front)
81 (string-append front (assoc-ref inputs "libxpm") "/lib"))
82 (("(XPMINC = -I)[[:graph:]]*" _ front)
83 (string-append front (assoc-ref inputs "libxpm") "/include"))
84 (("(XFIGLIBDIR = )[[:graph:]]*" _ front)
85 (string-append front out "/lib"))
86 (("(XFIGDOCDIR = )[[:graph:]]*" _ front)
87 (string-append front out "/share/doc"))
88 (("XCOMM USEINLINE") "USEINLINE"))
89 ;; The -a argument is required in order to pick up the correct paths
90 ;; to several X header files.
91 (zero? (system* "xmkmf" "-a"))
92 ;; Reset some variables that are inherited from imake templates
93 (substitute* "Makefile"
94 ;; These imake variables somehow remain undefined
95 (("DefaultGcc2[[:graph:]]*Opt") "-O2")
96 ;; Reset a few variable defaults that are set in imake templates
98 (("(MANPATH = )[[:graph:]]*" _ front)
99 (string-append front out "/share/man"))
100 (("(CONFDIR = )([[:graph:]]*)" _ front default)
101 (string-append front out default)))))
103 'install 'install/libs
105 (zero? (system* "make" "install.libs")))
107 'install 'install/doc
110 ;; The Doc/xfig_man.html file is expected by the install.html
111 ;; target, but is not present in the tarball, so generate it.
112 (use-modules (ice-9 popen))
113 (let* ((in (open-pipe* OPEN_READ
114 "groff" "-mandoc" "-Thtml"
116 (out (open-output-file "Doc/xfig_man.html")))
121 (zero? (system* "make" "install.doc"))))
124 (lambda* (#:key outputs #:allow-other-keys)
125 (let ((out (assoc-ref outputs "out")))
126 (wrap-program (string-append out "/bin/xfig")
127 `("XAPPLRESDIR" suffix
128 (,(string-append out "/etc/X11/app-defaults"))))))
129 %standard-phases))))))
130 (home-page "http://xfig.org/")
131 (synopsis "Interactive drawing tool")
133 "Xfig is an interactive drawing tool which runs under X Window System.
134 In xfig, figures may be drawn using objects such as circles, boxes, lines,
135 spline curves, text, etc. It is also possible to import images in formats
136 such as GIF, JPEG, EPSF (PostScript), etc. Those objects can be created,
137 deleted, moved or modified. Attributes such as colors or line styles can be
138 selected in various ways. For text, 35 fonts are available.")
141 (define-public transfig
148 (uri (string-append "mirror://sourceforge/mcj/mcj-source/transfig."
152 "0i3p7qmg2w8qrad3pn42b0miwarql7yy0gpd49b1bpal6bqsiicf"))))
153 (build-system gnu-build-system)
156 ("makedepend" ,makedepend)))
169 (lambda* (#:key inputs outputs #:allow-other-keys)
170 (let ((imake (assoc-ref inputs "imake"))
171 (out (assoc-ref outputs "out")))
172 (substitute* '("fig2dev/Imakefile"
173 "transfig/Imakefile")
174 (("XCOMM (BINDIR = )[[:graph:]]*" _ front)
175 (string-append front out "/bin"))
176 (("XCOMM USEINLINE") "USEINLINE")
177 ;; The variable name is deceptive. The directory is used as an
178 ;; installation path for bitmaps.
179 (("(XFIGLIBDIR =[[:blank:]]*)[[:graph:]]*" _ front)
180 (string-append front out "/lib"))
181 (("(XPMLIBDIR = )[[:graph:]]*" _ front)
182 (string-append front (assoc-ref inputs "libxpm") "/lib"))
183 (("(XPMINC = -I)[[:graph:]]*" _ front)
184 (string-append front (assoc-ref inputs "libxpm") "/include/X11"))
185 (("/usr/local/lib/fig2dev") (string-append out "/lib")))
186 ;; The -a argument is required in order to pick up the correct paths
187 ;; to several X header files.
188 (zero? (system* "xmkmf" "-a"))
189 (substitute* '("Makefile"
192 ;; These imake variables somehow remain undefined
193 (("DefaultGcc2[[:graph:]]*Opt") "-O2")
194 ;; Reset a few variable defaults that are set in imake templates
196 (("(MANPATH = )[[:graph:]]*" _ front)
197 (string-append front out "/share/man"))
198 (("(CONFDIR = )([[:graph:]]*)" _ front default)
199 (string-append front out default)))))
201 'install 'install/doc
203 (zero? (system* "make" "install.man")))
205 (home-page "http://www.xfig.org/")
206 (synopsis "Create portable LaTeX figures")
208 "Transfig creates a makefile to translate figures described in Fig code
209 or PIC into a specified LaTeX graphics language. PIC files are identified by
210 the suffix \".pic\"; Fig files can be specified either with or without the
211 suffix \".fig\". Transfig also creates a TeX macro file appropriate to the