Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-libs/fontconfig/files/, media-libs/fontconfig/
Date: Mon, 17 Sep 2018 12:29:35
Message-Id: 1537187363.35cf888ba9bb8529bb6624327e1edcaca6487d34.polynomial-c@gentoo
1 commit: 35cf888ba9bb8529bb6624327e1edcaca6487d34
2 Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
3 AuthorDate: Mon Sep 17 12:18:55 2018 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Mon Sep 17 12:29:23 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=35cf888b
7
8 media-libs/fontconfig: Bump to version 2.13.1
9
10 Package-Manager: Portage-2.3.49, Repoman-2.3.10
11
12 media-libs/fontconfig/Manifest | 1 +
13 .../files/fontconfig-2.13.1-proper_homedir.patch | 323 +++++++++++++++++++++
14 .../files/fontconfig-2.13.1-static_build.patch | 101 +++++++
15 media-libs/fontconfig/fontconfig-2.13.1.ebuild | 173 +++++++++++
16 4 files changed, 598 insertions(+)
17
18 diff --git a/media-libs/fontconfig/Manifest b/media-libs/fontconfig/Manifest
19 index de6fde79604..684dfc449fd 100644
20 --- a/media-libs/fontconfig/Manifest
21 +++ b/media-libs/fontconfig/Manifest
22 @@ -1,2 +1,3 @@
23 DIST fontconfig-2.12.6.tar.bz2 1624683 BLAKE2B 48432f3d3cc90240ec19dffb6714e7f780eb6b401693b40e2efa2bb593bc89c42b03c99fce8f2ceb7c108da254dc248d91a790849d22feaa50a725338b80fd1f SHA512 2a1d3e62cae2bfcae2e67e9cb75ab6534a35bda4215f1ad4b8bf757e77e7d9d609c016562f5288fd10046a0e94655a807f6dd044d7868ed81a146c4275c4dd06
24 DIST fontconfig-2.13.0.tar.bz2 1700500 BLAKE2B bf137b27c9f73c5e2763b7a4a443a4aa5016bd3c0e35138249c2cf8841eb364c8e7bbea6495b53b88de26e3d5a429ebfb598a9f4fe7d875028a621df592ff35a SHA512 f0ad8f2542c8b1e900f5c3d213466a31dd3785da726d6eb455b6734c71c6e5751b28172203e2f9668e9c8e1512072235ea46a1a5e6a85ec54ccc332adb4e5fbc
25 +DIST fontconfig-2.13.1.tar.bz2 1723639 BLAKE2B 08b9a522a9d89bc5e5ed0f0898182359efb110f22b6b7010f6bdda0d6d516957ea74ebe0703d684d4724fd9f44a2eaf50d8329d4e0f4e45e79f50466d808b9e1 SHA512 f97f2a9db294fd72d416a7d76dd7db5934ade2cf76903764b09e7decc33e0e2eed1a1d35c5f1c7fd9ea39e2c7653b9e65365f0c6205e047e95e38ba5000dd100
26
27 diff --git a/media-libs/fontconfig/files/fontconfig-2.13.1-proper_homedir.patch b/media-libs/fontconfig/files/fontconfig-2.13.1-proper_homedir.patch
28 new file mode 100644
29 index 00000000000..19aee94ba98
30 --- /dev/null
31 +++ b/media-libs/fontconfig/files/fontconfig-2.13.1-proper_homedir.patch
32 @@ -0,0 +1,323 @@
33 +From 806fd4c2c5164d66d978b0a4c579c157e5cbe766 Mon Sep 17 00:00:00 2001
34 +From: Akira TAGOH <akira@×××××.org>
35 +Date: Tue, 4 Sep 2018 09:08:37 +0000
36 +Subject: [PATCH] Fix the issue that '~' wasn't extracted to the proper homedir
37 +
38 +'~' in the filename was extracted to the home directory name in FcConfigFilename() though,
39 +this behavior was broken by d1f48f11. this change fixes it back to the correct behavior.
40 +
41 +https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/110
42 +diff --git a/src/fccfg.c b/src/fccfg.c
43 +index d7c48e8..4a53581 100644
44 +--- a/src/fccfg.c
45 ++++ b/src/fccfg.c
46 +@@ -2207,17 +2207,19 @@ FcConfigFilename (const FcChar8 *url)
47 + else
48 + file = 0;
49 + }
50 +-
51 +- path = FcConfigGetPath ();
52 +- if (!path)
53 +- return NULL;
54 +- for (p = path; *p; p++)
55 ++ else
56 + {
57 +- file = FcConfigFileExists (*p, url);
58 +- if (file)
59 +- break;
60 ++ path = FcConfigGetPath ();
61 ++ if (!path)
62 ++ return NULL;
63 ++ for (p = path; *p; p++)
64 ++ {
65 ++ file = FcConfigFileExists (*p, url);
66 ++ if (file)
67 ++ break;
68 ++ }
69 ++ FcConfigFreePath (path);
70 + }
71 +- FcConfigFreePath (path);
72 + return file;
73 + }
74 +
75 +diff --git a/test/Makefile.am b/test/Makefile.am
76 +index 79bcede..9f4d48a 100644
77 +--- a/test/Makefile.am
78 ++++ b/test/Makefile.am
79 +@@ -91,6 +91,22 @@ test_bz106632_CFLAGS = \
80 + test_bz106632_LDADD = $(top_builddir)/src/libfontconfig.la
81 + TESTS += test-bz106632
82 +
83 ++if !ENABLE_SHARED
84 ++check_PROGRAMS += test-issue110
85 ++test_issue110_CFLAGS = \
86 ++ -I$(top_builddir) \
87 ++ -I$(top_builddir)/src \
88 ++ -I$(top_srcdir) \
89 ++ -I$(top_srcdir)/src \
90 ++ -DHAVE_CONFIG_H \
91 ++ -DFONTCONFIG_PATH='"$(BASECONFIGDIR)"' \
92 ++ $(NULL)
93 ++test_issue110_LDADD = \
94 ++ $(top_builddir)/src/libfontconfig.la \
95 ++ $(NULL)
96 ++TESTS += test-issue110
97 ++endif
98 ++
99 + EXTRA_DIST=run-test.sh run-test-conf.sh $(TESTDATA) out.expected-long-family-names out.expected-no-long-family-names
100 +
101 + CLEANFILES=out out1 out2 fonts.conf out.expected
102 +diff --git a/test/test-issue110.c b/test/test-issue110.c
103 +new file mode 100644
104 +index 0000000..28a3bd2
105 +--- /dev/null
106 ++++ b/test/test-issue110.c
107 +@@ -0,0 +1,245 @@
108 ++/*
109 ++ * fontconfig/test/test-issue110.c
110 ++ *
111 ++ * Copyright © 2000 Keith Packard
112 ++ * Copyright © 2018 Akira TAGOH
113 ++ *
114 ++ * Permission to use, copy, modify, distribute, and sell this software and its
115 ++ * documentation for any purpose is hereby granted without fee, provided that
116 ++ * the above copyright notice appear in all copies and that both that
117 ++ * copyright notice and this permission notice appear in supporting
118 ++ * documentation, and that the name of the author(s) not be used in
119 ++ * advertising or publicity pertaining to distribution of the software without
120 ++ * specific, written prior permission. The authors make no
121 ++ * representations about the suitability of this software for any purpose. It
122 ++ * is provided "as is" without express or implied warranty.
123 ++ *
124 ++ * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
125 ++ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
126 ++ * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
127 ++ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
128 ++ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
129 ++ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
130 ++ * PERFORMANCE OF THIS SOFTWARE.
131 ++ */
132 ++#ifdef HAVE_CONFIG_H
133 ++#include "config.h"
134 ++#endif
135 ++#include <stdio.h>
136 ++#include <stdlib.h>
137 ++#include <string.h>
138 ++#include <dirent.h>
139 ++#include <unistd.h>
140 ++#include <errno.h>
141 ++#ifndef HAVE_STRUCT_DIRENT_D_TYPE
142 ++#include <sys/types.h>
143 ++#include <sys/stat.h>
144 ++#endif
145 ++#include <fontconfig/fontconfig.h>
146 ++
147 ++#ifdef _WIN32
148 ++# define FC_DIR_SEPARATOR '\\'
149 ++# define FC_DIR_SEPARATOR_S "\\"
150 ++#else
151 ++# define FC_DIR_SEPARATOR '/'
152 ++# define FC_DIR_SEPARATOR_S "/"
153 ++#endif
154 ++
155 ++extern FcChar8 *FcConfigRealFilename (FcConfig *, FcChar8 *);
156 ++
157 ++#ifdef HAVE_MKDTEMP
158 ++#define fc_mkdtemp mkdtemp
159 ++#else
160 ++char *
161 ++fc_mkdtemp (char *template)
162 ++{
163 ++ if (!mktemp (template) || mkdir (template, 0700))
164 ++ return NULL;
165 ++
166 ++ return template;
167 ++}
168 ++#endif
169 ++
170 ++FcBool
171 ++mkdir_p (const char *dir)
172 ++{
173 ++ char *parent;
174 ++ FcBool ret;
175 ++
176 ++ if (strlen (dir) == 0)
177 ++ return FcFalse;
178 ++ parent = (char *) FcStrDirname ((const FcChar8 *) dir);
179 ++ if (!parent)
180 ++ return FcFalse;
181 ++ if (access (parent, F_OK) == 0)
182 ++ ret = mkdir (dir, 0755) == 0 && chmod (dir, 0755) == 0;
183 ++ else if (access (parent, F_OK) == -1)
184 ++ ret = mkdir_p (parent) && (mkdir (dir, 0755) == 0) && chmod (dir, 0755) == 0;
185 ++ else
186 ++ ret = FcFalse;
187 ++ free (parent);
188 ++
189 ++ return ret;
190 ++}
191 ++
192 ++FcBool
193 ++unlink_dirs (const char *dir)
194 ++{
195 ++ DIR *d = opendir (dir);
196 ++ struct dirent *e;
197 ++ size_t len = strlen (dir);
198 ++ char *n = NULL;
199 ++ FcBool ret = FcTrue;
200 ++#ifndef HAVE_STRUCT_DIRENT_D_TYPE
201 ++ struct stat statb;
202 ++#endif
203 ++
204 ++ if (!d)
205 ++ return FcFalse;
206 ++ while ((e = readdir (d)) != NULL)
207 ++ {
208 ++ size_t l;
209 ++
210 ++ if (strcmp (e->d_name, ".") == 0 ||
211 ++ strcmp (e->d_name, "..") == 0)
212 ++ continue;
213 ++ l = strlen (e->d_name) + 1;
214 ++ if (n)
215 ++ free (n);
216 ++ n = malloc (l + len + 1);
217 ++ if (!n)
218 ++ {
219 ++ ret = FcFalse;
220 ++ break;
221 ++ }
222 ++ strcpy (n, dir);
223 ++ n[len] = FC_DIR_SEPARATOR;
224 ++ strcpy (&n[len + 1], e->d_name);
225 ++#ifdef HAVE_STRUCT_DIRENT_D_TYPE
226 ++ if (e->d_type == DT_DIR)
227 ++#else
228 ++ if (stat (n, &statb) == -1)
229 ++ {
230 ++ fprintf (stderr, "E: %s\n", n);
231 ++ ret = FcFalse;
232 ++ break;
233 ++ }
234 ++ if (S_ISDIR (statb.st_mode))
235 ++#endif
236 ++ {
237 ++ if (!unlink_dirs (n))
238 ++ {
239 ++ fprintf (stderr, "E: %s\n", n);
240 ++ ret = FcFalse;
241 ++ break;
242 ++ }
243 ++ }
244 ++ else
245 ++ {
246 ++ if (unlink (n) == -1)
247 ++ {
248 ++ fprintf (stderr, "E: %s\n", n);
249 ++ ret = FcFalse;
250 ++ break;
251 ++ }
252 ++ }
253 ++ }
254 ++ if (n)
255 ++ free (n);
256 ++ closedir (d);
257 ++
258 ++ if (rmdir (dir) == -1)
259 ++ {
260 ++ fprintf (stderr, "E: %s\n", dir);
261 ++ return FcFalse;
262 ++ }
263 ++
264 ++ return ret;
265 ++}
266 ++
267 ++int
268 ++main(void)
269 ++{
270 ++ FcConfig *cfg = FcConfigCreate ();
271 ++ char *basedir, template[512] = "/tmp/fc110-XXXXXX";
272 ++ char *sysroot, systempl[512] = "/tmp/fc110-XXXXXX";
273 ++ FcChar8 *d = NULL;
274 ++ FcChar8 *ret = NULL;
275 ++ FcChar8 *s = NULL;
276 ++ FILE *fp;
277 ++ int retval = 0;
278 ++
279 ++ retval++;
280 ++ basedir = fc_mkdtemp (template);
281 ++ if (!basedir)
282 ++ {
283 ++ fprintf (stderr, "%s: %s\n", template, strerror (errno));
284 ++ goto bail;
285 ++ }
286 ++ retval++;
287 ++ sysroot = fc_mkdtemp (systempl);
288 ++ if (!sysroot)
289 ++ {
290 ++ fprintf (stderr, "%s: %s\n", systempl, strerror (errno));
291 ++ goto bail;
292 ++ }
293 ++ fprintf (stderr, "D: Creating %s\n", basedir);
294 ++ mkdir_p (basedir);
295 ++ setenv ("HOME", basedir, 1);
296 ++ retval++;
297 ++ s = FcStrBuildFilename (basedir, ".fonts.conf", NULL);
298 ++ if (!s)
299 ++ goto bail;
300 ++ retval++;
301 ++ fprintf (stderr, "D: Creating %s\n", s);
302 ++ if ((fp = fopen (s, "wb")) == NULL)
303 ++ goto bail;
304 ++ fprintf (fp, "%s", s);
305 ++ fclose (fp);
306 ++ retval++;
307 ++ fprintf (stderr, "D: Checking file path\n");
308 ++ ret = FcConfigRealFilename (cfg, "~/.fonts.conf");
309 ++ if (!ret)
310 ++ goto bail;
311 ++ retval++;
312 ++ if (strcmp ((const char *) s, (const char *) ret) != 0)
313 ++ goto bail;
314 ++ free (ret);
315 ++ free (s);
316 ++ setenv ("FONTCONFIG_SYSROOT", sysroot, 1);
317 ++ fprintf (stderr, "D: Creating %s\n", sysroot);
318 ++ mkdir_p (sysroot);
319 ++ retval++;
320 ++ d = FcStrBuildFilename (sysroot, basedir, NULL);
321 ++ fprintf (stderr, "D: Creating %s\n", d);
322 ++ mkdir_p (d);
323 ++ free (d);
324 ++ s = FcStrBuildFilename (sysroot, basedir, ".fonts.conf", NULL);
325 ++ if (!s)
326 ++ goto bail;
327 ++ retval++;
328 ++ fprintf (stderr, "D: Creating %s\n", s);
329 ++ if ((fp = fopen (s, "wb")) == NULL)
330 ++ goto bail;
331 ++ fprintf (fp, "%s", s);
332 ++ fclose (fp);
333 ++ retval++;
334 ++ fprintf (stderr, "D: Checking file path\n");
335 ++ ret = FcConfigRealFilename (cfg, "~/.fonts.conf");
336 ++ if (!ret)
337 ++ goto bail;
338 ++ retval++;
339 ++ if (strcmp ((const char *) s, (const char *) ret) != 0)
340 ++ goto bail;
341 ++ retval = 0;
342 ++bail:
343 ++ fprintf (stderr, "Cleaning up\n");
344 ++ unlink_dirs (basedir);
345 ++ if (ret)
346 ++ free (ret);
347 ++ if (s)
348 ++ free (s);
349 ++
350 ++ return retval;
351 ++}
352 ++
353 +--
354 +2.18.0
355 +
356
357 diff --git a/media-libs/fontconfig/files/fontconfig-2.13.1-static_build.patch b/media-libs/fontconfig/files/fontconfig-2.13.1-static_build.patch
358 new file mode 100644
359 index 00000000000..7a0edfd849a
360 --- /dev/null
361 +++ b/media-libs/fontconfig/files/fontconfig-2.13.1-static_build.patch
362 @@ -0,0 +1,101 @@
363 +From 8208f99fa1676c42bfd8d74de3e9dac5366c150c Mon Sep 17 00:00:00 2001
364 +From: Akira TAGOH <akira@×××××.org>
365 +Date: Mon, 3 Sep 2018 04:56:16 +0000
366 +Subject: [PATCH] Fix the build issue with --enable-static
367 +
368 +Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/109
369 +---
370 +diff --git a/fontconfig/fontconfig.h b/fontconfig/fontconfig.h
371 +index bac1dda..af870d0 100644
372 +--- a/fontconfig/fontconfig.h
373 ++++ b/fontconfig/fontconfig.h
374 +@@ -1076,6 +1076,10 @@ FcUtf16Len (const FcChar8 *string,
375 + int *nchar,
376 + int *wchar);
377 +
378 ++FcPublic FcChar8 *
379 ++FcStrBuildFilename (const FcChar8 *path,
380 ++ ...);
381 ++
382 + FcPublic FcChar8 *
383 + FcStrDirname (const FcChar8 *file);
384 +
385 +diff --git a/src/fcint.h b/src/fcint.h
386 +index de78cd8..a9d075a 100644
387 +--- a/src/fcint.h
388 ++++ b/src/fcint.h
389 +@@ -1282,10 +1282,6 @@ FcStrUsesHome (const FcChar8 *s);
390 + FcPrivate FcBool
391 + FcStrIsAbsoluteFilename (const FcChar8 *s);
392 +
393 +-FcPrivate FcChar8 *
394 +-FcStrBuildFilename (const FcChar8 *path,
395 +- ...);
396 +-
397 + FcPrivate FcChar8 *
398 + FcStrLastSlash (const FcChar8 *path);
399 +
400 +diff --git a/test/test-bz106632.c b/test/test-bz106632.c
401 +index daa0c1e..2d67c2e 100644
402 +--- a/test/test-bz106632.c
403 ++++ b/test/test-bz106632.c
404 +@@ -25,25 +25,26 @@
405 + #ifdef HAVE_CONFIG_H
406 + #include "config.h"
407 + #endif
408 ++#include <stdio.h>
409 + #include <stdlib.h>
410 ++#include <string.h>
411 + #include <dirent.h>
412 ++#include <unistd.h>
413 ++#include <errno.h>
414 + #ifndef HAVE_STRUCT_DIRENT_D_TYPE
415 + #include <sys/types.h>
416 + #include <sys/stat.h>
417 +-#include <unistd.h>
418 + #endif
419 +-#include "fcstr.c"
420 +-#undef FcConfigBuildFonts
421 +-#undef FcConfigCreate
422 +-#undef FcConfigGetCurrent
423 +-#undef FcConfigParseAndLoadFromMemory
424 +-#undef FcConfigUptoDate
425 +-#undef FcFontList
426 +-#undef FcInitReinitialize
427 +-#undef FcPatternCreate
428 +-#undef FcPatternDestroy
429 + #include <fontconfig/fontconfig.h>
430 +
431 ++#ifdef _WIN32
432 ++# define FC_DIR_SEPARATOR '\\'
433 ++# define FC_DIR_SEPARATOR_S "\\"
434 ++#else
435 ++# define FC_DIR_SEPARATOR '/'
436 ++# define FC_DIR_SEPARATOR_S "/"
437 ++#endif
438 ++
439 + #ifdef HAVE_MKDTEMP
440 + #define fc_mkdtemp mkdtemp
441 + #else
442 +@@ -154,18 +155,6 @@ unlink_dirs (const char *dir)
443 + return ret;
444 + }
445 +
446 +-FcChar8 *
447 +-FcLangNormalize (const FcChar8 *lang)
448 +-{
449 +- return NULL;
450 +-}
451 +-
452 +-FcChar8 *
453 +-FcConfigHome (void)
454 +-{
455 +- return NULL;
456 +-}
457 +-
458 + int
459 + main (void)
460 + {
461 +--
462 +2.18.0
463 +
464
465 diff --git a/media-libs/fontconfig/fontconfig-2.13.1.ebuild b/media-libs/fontconfig/fontconfig-2.13.1.ebuild
466 new file mode 100644
467 index 00000000000..3b995391a94
468 --- /dev/null
469 +++ b/media-libs/fontconfig/fontconfig-2.13.1.ebuild
470 @@ -0,0 +1,173 @@
471 +# Copyright 1999-2018 Gentoo Foundation
472 +# Distributed under the terms of the GNU General Public License v2
473 +
474 +EAPI=7
475 +
476 +inherit autotools multilib-minimal readme.gentoo-r1
477 +
478 +DESCRIPTION="A library for configuring and customizing font access"
479 +HOMEPAGE="https://fontconfig.org/"
480 +SRC_URI="https://fontconfig.org/release/${P}.tar.bz2"
481 +
482 +LICENSE="MIT"
483 +SLOT="1.0"
484 +[[ $(ver_cut 3) -ge 90 ]] || \
485 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
486 +IUSE="doc static-libs"
487 +
488 +# Purposefully dropped the xml USE flag and libxml2 support. Expat is the
489 +# default and used by every distro. See bug #283191.
490 +RDEPEND=">=dev-libs/expat-2.1.0-r3[${MULTILIB_USEDEP}]
491 + >=media-libs/freetype-2.9[${MULTILIB_USEDEP}]
492 + !elibc_Darwin? ( sys-apps/util-linux[${MULTILIB_USEDEP}] )
493 + elibc_Darwin? ( sys-libs/native-uuid )
494 + virtual/libintl[${MULTILIB_USEDEP}]"
495 +DEPEND="${RDEPEND}
496 + virtual/pkgconfig
497 + dev-util/gperf
498 + >=sys-devel/gettext-0.19.8
499 + doc? ( =app-text/docbook-sgml-dtd-3.1*
500 + app-text/docbook-sgml-utils[jadetex] )"
501 +PDEPEND="!x86-winnt? ( app-eselect/eselect-fontconfig )
502 + virtual/ttf-fonts"
503 +
504 +PATCHES=(
505 + "${FILESDIR}"/${PN}-2.10.2-docbook.patch # 310157
506 + "${FILESDIR}"/${PN}-2.12.3-latin-update.patch # 130466 + make liberation default
507 +
508 + # Patches from upstream (can usually be removed with next version bump)
509 + #"${FILESDIR}"/${P}-static_build.patch
510 + "${FILESDIR}"/${P}-proper_homedir.patch
511 +)
512 +
513 +MULTILIB_CHOST_TOOLS=( /usr/bin/fc-cache$(get_exeext) )
514 +
515 +pkg_setup() {
516 + DOC_CONTENTS="Please make fontconfig configuration changes using
517 + \`eselect fontconfig\`. Any changes made to /etc/fonts/fonts.conf will be
518 + overwritten. If you need to reset your configuration to upstream defaults,
519 + delete the directory ${EROOT%/}/etc/fonts/conf.d/ and re-emerge fontconfig."
520 +}
521 +
522 +src_prepare() {
523 + default
524 + eautoreconf
525 +}
526 +
527 +multilib_src_configure() {
528 + local addfonts
529 + # harvest some font locations, such that users can benefit from the
530 + # host OS's installed fonts
531 + case ${CHOST} in
532 + *-darwin*)
533 + addfonts=",/Library/Fonts,/System/Library/Fonts"
534 + ;;
535 + *-solaris*)
536 + [[ -d /usr/X/lib/X11/fonts/TrueType ]] && \
537 + addfonts=",/usr/X/lib/X11/fonts/TrueType"
538 + [[ -d /usr/X/lib/X11/fonts/Type1 ]] && \
539 + addfonts="${addfonts},/usr/X/lib/X11/fonts/Type1"
540 + ;;
541 + *-linux-gnu)
542 + use prefix && [[ -d /usr/share/fonts ]] && \
543 + addfonts=",/usr/share/fonts"
544 + ;;
545 + esac
546 +
547 + local myeconfargs=(
548 + $(use_enable doc docbook)
549 + $(use_enable static-libs static)
550 + --enable-docs
551 + --localstatedir="${EPREFIX}"/var
552 + --with-default-fonts="${EPREFIX}"/usr/share/fonts
553 + --with-add-fonts="${EPREFIX}/usr/local/share/fonts${addfonts}"
554 + --with-templatedir="${EPREFIX}"/etc/fonts/conf.avail
555 + )
556 +
557 + ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
558 +
559 + # Ugly hackaround to prevent build failure
560 + find "${BUILD_DIR}" -name "Makefile" -print0 \
561 + | xargs --null sed 's@ FcStrBuildFilename\.3@@' -i \
562 + || die
563 +}
564 +
565 +multilib_src_install() {
566 + default
567 +
568 + # avoid calling this multiple times, bug #459210
569 + if multilib_is_native_abi; then
570 + # stuff installed from build-dir
571 + emake -C doc DESTDIR="${D}" install-man
572 +
573 + insinto /etc/fonts
574 + doins fonts.conf
575 + fi
576 +}
577 +
578 +multilib_src_install_all() {
579 + einstalldocs
580 + find "${ED}" -name "*.la" -delete || die
581 +
582 + # fc-lang directory contains language coverage datafiles
583 + # which are needed to test the coverage of fonts.
584 + insinto /usr/share/fc-lang
585 + doins fc-lang/*.orth
586 +
587 + dodoc doc/fontconfig-user.{txt,pdf}
588 +
589 + if [[ -e ${ED}usr/share/doc/fontconfig/ ]]; then
590 + mv "${ED}"usr/share/doc/fontconfig/* "${ED}"/usr/share/doc/${P} || die
591 + rm -rf "${ED}"usr/share/doc/fontconfig
592 + fi
593 +
594 + # Changes should be made to /etc/fonts/local.conf, and as we had
595 + # too much problems with broken fonts.conf we force update it ...
596 + echo 'CONFIG_PROTECT_MASK="/etc/fonts/fonts.conf"' > "${T}"/37fontconfig
597 + doenvd "${T}"/37fontconfig
598 +
599 + # As of fontconfig 2.7, everything sticks their noses in here.
600 + dodir /etc/sandbox.d
601 + echo 'SANDBOX_PREDICT="/var/cache/fontconfig"' > "${ED}"/etc/sandbox.d/37fontconfig
602 +
603 + readme.gentoo_create_doc
604 +
605 + keepdir /var/cache/${PN}
606 +}
607 +
608 +pkg_preinst() {
609 + # Bug #193476
610 + # /etc/fonts/conf.d/ contains symlinks to ../conf.avail/ to include various
611 + # config files. If we install as-is, we'll blow away user settings.
612 + ebegin "Syncing fontconfig configuration to system"
613 + if [[ -e ${EROOT}/etc/fonts/conf.d ]]; then
614 + for file in "${EROOT}"/etc/fonts/conf.avail/*; do
615 + f=${file##*/}
616 + if [[ -L ${EROOT}/etc/fonts/conf.d/${f} ]]; then
617 + [[ -f ${ED}etc/fonts/conf.avail/${f} ]] \
618 + && ln -sf ../conf.avail/"${f}" "${ED}"etc/fonts/conf.d/ &>/dev/null
619 + else
620 + [[ -f ${ED}etc/fonts/conf.avail/${f} ]] \
621 + && rm "${ED}"etc/fonts/conf.d/"${f}" &>/dev/null
622 + fi
623 + done
624 + fi
625 + eend $?
626 +}
627 +
628 +pkg_postinst() {
629 + einfo "Cleaning broken symlinks in ${EROOT%/}/etc/fonts/conf.d/"
630 + find -L "${EROOT}"etc/fonts/conf.d/ -type l -delete
631 +
632 + readme.gentoo_print_elog
633 +
634 + if [[ ${ROOT} = / ]]; then
635 + multilib_pkg_postinst() {
636 + ebegin "Creating global font cache for ${ABI}"
637 + "${EPREFIX}"/usr/bin/${CHOST}-fc-cache -srf
638 + eend $?
639 + }
640 +
641 + multilib_parallel_foreach_abi multilib_pkg_postinst
642 + fi
643 +}