Commit | Line | Data |
---|---|---|
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" | |
6aad2d62 EB |
93 | ;; These imake variables somehow remain undefined |
94 | (("DefaultGcc2[[:graph:]]*Opt") "-O2") | |
b3f3fb82 EB |
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. | |
126 | In xfig, figures may be drawn using objects such as circles, boxes, lines, | |
127 | spline curves, text, etc. It is also possible to import images in formats | |
128 | such as GIF, JPEG, EPSF (PostScript), etc. Those objects can be created, | |
129 | deleted, moved or modified. Attributes such as colors or line styles can be | |
130 | selected in various ways. For text, 35 fonts are available.") | |
131 | (license bsd-2))) | |
36ae5848 EB |
132 | |
133 | (define-public transfig | |
134 | (package | |
135 | (name "transfig") | |
136 | (version "3.2.5e") | |
137 | (source | |
138 | (origin | |
139 | (method url-fetch) | |
140 | (uri (string-append "mirror://sourceforge/mcj/mcj-source/transfig." | |
141 | version ".tar.gz")) | |
142 | (sha256 | |
143 | (base32 | |
144 | "0i3p7qmg2w8qrad3pn42b0miwarql7yy0gpd49b1bpal6bqsiicf")))) | |
145 | (build-system gnu-build-system) | |
146 | (native-inputs | |
147 | `(("imake" ,imake) | |
148 | ("makedepend" ,makedepend))) | |
149 | (inputs | |
150 | `(("xfig" ,xfig) | |
151 | ("libjpeg" ,libjpeg) | |
152 | ("libpng" ,libpng) | |
153 | ("libxpm" ,libxpm) | |
154 | ("libx11" ,libx11) | |
155 | ("zlib" ,zlib))) | |
156 | (arguments | |
157 | `(#:tests? #f | |
158 | #:phases | |
159 | (alist-replace | |
160 | 'configure | |
161 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
162 | (let ((imake (assoc-ref inputs "imake")) | |
163 | (out (assoc-ref outputs "out"))) | |
164 | (substitute* '("fig2dev/Imakefile" | |
165 | "transfig/Imakefile") | |
166 | (("XCOMM (BINDIR = )[[:graph:]]*" _ front) | |
167 | (string-append front out "/bin")) | |
168 | (("XCOMM USEINLINE") "USEINLINE") | |
169 | ;; The variable name is deceptive. The directory is used as an | |
170 | ;; installation path for bitmaps. | |
171 | (("(XFIGLIBDIR =[[:blank:]]*)[[:graph:]]*" _ front) | |
172 | (string-append front out "/lib")) | |
173 | (("(XPMLIBDIR = )[[:graph:]]*" _ front) | |
174 | (string-append front (assoc-ref inputs "libxpm") "/lib")) | |
175 | (("(XPMINC = -I)[[:graph:]]*" _ front) | |
176 | (string-append front (assoc-ref inputs "libxpm") "/include/X11")) | |
177 | (("/usr/local/lib/fig2dev") (string-append out "/lib"))) | |
178 | ;; The -a argument is required in order to pick up the correct paths | |
179 | ;; to several X header files. | |
180 | (zero? (system* "xmkmf" "-a")) | |
181 | (substitute* '("Makefile" | |
182 | "fig2dev/Makefile" | |
183 | "transfig/Makefile") | |
6aad2d62 EB |
184 | ;; These imake variables somehow remain undefined |
185 | (("DefaultGcc2[[:graph:]]*Opt") "-O2") | |
36ae5848 EB |
186 | ;; Reset a few variable defaults that are set in imake templates |
187 | ((imake) out) | |
188 | (("(MANPATH = )[[:graph:]]*" _ front) | |
189 | (string-append front out "/share/man")) | |
190 | (("(CONFDIR = )([[:graph:]]*)" _ front default) | |
191 | (string-append front out default))))) | |
192 | (alist-cons-after | |
193 | 'install 'install/doc | |
194 | (lambda _ | |
195 | (zero? (system* "make" "install.man"))) | |
196 | %standard-phases)))) | |
197 | (home-page "http://www.xfig.org/") | |
198 | (synopsis "Create portable LaTeX figures") | |
199 | (description | |
200 | "Transfig creates a makefile to translate figures described in Fig code | |
201 | or PIC into a specified LaTeX graphics language. PIC files are identified by | |
202 | the suffix \".pic\"; Fig files can be specified either with or without the | |
203 | suffix \".fig\". Transfig also creates a TeX macro file appropriate to the | |
204 | target language.") | |
205 | (license bsd-2))) |