gnu: fontconfig: Fix build failure caused by symbol conflict with glibc@2.25.
[jackhill/guix/guix.git] / gnu / packages / fontutils.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2014, 2016 Eric Bavier <bavier@member.fsf.org>
4 ;;; Copyright © 2016 Mark H Weaver <mhw@netris.org>
5 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
6 ;;;
7 ;;; This file is part of GNU Guix.
8 ;;;
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
13 ;;;
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
18 ;;;
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22 (define-module (gnu packages fontutils)
23 #:use-module (gnu packages)
24 #:use-module (gnu packages compression)
25 #:use-module (gnu packages ghostscript)
26 #:use-module (gnu packages perl)
27 #:use-module (gnu packages pkg-config)
28 #:use-module (gnu packages autotools)
29 #:use-module (gnu packages gettext)
30 #:use-module (gnu packages python)
31 #:use-module (gnu packages image)
32 #:use-module (gnu packages bison)
33 #:use-module (gnu packages flex)
34 #:use-module (gnu packages glib)
35 #:use-module (gnu packages xorg)
36 #:use-module (gnu packages gtk)
37 #:use-module (gnu packages xml)
38 #:use-module ((guix licenses) #:prefix license:)
39 #:use-module (guix packages)
40 #:use-module (guix download)
41 #:use-module (guix svn-download)
42 #:use-module (guix git-download)
43 #:use-module (guix build-system cmake)
44 #:use-module (guix build-system gnu))
45
46 (define-public freetype
47 (package
48 (name "freetype")
49 (version "2.7")
50 (source (origin
51 (method url-fetch)
52 (uri (string-append "mirror://savannah/freetype/freetype-"
53 version ".tar.bz2"))
54 (sha256 (base32
55 "0j3xgzn6pchgg1nm294vhx7cdicb7x3x8kwnlcm7v1alnzsm396n"))))
56 (build-system gnu-build-system)
57 (native-inputs
58 `(("pkg-config" ,pkg-config)))
59 (propagated-inputs
60 ;; These are all in the Requires.private field of freetype2.pc.
61 ;; XXX: add harfbuzz.
62 `(("libpng" ,libpng)
63 ("zlib" ,zlib)))
64 (synopsis "Font rendering library")
65 (description
66 "Freetype is a library that can be used by applications to access the
67 contents of font files. It provides a uniform interface to access font files.
68 It supports both bitmap and scalable formats, including TrueType, OpenType,
69 Type1, CID, CFF, Windows FON/FNT, X11 PCF, and others. It supports high-speed
70 anti-aliased glyph bitmap generation with 256 gray levels.")
71 (license license:freetype) ; some files have other licenses
72 (home-page "https://www.freetype.org/")))
73
74 (define-public ttfautohint
75 (package
76 (name "ttfautohint")
77 (version "1.5")
78 (source
79 (origin
80 (method url-fetch)
81 (uri (string-append "mirror://savannah/freetype/ttfautohint-"
82 version ".tar.gz"))
83 (sha256
84 (base32
85 "1lgghck46p33z3hg8dnl76jryig4fh6d8rhzms837zp7x4hyfkv4"))
86 (patches (list (search-patch "ttfautohint-source-date-epoch.patch")))))
87 (build-system gnu-build-system)
88 (native-inputs
89 `(("flex" ,flex)
90 ("bison" ,bison)
91 ("pkg-config" ,pkg-config)))
92 (inputs
93 `(("freetype" ,freetype)
94 ("harfbuzz" ,harfbuzz)))
95 (arguments
96 `(#:configure-flags '("--with-qt=no"))) ;no gui
97 (synopsis "Automated font hinting")
98 (description
99 "ttfautohint provides a 99% automated hinting process and a platform for
100 finely hand-hinting the last 1%. It is ideal for web fonts and supports many
101 scripts.")
102 (license (list license:gpl2+ license:freetype)) ;choose one or the other
103 (home-page "http://www.freetype.org/ttfautohint/")))
104
105 (define-public woff-tools
106 (package
107 (name "woff-tools")
108 (version "2009.10.04")
109 (source
110 (origin
111 (method url-fetch)
112 ;; Upstream source is unversioned, so use Debian's versioned tarball
113 (uri (string-append "mirror://debian/pool/main/w/woff-tools/"
114 "woff-tools_" version ".orig.tar.gz"))
115 (file-name (string-append name "-" version ".tar.gz"))
116 (sha256
117 (base32
118 "1i97gkqa6jfzlslsngqf556kx60knlgf7yc9pzsq2pizc6f0d4zl"))))
119 (build-system gnu-build-system)
120 (inputs
121 `(("zlib" ,zlib)))
122 (arguments
123 `(#:make-flags '("CC=gcc")
124 #:tests? #f ;no tests
125 #:phases
126 (modify-phases %standard-phases
127 (delete 'configure) ;no configuration
128 (replace 'install
129 (lambda* (#:key outputs #:allow-other-keys)
130 (let* ((out (assoc-ref outputs "out"))
131 (bin (string-append out "/bin")))
132 (install-file "sfnt2woff" bin)
133 (install-file "woff2sfnt" bin)))))))
134 (synopsis "Convert between OpenType and WOFF fonts")
135 (description
136 "This package provides two tools:
137 @table @code
138 @item sfnt2woff
139 Converts OpenType fonts to WOFF fonts
140 @item woff2sfnt
141 Converts WOFF fonts to OpenType fonts
142 @end table")
143 (license (list license:mpl1.1 license:gpl2+ license:lgpl2.1+))
144 (home-page "https://people.mozilla.com/~jkew/woff/")))
145
146 (define-public ttf2eot
147 (package
148 (name "ttf2eot")
149 (version "0.0.2-2")
150 (source
151 (origin
152 (method url-fetch)
153 (uri (string-append "https://storage.googleapis.com/"
154 "google-code-archive-downloads/v2/"
155 "code.google.com/ttf2eot/"
156 "ttf2eot-" version ".tar.gz"))
157 (sha256
158 (base32
159 "1f4dzzmhn0208dvbm3ia5ar6ls9apwc6ampy5blmfxkigi6z0g02"))
160 (patches (list (search-patch "ttf2eot-cstddef.patch")))))
161 (build-system gnu-build-system)
162 (arguments
163 `(#:tests? #f ;no tests
164 #:phases
165 (modify-phases %standard-phases
166 (delete 'configure) ;no configuration
167 (replace 'install
168 (lambda* (#:key outputs #:allow-other-keys)
169 (let* ((out (assoc-ref outputs "out"))
170 (bin (string-append out "/bin")))
171 (install-file "ttf2eot" bin)))))))
172 (synopsis "Convert from TrueType to Embeddable Open Type")
173 (description
174 "This package contains a commandline wrapper around OpenTypeUtilities.cpp
175 from Chromium, used to make EOT (Embeddable Open Type) files from
176 TTF (TrueType/OpenType Font) files.")
177 ;; While the README states "License: Derived from WebKit, so BSD/LGPL
178 ;; 2/LGPL 2.1", the single derived source file includes only BSD in its
179 ;; license header, and the wrapper source contains no license header.
180 (license license:bsd-2)
181 (home-page "https://code.google.com/archive/p/ttf2eot/")))
182
183 (define-public woff2
184 (let ((commit "4e698b8c6c5e070d53c340db9ddf160e21070ede")
185 (revision "1"))
186 (package
187 (name "woff2")
188 (version (string-append "20160306-" revision "."
189 (string-take commit 7)))
190 (source (origin
191 (method git-fetch)
192 (uri (git-reference
193 (url "https://github.com/google/woff2.git")
194 (commit commit)))
195 (file-name (string-append name "-" version ".tar.xz"))
196 (sha256
197 (base32
198 "0wka0yhf0cjmd4rv2jckxpyv6lb5ckj4nj0k1ajq5hrjy7f30lcp"))
199 (patches (list (search-patch "woff2-libbrotli.patch")))))
200 (build-system gnu-build-system)
201 (native-inputs
202 `(("pkg-config" ,pkg-config)))
203 (inputs
204 `(("brotli" ,brotli)))
205 (arguments
206 `(#:tests? #f ;no tests
207 #:phases (modify-phases %standard-phases
208 (delete 'configure)
209 (replace 'install
210 (lambda* (#:key outputs #:allow-other-keys)
211 (let* ((out (assoc-ref outputs "out"))
212 (bin (string-append out "/bin")))
213 (install-file "woff2_compress" bin)
214 (install-file "woff2_decompress" bin)
215 #t))))))
216 (synopsis "Compress TrueType fonts to WOFF2")
217 (description
218 "This package provides utilities for compressing/decompressing TrueType
219 fonts to/from the WOFF2 format.")
220 (license license:asl2.0)
221 (home-page "https://github.com/google/woff2"))))
222
223 (define-public fontconfig
224 (package
225 (name "fontconfig")
226 (version "2.12.1")
227 (source (origin
228 (method url-fetch)
229 (uri (string-append
230 "https://www.freedesktop.org/software/fontconfig/release/fontconfig-"
231 version ".tar.bz2"))
232 (patches (search-patches "fontconfig-charwidth-symbol-conflict.patch"))
233 (sha256 (base32
234 "1wy7svvp7df6bjpg1m5vizb3ngd7rhb20vpclv3x3qa71khs6jdl"))))
235 (build-system gnu-build-system)
236 (propagated-inputs `(("expat" ,expat)
237 ("freetype" ,freetype)))
238 (inputs `(("gs-fonts" ,gs-fonts)))
239 (native-inputs
240 `(("pkg-config" ,pkg-config)))
241 (arguments
242 `(#:configure-flags
243 (list "--with-cache-dir=/var/cache/fontconfig"
244 ;; register gs-fonts as default fonts
245 (string-append "--with-default-fonts="
246 (assoc-ref %build-inputs "gs-fonts")
247 "/share/fonts")
248
249 ;; Register fonts from user and system profiles.
250 (string-append "--with-add-fonts="
251 "~/.guix-profile/share/fonts,"
252 "/run/current-system/profile/share/fonts")
253
254 ;; python is not actually needed
255 "PYTHON=false")
256 #:phases
257 (modify-phases %standard-phases
258 (replace 'install
259 (lambda _
260 ;; Don't try to create /var/cache/fontconfig.
261 (zero? (system* "make" "install"
262 "fc_cachedir=$(TMPDIR)"
263 "RUN_FC_CACHE_TEST=false")))))))
264 (synopsis "Library for configuring and customizing font access")
265 (description
266 "Fontconfig can discover new fonts when installed automatically;
267 perform font name substitution, so that appropriate alternative fonts can
268 be selected if fonts are missing;
269 identify the set of fonts required to completely cover a set of languages;
270 have GUI configuration tools built as it uses an XML-based configuration file;
271 efficiently and quickly find needed fonts among the set of installed fonts;
272 be used in concert with the X Render Extension and FreeType to implement
273 high quality, anti-aliased and subpixel rendered text on a display.")
274 ; The exact license is more X11-style than BSD-style.
275 (license (license:non-copyleft "file://COPYING"
276 "See COPYING in the distribution."))
277 (home-page "http://www.freedesktop.org/wiki/Software/fontconfig")))
278
279 (define-public t1lib
280 (package
281 (name "t1lib")
282 (version "5.1.2")
283 (source (origin
284 (method url-fetch)
285 (uri (list (string-append "ftp://sunsite.unc.edu/pub/Linux/libs/"
286 "graphics/" name "-" version ".tar.gz")
287 (string-append "https://fossies.org/linux/misc/old/"
288 name "-" version ".tar.gz")))
289 (sha256 (base32
290 "0nbvjpnmcznib1nlgg8xckrmsw3haa154byds2h90y2g0nsjh4w2"))
291 (patches (search-patches
292 "t1lib-CVE-2010-2642.patch"
293 "t1lib-CVE-2011-0764.patch"
294 "t1lib-CVE-2011-1552+CVE-2011-1553+CVE-2011-1554.patch"))))
295 (build-system gnu-build-system)
296 (arguments
297 ;; Making the documentation requires latex, but t1lib is also an input
298 ;; for building texlive.
299 `(#:tests? #f ; no test target
300 #:make-flags
301 '("without_doc")))
302 (synopsis "Library for generating bitmaps from Type 1 fonts")
303 (description
304 "T1lib is a library for generating/rasterising bitmaps from Type 1 fonts.
305 It is based on the code of the X11 rasteriser of the X11 project.
306
307 The bitmaps created by t1lib are returned in a data structure with type
308 GLYPH. This special GLYPH-type is also used in the X11 window system to
309 describe character bitmaps. It contains the bitmap data as well as some
310 metric information. But t1lib is in itself entirely independent of the
311 X11-system or any other graphical user interface.")
312 (license license:gpl2)
313 (home-page "http://www.t1lib.org/")))
314
315 (define-public teckit
316 (package
317 (name "teckit")
318 (version "2.5.4")
319 (source (origin
320 ;; Downloaded tarballs vary with each download, so we use an
321 ;; svn snapshot. The 2.5.4 release seems to be made in r128,
322 ;; but r132 updates additional files to contain the correct
323 ;; version number (r129 to r131 do not concern TRUNK).
324 (method svn-fetch)
325 (uri (svn-reference
326 (url "https://scripts.sil.org/svn-public/teckit/TRUNK")
327 (revision 132)))
328 (file-name (string-append name "-" version))
329 (sha256
330 (base32
331 "1xqkqgw30pb24snh46srmjs2j4zhz2dfi5pf7znia0k34mrpwivz"))))
332 (build-system gnu-build-system)
333 (inputs `(("zlib" ,zlib)))
334 (native-inputs
335 `(("autoconf" ,autoconf)
336 ("automake" ,automake)
337 ("libtool" ,libtool)
338 ("perl" ,perl))) ; for the tests
339 (arguments
340 `(#:phases
341 (modify-phases %standard-phases
342 (add-after 'unpack 'autogen
343 (lambda _
344 (zero? (system* "sh" "autogen.sh")))))))
345 (synopsis "Toolkit for encoding conversions")
346 (description
347 "TECkit is a low-level toolkit intended to be used by other applications
348 that need to perform encoding conversions (e.g., when importing legacy data
349 into a Unicode-based application). The primary component of the TECkit
350 package is therefore a library that performs conversions; this is the
351 \"TECkit engine\". The engine relies on mapping tables in a specific binary
352 format (for which documentation is available); there is a compiler that
353 creates such tables from a human-readable mapping description (a simple
354 text file).
355
356 To facilitate the development and testing of mapping tables for TECkit,
357 several applications are also included in the current package; these
358 include simple tools for applying conversions to plain-text and Standard
359 Format files, as well as both command-line and simple GUI versions of the
360 TECkit compiler. However, it is not intended that these tools will be the
361 primary means by which end users perform conversions, and they have not
362 been designed, tested, and debugged to the extent that general-purpose
363 applications should be.")
364 (license license:lgpl2.1+)
365 (home-page "http://scripts.sil.org/cms/scripts/page.php?cat_id=teckit")))
366
367 (define-public graphite2
368 (package
369 (name "graphite2")
370 (version "1.3.9")
371 (source
372 (origin
373 (method url-fetch)
374 (uri (string-append "https://github.com/silnrsi/graphite/releases/"
375 "download/" version "/" name "-" version ".tgz"))
376 (sha256
377 (base32
378 "0rs5h7m340z75kygx8d72cps0q6yvvqa9i788vym7585cfv8a0gc"))))
379 (build-system cmake-build-system)
380 (native-inputs
381 `(("python" ,python-2) ; because of "import imap" in tests
382 ("python-fonttools" ,python2-fonttools)))
383 (inputs
384 `(("freetype" ,freetype)))
385 (synopsis "Reimplementation of the SIL Graphite text processing engine")
386 (description
387 "Graphite2 is a reimplementation of the SIL Graphite text processing
388 engine. Graphite is a smart font technology designed to facilitate the
389 process known as shaping. This process takes an input Unicode text string
390 and returns a sequence of positioned glyphids from the font.")
391 (license license:lgpl2.1+)
392 (home-page "https://github.com/silnrsi/graphite")))
393
394 (define-public potrace
395 (package
396 (name "potrace")
397 (version "1.13")
398 (source
399 (origin
400 (method url-fetch)
401 (uri (string-append "mirror://sourceforge/potrace/" version
402 "/potrace-" version ".tar.gz"))
403 (sha256
404 (base32
405 "115p2vgyq7p2mf4nidk2x3aa341nvv2v8ml056vbji36df5l6lk2"))))
406 (build-system gnu-build-system)
407 (native-inputs `(("ghostscript" ,ghostscript))) ;for tests
408 (inputs `(("zlib" ,zlib)))
409 (arguments
410 `(#:configure-flags
411 `("--with-libpotrace"))) ; install library and headers
412 (synopsis "Transform bitmaps into vector graphics")
413 (description
414 "Potrace is a tool for tracing a bitmap, which means, transforming a
415 bitmap into a smooth, scalable image. The input is a bitmap (PBM, PGM, PPM,
416 or BMP format), and the default output is an encapsulated PostScript
417 file (EPS). A typical use is to create EPS files from scanned data, such as
418 company or university logos, handwritten notes, etc. The resulting image is
419 not \"jaggy\" like a bitmap, but smooth. It can then be rendered at any
420 resolution.")
421 (license license:gpl2+)
422 (home-page "http://potrace.sourceforge.net/")))
423
424 (define-public libotf
425 (package
426 (name "libotf")
427 (version "0.9.13")
428 (source (origin
429 (method url-fetch)
430 (uri (string-append "mirror://savannah/m17n/libotf-"
431 version ".tar.gz"))
432 (sha256
433 (base32 "0239zvfan56w7vrppriwy77fzb10ag9llaz15nsraps2a2x6di3v"))))
434 (build-system gnu-build-system)
435 (propagated-inputs
436 `(("freetype" ,freetype)))
437 (home-page "http://www.nongnu.org/m17n/")
438 (synopsis "Library for handling OpenType Font")
439 (description "This library can read Open Type Layout Tables from an OTF
440 file. Currently these tables are supported; head, name, cmap, GDEF, GSUB, and
441 GPOS. It can convert a Unicode character sequence to a glyph code sequence by
442 using the above tables.")
443 (license license:lgpl2.0+)))
444
445 (define-public libspiro
446 (package
447 (name "libspiro")
448 (version "20071029")
449 (source
450 (origin
451 (method url-fetch)
452 (uri (string-append "mirror://sourceforge/libspiro/libspiro/"
453 version "/libspiro_src-" version ".tar.bz2"))
454 (sha256
455 (base32
456 "1kylz8pvwnb85yya150r9i6mhbpzx38f32qy523qg3ylgd9b3zhy"))))
457 (build-system gnu-build-system)
458 (arguments `(#:tests? #f)) ;no tests
459 (synopsis "Clothoid to bezier conversion library")
460 (description
461 "Raph Levien's Spiro package as a library. A mechanism for drawing
462 smooth contours with constant curvature at the spline joins.")
463 (license license:gpl2+)
464 (home-page "http://libspiro.sourceforge.net/")))
465
466 (define-public libuninameslist
467 (package
468 (name "libuninameslist")
469 (version "20160701")
470 (source
471 (origin
472 (method url-fetch)
473 (uri (string-append "https://github.com/fontforge/libuninameslist/"
474 "archive/" version ".tar.gz"))
475 (file-name (string-append name "-" version ".tar.gz"))
476 (sha256
477 (base32
478 "12xxb301a66dh282pywpy00wxiaq5z8z20qm3pr2vql04r2g8d0x"))))
479 (build-system gnu-build-system)
480 (native-inputs `(("autoconf" ,autoconf)
481 ("automake" ,automake)
482 ("libtool" ,libtool)))
483 (arguments
484 `(#:phases
485 (modify-phases %standard-phases
486 (add-after 'unpack 'bootstrap
487 (lambda _ (zero? (system* "autoreconf" "-vi")))))))
488 (synopsis "Unicode names and annotation list")
489 (description
490 "LibUniNamesList holds www.unicode.org Nameslist.txt data which can be
491 useful for programs that need Unicode \"Names\", \"Annotations\", and block
492 definitions.")
493 (license license:gpl2)
494 (home-page "https://github.com/fontforge/libuninameslist")))
495
496 (define-public fontforge
497 (package
498 (name "fontforge")
499 (version "20160404")
500 (source (origin
501 (method url-fetch)
502 (uri (string-append
503 "https://github.com/fontforge/fontforge/releases/download/"
504 version "/fontforge-dist-" version ".tar.gz"))
505 (sha256 (base32
506 "1kavnhbkzc1hk6f39fynq9s0haama81ddrbld4b5x60d0dbaawvc"))
507 (modules '((guix build utils)))
508 (snippet
509 '(begin
510 ;; Make builds bit-reproducible by using fixed date strings.
511 (substitute* "configure"
512 (("^FONTFORGE_MODTIME=.*$")
513 "FONTFORGE_MODTIME=\"1459819518L\"\n")
514 (("^FONTFORGE_MODTIME_STR=.*$")
515 "FONTFORGE_MODTIME_STR=\"20:25 CDT 4-Apr-2016\"\n")
516 (("^FONTFORGE_VERSIONDATE=.*$")
517 "FONTFORGE_VERSIONDATE=\"20160404\"\n"))))
518 (patches (list (search-patch "fontforge-svg-modtime.patch")))))
519 (build-system gnu-build-system)
520 (native-inputs
521 `(("pkg-config" ,pkg-config)))
522 (inputs `(("cairo" ,cairo)
523 ("fontconfig" ,fontconfig) ;dlopen'd
524 ("freetype" ,freetype)
525 ("gettext" ,gettext-minimal)
526 ("glib" ,glib) ;needed for pango detection
527 ("libICE" ,libice)
528 ("libSM" ,libsm)
529 ("libX11" ,libx11)
530 ("libXi" ,libxi)
531 ("libjpeg" ,libjpeg)
532 ("libltdl" ,libltdl)
533 ("libpng" ,libpng)
534 ("libspiro" ,libspiro)
535 ("libtiff" ,libtiff)
536 ("libungif" ,libungif)
537 ("libuninameslist" ,libuninameslist)
538 ("libxft" ,libxft)
539 ("libxml2" ,libxml2)
540 ("pango" ,pango)
541 ("potrace" ,potrace)
542 ("python" ,python)
543 ("zlib" ,zlib)))
544 (arguments
545 '(#:tests? #f
546 #:phases
547 (modify-phases %standard-phases
548 (add-after 'build 'build-contrib
549 (lambda* (#:key outputs #:allow-other-keys)
550 (let* ((out (assoc-ref outputs "out"))
551 (bin (string-append out "/bin")))
552 (and (zero? (system* "make" "-Ccontrib/fonttools"
553 "CC=gcc" "showttf"))
554 (begin (install-file "contrib/fonttools/showttf" bin)
555 #t)))))
556 (add-after 'install 'set-library-path
557 (lambda* (#:key inputs outputs #:allow-other-keys)
558 (let ((out (assoc-ref outputs "out"))
559 (potrace (string-append (assoc-ref inputs "potrace") "/bin")))
560 (wrap-program (string-append out "/bin/fontforge")
561 ;; Fontforge dynamically opens libraries.
562 `("LD_LIBRARY_PATH" ":" prefix
563 ,(map (lambda (input)
564 (string-append (assoc-ref inputs input)
565 "/lib"))
566 '("libtiff" "libjpeg" "libpng" "libungif"
567 "libxml2" "zlib" "libspiro" "freetype"
568 "pango" "cairo" "fontconfig")))
569 ;; Checks for potrace program at runtime
570 `("PATH" ":" prefix (,potrace)))))))))
571 (synopsis "Outline font editor")
572 (description
573 "FontForge allows you to create and modify postscript, truetype and
574 opentype fonts. You can save fonts in many different outline formats, and
575 generate bitmaps.")
576 (license license:gpl3+)
577 (home-page "http://fontforge.org/")))