all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] gnu: fontconfig: Fix for PATH_MAX.
@ 2017-03-02  1:34 rennes
  2017-03-02 15:21 ` Manolis Ragkousis
  0 siblings, 1 reply; 4+ messages in thread
From: rennes @ 2017-03-02  1:34 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 154 bytes --]

Hello,

This patch for fontconfig was accepted in upstream!.

The patch fix the error on build phase, because PATH_MAX is not defined 
on GNU/Hurd.
Thanks

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-fontconfig-Fix-for-PATH_MAX.patch --]
[-- Type: text/x-diff; name=0001-gnu-fontconfig-Fix-for-PATH_MAX.patch, Size: 9871 bytes --]

From f1746b8be0fade9cc759715aa5f80375c3abd19a Mon Sep 17 00:00:00 2001
From: rennes <rennes@openmailbox.org>
Date: Wed, 1 Mar 2017 19:19:01 -0600
Subject: [PATCH] gnu: fontconfig: Fix for PATH_MAX.

* gnu/packages/patches/fontconfig-path-max.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
---
 gnu/local.mk                                   |   3 +-
 gnu/packages/fontutils.scm                     |  90 +++++++++---------
 gnu/packages/patches/fontconfig-path-max.patch | 124 +++++++++++++++++++++++++
 3 files changed, 172 insertions(+), 45 deletions(-)
 create mode 100644 gnu/packages/patches/fontconfig-path-max.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index f356a124b..dd0ff795e 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -5,7 +5,7 @@
 # Copyright © 2013, 2014, 2015, 2016 Mark H Weaver <mhw@netris.org>
 # Copyright © 2016 Chris Marusich <cmmarusich@gmail.com>
 # Copyright © 2016, 2017 Kei Kebreau <kei@openmailbox.org>
-# Copyright © 2016 Rene Saavedra <rennes@openmailbox.org>
+# Copyright © 2016, 2017 Rene Saavedra <rennes@openmailbox.org>
 # Copyright © 2016 Adonay "adfeno" Felipe Nogueira <https://libreplanet.org/wiki/User:Adfeno> <adfeno@openmailbox.org>
 # Copyright © 2016, 2017 Ricardo Wurmus <rekado@elephly.net>
 # Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com>
@@ -556,6 +556,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/flint-ldconfig.patch			\
   %D%/packages/patches/fltk-shared-lib-defines.patch		\
   %D%/packages/patches/fltk-xfont-on-demand.patch		\
+  %D%/packages/patches/fontconfig-path-max.patch		\
   %D%/packages/patches/fontforge-svg-modtime.patch		\
   %D%/packages/patches/freeimage-CVE-2015-0852.patch		\
   %D%/packages/patches/freeimage-CVE-2016-5684.patch		\
diff --git a/gnu/packages/fontutils.scm b/gnu/packages/fontutils.scm
index 15109bfe1..6420af50e 100644
--- a/gnu/packages/fontutils.scm
+++ b/gnu/packages/fontutils.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2014, 2016 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2016 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2017 Rene Saavedra <rennes@openmailbox.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -222,47 +223,48 @@ fonts to/from the WOFF2 format.")
 
 (define-public fontconfig
   (package
-   (name "fontconfig")
-   (version "2.12.1")
-   (source (origin
-            (method url-fetch)
-            (uri (string-append
-                   "https://www.freedesktop.org/software/fontconfig/release/fontconfig-"
-                   version ".tar.bz2"))
-            (sha256 (base32
-                     "1wy7svvp7df6bjpg1m5vizb3ngd7rhb20vpclv3x3qa71khs6jdl"))))
-   (build-system gnu-build-system)
-   (propagated-inputs `(("expat" ,expat)
-                        ("freetype" ,freetype)))
-   (inputs `(("gs-fonts" ,gs-fonts)))
-   (native-inputs
-      `(("pkg-config" ,pkg-config)))
-   (arguments
-    `(#:configure-flags
-      (list "--with-cache-dir=/var/cache/fontconfig"
-            ;; register gs-fonts as default fonts
-            (string-append "--with-default-fonts="
-                           (assoc-ref %build-inputs "gs-fonts")
-                           "/share/fonts")
-
-            ;; Register fonts from user and system profiles.
-            (string-append "--with-add-fonts="
-                           "~/.guix-profile/share/fonts,"
-                           "/run/current-system/profile/share/fonts")
-
-            ;; python is not actually needed
-            "PYTHON=false")
-      #:phases
-      (modify-phases %standard-phases
-        (replace 'install
-                 (lambda _
-                   ;; Don't try to create /var/cache/fontconfig.
-                   (zero? (system* "make" "install"
-                                   "fc_cachedir=$(TMPDIR)"
-                                   "RUN_FC_CACHE_TEST=false")))))))
-   (synopsis "Library for configuring and customizing font access")
-   (description
-    "Fontconfig can discover new fonts when installed automatically;
+    (name "fontconfig")
+    (version "2.12.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://www.freedesktop.org/software/fontconfig/release/fontconfig-"
+                    version ".tar.bz2"))
+              (sha256 (base32
+                       "1wy7svvp7df6bjpg1m5vizb3ngd7rhb20vpclv3x3qa71khs6jdl"))
+              (patches (list (search-patch "fontconfig-path-max.patch")))))
+    (build-system gnu-build-system)
+    (propagated-inputs `(("expat" ,expat)
+                         ("freetype" ,freetype)))
+    (inputs `(("gs-fonts" ,gs-fonts)))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (arguments
+     `(#:configure-flags
+       (list "--with-cache-dir=/var/cache/fontconfig"
+             ;; register gs-fonts as default fonts
+             (string-append "--with-default-fonts="
+                            (assoc-ref %build-inputs "gs-fonts")
+                            "/share/fonts")
+             
+             ;; Register fonts from user and system profiles.
+             (string-append "--with-add-fonts="
+                            "~/.guix-profile/share/fonts,"
+                            "/run/current-system/profile/share/fonts")
+             
+             ;; python is not actually needed
+             "PYTHON=false")
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'install
+                  (lambda _
+                    ;; Don't try to create /var/cache/fontconfig.
+                    (zero? (system* "make" "install"
+                                    "fc_cachedir=$(TMPDIR)"
+                                    "RUN_FC_CACHE_TEST=false")))))))
+    (synopsis "Library for configuring and customizing font access")
+    (description
+     "Fontconfig can discover new fonts when installed automatically;
 perform font name substitution, so that appropriate alternative fonts can
 be selected if fonts are missing;
 identify the set of fonts required to completely cover a set of languages;
@@ -271,9 +273,9 @@ efficiently and quickly find needed fonts among the set of installed fonts;
 be used in concert with the X Render Extension and FreeType to implement
 high quality, anti-aliased and subpixel rendered text on a display.")
    ; The exact license is more X11-style than BSD-style.
-   (license (license:non-copyleft "file://COPYING"
-                       "See COPYING in the distribution."))
-   (home-page "http://www.freedesktop.org/wiki/Software/fontconfig")))
+    (license (license:non-copyleft "file://COPYING"
+                                   "See COPYING in the distribution."))
+    (home-page "http://www.freedesktop.org/wiki/Software/fontconfig")))
 
 (define-public t1lib
   (package
diff --git a/gnu/packages/patches/fontconfig-path-max.patch b/gnu/packages/patches/fontconfig-path-max.patch
new file mode 100644
index 000000000..e12f60ef0
--- /dev/null
+++ b/gnu/packages/patches/fontconfig-path-max.patch
@@ -0,0 +1,124 @@
+This patch fix the build on GNU/Hurd, due to PATH_MAX isn't defined.
+
+The patch was adapted from upstream source repository:
+'<https://cgit.freedesktop.org/fontconfig/commit/?id=abdb6d658e1a16410dd1c964e365a3ebd5039e7c>'
+Commit: abdb6d658e1a16410dd1c964e365a3ebd5039e7c
+
+---
+ src/fcdefault.c | 34 +++++++++++++++++++++++++++-------
+ src/fcint.h     |  6 ++++++
+ src/fcstat.c    | 12 +++++++++++-
+ 3 files changed, 44 insertions(+), 8 deletions(-)
+
+diff --git a/src/fcdefault.c b/src/fcdefault.c
+index 6647a8f..5afd7ec 100644
+--- a/src/fcdefault.c
++++ b/src/fcdefault.c
+@@ -148,17 +148,34 @@ retry:
+ 	    prgname = FcStrdup ("");
+ #else
+ # if defined (HAVE_GETEXECNAME)
+-	const char *p = getexecname ();
++	char *p = FcStrdup(getexecname ());
+ # elif defined (HAVE_READLINK)
+-	char buf[PATH_MAX + 1];
+-	int len;
++	size_t size = FC_PATH_MAX;
+ 	char *p = NULL;
+ 
+-	len = readlink ("/proc/self/exe", buf, sizeof (buf) - 1);
+-	if (len != -1)
++	while (1)
+ 	{
+-	    buf[len] = '\0';
+-	    p = buf;
++	    char *buf = malloc (size);
++	    ssize_t len;
++
++	    if (!buf)
++		break;
++
++	    len = readlink ("/proc/self/exe", buf, size - 1);
++	    if (len < 0)
++	    {
++		free (buf);
++		break;
++	    }
++	    if (len < size - 1)
++	    {
++		buf[len] = 0;
++		p = buf;
++		break;
++	    }
++
++	    free (buf);
++	    size *= 2;
+ 	}
+ # else
+ 	char *p = NULL;
+@@ -176,6 +193,9 @@ retry:
+ 
+ 	if (!prgname)
+ 	    prgname = FcStrdup ("");
++
++	if (p)
++	    free (p);
+ #endif
+ 
+ 	if (!fc_atomic_ptr_cmpexch (&default_prgname, NULL, prgname)) {
+diff --git a/src/fcint.h b/src/fcint.h
+index ac911ad..dad34c5 100644
+--- a/src/fcint.h
++++ b/src/fcint.h
+@@ -70,6 +70,12 @@ extern pfnSHGetFolderPathA pSHGetFolderPathA;
+ #  define FC_DIR_SEPARATOR_S       "/"
+ #endif
+ 
++#ifdef PATH_MAX
++#define FC_PATH_MAX	PATH_MAX
++#else
++#define FC_PATH_MAX	128
++#endif
++
+ #if __GNUC__ >= 4
+ #define FC_UNUSED	__attribute__((unused))
+ #else
+diff --git a/src/fcstat.c b/src/fcstat.c
+index 1734fa4..f6e1aaa 100644
+--- a/src/fcstat.c
++++ b/src/fcstat.c
+@@ -278,8 +278,13 @@ FcDirChecksum (const FcChar8 *dir, time_t *checksum)
+ 	{
+ #endif
+ 	struct stat statb;
+-	char f[PATH_MAX + 1];
++	char *f = malloc (len + 1 + dlen + 1);
+ 
++	if (!f)
++	{
++	    ret = -1;
++	    goto bail;
++	}
+ 	memcpy (f, dir, len);
+ 	f[len] = FC_DIR_SEPARATOR;
+ 	memcpy (&f[len + 1], files[n]->d_name, dlen);
+@@ -287,11 +292,16 @@ FcDirChecksum (const FcChar8 *dir, time_t *checksum)
+ 	if (lstat (f, &statb) < 0)
+ 	{
+ 	    ret = -1;
++	    free (f);
+ 	    goto bail;
+ 	}
+ 	if (S_ISDIR (statb.st_mode))
++	{
++	    free (f);
+ 	    goto bail;
++	}
+ 
++	free (f);
+ 	dtype = statb.st_mode;
+ #ifdef HAVE_STRUCT_DIRENT_D_TYPE
+ 	}
+-- 
+2.11.0
+
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gnu: fontconfig: Fix for PATH_MAX.
  2017-03-02  1:34 [PATCH] gnu: fontconfig: Fix for PATH_MAX rennes
@ 2017-03-02 15:21 ` Manolis Ragkousis
  2017-03-06 21:25   ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Manolis Ragkousis @ 2017-03-02 15:21 UTC (permalink / raw)
  To: rennes; +Cc: guix-devel

Hello Rene,

I added a line in your commit message saying in which file you apply the
patch and also removed all the one space indentation changes, with the
purpose of making the patch more clear.

I pushed it in core-updates.

Thank you for working on this!
Manolis

On 03/02/2017 03:34 AM, rennes@openmailbox.org wrote:
> Hello,
> 
> This patch for fontconfig was accepted in upstream!.
> 
> The patch fix the error on build phase, because PATH_MAX is not defined
> on GNU/Hurd.
> Thanks

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gnu: fontconfig: Fix for PATH_MAX.
  2017-03-02 15:21 ` Manolis Ragkousis
@ 2017-03-06 21:25   ` Ludovic Courtès
  2017-03-10 14:14     ` Manolis Ragkousis
  0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2017-03-06 21:25 UTC (permalink / raw)
  To: Manolis Ragkousis; +Cc: guix-devel, rennes

Hi,

Manolis Ragkousis <manolis837@gmail.com> skribis:

> I added a line in your commit message saying in which file you apply the
> patch and also removed all the one space indentation changes, with the
> purpose of making the patch more clear.
>
> I pushed it in core-updates.

Right in time, thanks.  :-)

BTW, I’d encourage you to team up with the Debian folks so that all the
PATH_MAX patches end up upstream.  Otherwise they’ll end up occupying
half of our repo.  ;-)

Ludo’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gnu: fontconfig: Fix for PATH_MAX.
  2017-03-06 21:25   ` Ludovic Courtès
@ 2017-03-10 14:14     ` Manolis Ragkousis
  0 siblings, 0 replies; 4+ messages in thread
From: Manolis Ragkousis @ 2017-03-10 14:14 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel, rennes

Hello Ludo,

On 03/06/2017 11:25 PM, Ludovic Courtès wrote:
> 
> BTW, I’d encourage you to team up with the Debian folks so that all the
> PATH_MAX patches end up upstream.  Otherwise they’ll end up occupying
> half of our repo.  ;-)

Thank to Rene's effort this one is already in upstream :). Next time
fontconfig has a new release we will remove this patch.

Manolis

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-10 14:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-02  1:34 [PATCH] gnu: fontconfig: Fix for PATH_MAX rennes
2017-03-02 15:21 ` Manolis Ragkousis
2017-03-06 21:25   ` Ludovic Courtès
2017-03-10 14:14     ` Manolis Ragkousis

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.