Commit | Line | Data |
---|---|---|
b3f3fb82 EB |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org> | |
faef3b15 | 3 | ;;; Copyright © 2014 Federico Beffa <beffa@fbengineering.ch> |
b3f3fb82 EB |
4 | ;;; |
5 | ;;; This file is part of GNU Guix. | |
6 | ;;; | |
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. | |
11 | ;;; | |
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. | |
16 | ;;; | |
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/>. | |
19 | ||
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)) | |
30 | ||
31 | (define-public xfig | |
32 | (package | |
33 | (name "xfig") | |
34 | (version "3.2.5c") | |
35 | (source | |
36 | (origin | |
37 | (method url-fetch) | |
38 | (uri (string-append "mirror://sourceforge/mcj/mcj-source/xfig." | |
39 | version ".full.tar.gz")) | |
40 | (sha256 | |
41 | (base32 | |
42 | "1yd1jclvw5w3ja4jjzr1ysbn8iklh88wq84jn9d1gavrbfbqyqpa")))) | |
43 | (build-system gnu-build-system) | |
44 | (native-inputs | |
45 | `(("imake" ,imake) | |
46 | ("makedepend" ,makedepend) | |
47 | ("groff" ,groff))) ;for creating some doc | |
48 | (inputs | |
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 | |
52 | ("libjpeg" ,libjpeg) | |
53 | ("libpng" ,libpng) | |
54 | ("libxpm" ,libxpm) | |
55 | ("libx11" ,libx11) | |
56 | ("libxmu" ,libxmu) | |
57 | ("libxt" ,libxt) | |
58 | ("zlib" ,zlib))) | |
59 | (arguments | |
60 | `(#:tests? #f | |
61 | #:phases | |
62 | (alist-replace | |
63 | 'configure | |
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" | |
6aad2d62 EB |
94 | ;; These imake variables somehow remain undefined |
95 | (("DefaultGcc2[[:graph:]]*Opt") "-O2") | |
b3f3fb82 EB |
96 | ;; Reset a few variable defaults that are set in imake templates |
97 | ((imake) out) | |
98 | (("(MANPATH = )[[:graph:]]*" _ front) | |
99 | (string-append front out "/share/man")) | |
100 | (("(CONFDIR = )([[:graph:]]*)" _ front default) | |
101 | (string-append front out default))))) | |
102 | (alist-cons-after | |
103 | 'install 'install/libs | |
104 | (lambda _ | |
105 | (zero? (system* "make" "install.libs"))) | |
106 | (alist-cons-after | |
107 | 'install 'install/doc | |
108 | (lambda _ | |
109 | (begin | |
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" | |
115 | "Doc/xfig.man")) | |
116 | (out (open-output-file "Doc/xfig_man.html"))) | |
117 | (begin | |
118 | (dump-port in out) | |
119 | (close-pipe in) | |
120 | (close-port out))) | |
121 | (zero? (system* "make" "install.doc")))) | |
faef3b15 FB |
122 | (alist-cons-after |
123 | 'install 'wrap-xfig | |
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)))))) | |
b3f3fb82 EB |
130 | (home-page "http://xfig.org/") |
131 | (synopsis "Interactive drawing tool") | |
132 | (description | |
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.") | |
139 | (license bsd-2))) | |
36ae5848 EB |
140 | |
141 | (define-public transfig | |
142 | (package | |
143 | (name "transfig") | |
144 | (version "3.2.5e") | |
145 | (source | |
146 | (origin | |
147 | (method url-fetch) | |
148 | (uri (string-append "mirror://sourceforge/mcj/mcj-source/transfig." | |
149 | version ".tar.gz")) | |
150 | (sha256 | |
151 | (base32 | |
152 | "0i3p7qmg2w8qrad3pn42b0miwarql7yy0gpd49b1bpal6bqsiicf")))) | |
153 | (build-system gnu-build-system) | |
154 | (native-inputs | |
155 | `(("imake" ,imake) | |
156 | ("makedepend" ,makedepend))) | |
157 | (inputs | |
158 | `(("xfig" ,xfig) | |
159 | ("libjpeg" ,libjpeg) | |
160 | ("libpng" ,libpng) | |
161 | ("libxpm" ,libxpm) | |
162 | ("libx11" ,libx11) | |
163 | ("zlib" ,zlib))) | |
164 | (arguments | |
165 | `(#:tests? #f | |
166 | #:phases | |
167 | (alist-replace | |
168 | 'configure | |
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" | |
190 | "fig2dev/Makefile" | |
191 | "transfig/Makefile") | |
6aad2d62 EB |
192 | ;; These imake variables somehow remain undefined |
193 | (("DefaultGcc2[[:graph:]]*Opt") "-O2") | |
36ae5848 EB |
194 | ;; Reset a few variable defaults that are set in imake templates |
195 | ((imake) out) | |
196 | (("(MANPATH = )[[:graph:]]*" _ front) | |
197 | (string-append front out "/share/man")) | |
198 | (("(CONFDIR = )([[:graph:]]*)" _ front default) | |
199 | (string-append front out default))))) | |
200 | (alist-cons-after | |
201 | 'install 'install/doc | |
202 | (lambda _ | |
203 | (zero? (system* "make" "install.man"))) | |
204 | %standard-phases)))) | |
205 | (home-page "http://www.xfig.org/") | |
206 | (synopsis "Create portable LaTeX figures") | |
207 | (description | |
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 | |
212 | target language.") | |
213 | (license bsd-2))) |