[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
75/89: gnu: ghostscript: Fix build for the Hurd.
From: |
guix-commits |
Subject: |
75/89: gnu: ghostscript: Fix build for the Hurd. |
Date: |
Tue, 20 Jun 2023 05:59:02 -0400 (EDT) |
janneke pushed a commit to branch hurd-team
in repository guix.
commit 38278e94f9ce3513bccb78cdedb00a7d9bdd9a39
Author: Janneke Nieuwenhuizen <janneke@gnu.org>
AuthorDate: Tue Jun 13 12:41:08 2023 +0200
gnu: ghostscript: Fix build for the Hurd.
* gnu/packages/patches/ghostscript-leptonica-hurd.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/ghostscript.scm (ghostscript)[arguments]: When building for
the
Hurd, add phase 'patch-leptonica' and use it.
---
gnu/local.mk | 1 +
gnu/packages/ghostscript.scm | 10 +++
.../patches/ghostscript-leptonica-hurd.patch | 78 ++++++++++++++++++++++
3 files changed, 89 insertions(+)
diff --git a/gnu/local.mk b/gnu/local.mk
index 2b063d9571..4a7c81abe9 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1235,6 +1235,7 @@ dist_patch_DATA =
\
%D%/packages/patches/ghc-bloomfilter-ghc9.2.patch \
%D%/packages/patches/ghc-bytestring-handle-ghc9.patch \
%D%/packages/patches/ghc-language-haskell-extract-ghc-8.10.patch \
+ %D%/packages/patches/ghostscript-leptonica-hurd.patch \
%D%/packages/patches/ghostscript-no-header-id.patch \
%D%/packages/patches/ghostscript-no-header-uuid.patch \
%D%/packages/patches/ghostscript-no-header-creationdate.patch \
diff --git a/gnu/packages/ghostscript.scm b/gnu/packages/ghostscript.scm
index 69d8b01198..e4769b29a2 100644
--- a/gnu/packages/ghostscript.scm
+++ b/gnu/packages/ghostscript.scm
@@ -200,6 +200,16 @@ printing, and psresize, for adjusting page sizes.")
'()))
#:phases
#~(modify-phases %standard-phases
+ #$@(if (target-hurd?)
+ #~((add-after 'unpack 'patch-leptonica
+ (lambda _
+ (let ((patch-file
+ #$(local-file
+ (search-patch
+ "ghostscript-leptonica-hurd.patch"))))
+ (with-directory-excursion "leptonica"
+ (invoke "patch" "--force" "-p1" "-i"
patch-file))))))
+ #~())
(add-before 'configure 'create-output-directory
(lambda _
;; The configure script refuses to function if the directory
diff --git a/gnu/packages/patches/ghostscript-leptonica-hurd.patch
b/gnu/packages/patches/ghostscript-leptonica-hurd.patch
new file mode 100644
index 0000000000..124365b3e6
--- /dev/null
+++ b/gnu/packages/patches/ghostscript-leptonica-hurd.patch
@@ -0,0 +1,78 @@
+Upstream status: This patch was taken from leptonica upstream.
+
+Backported to ghostscripts bundled leptonica.
+
+From f04da7c816feb1d5f689c34f3d0e7e3621edf1f5 Mon Sep 17 00:00:00 2001
+From: Samuel Thibault <samuel.thibault@ens-lyon.org>
+Date: Wed, 1 Feb 2023 19:35:43 +0100
+Subject: [PATCH] Fix GNU/Hurd build
+
+There is no PATH_MAX limitation on GNU/Hurd, and realpath() can be
+safely be used with its second parameter set to NULL (as required by
+posix since its version 2001).
+---
+ src/sarray1.c | 29 +++++++++++++++++++++++------
+ 1 file changed, 23 insertions(+), 6 deletions(-)
+
+--- a/src/sarray1.c 2023-06-13 12:31:13.393672916 +0200
++++ a/src/sarray1.c 2023-06-13 12:34:13.574237149 +0200
+@@ -1953,7 +1953,11 @@
+ SARRAY *
+ getFilenamesInDirectory(const char *dirname)
+ {
++#if _POSIX_VERSION >= 200112 || defined(__GLIBC__)
++char *dir;
++#else
+ char dir[PATH_MAX + 1];
++#endif
+ char *realdir, *stat_path, *ignore;
+ size_t size;
+ SARRAY *safiles;
+@@ -1976,17 +1980,28 @@
+ * If the file or directory exists, realpath returns its path;
+ else it returns NULL.
+ * If the second arg to realpath is passed in, the canonical path
+- is returned there. Use a buffer of sufficient size. If the
+- second arg is NULL, the path is malloc'd and returned if the
+- file or directory exists.
+- We pass in a buffer for the second arg, and check that the
canonical
+- directory path was made. The existence of the directory is checked
+- later, after its actual path is returned by genPathname(). */
++ is returned there. Use a buffer of sufficient size.
++ We pass in a buffer for the second arg, and check that the
++ canonical directory path was made. The existence of the
++ directory is checked later, after its actual path is returned by
++ genPathname().
++ With GNU libc or Posix 2001, if the second arg is NULL, the path
++ is malloc'd and returned if the file or directory exists.
++ */
++#if _POSIX_VERSION >= 200112 || defined(__GLIBC__)
++ dir = realpath(dirname, NULL);
++ if (dir == NULL)
++ return (SARRAY *)ERROR_PTR("dir not made", __func__, NULL);
++#else
+ dir[0] = '\0'; /* init empty in case realpath() fails to write it */
+ ignore = realpath(dirname, dir);
+ if (dir[0] == '\0')
+ return (SARRAY *)ERROR_PTR("dir not made", procName, NULL);
++#endif
+ realdir = genPathname(dir, NULL);
++#if _POSIX_VERSION >= 200112 || defined(__GLIBC__)
++ LEPT_FREE(dir);
++#endif
+ if ((pdir = opendir(realdir)) == NULL) {
+ LEPT_FREE(realdir);
+ return (SARRAY *)ERROR_PTR("pdir not opened", procName, NULL);
+@@ -1998,10 +2013,12 @@
+ stat_ret = fstatat(dfd, pdirentry->d_name, &st, 0);
+ #else
+ size = strlen(realdir) + strlen(pdirentry->d_name) + 2;
++#if _POSIX_VERSION < 200112 && !defined(__GLIBC__)
+ if (size > PATH_MAX) {
+ L_ERROR("size = %zu too large; skipping\n", procName, size);
+ continue;
+ }
++#endif
+ stat_path = (char *)LEPT_CALLOC(size, 1);
+ snprintf(stat_path, size, "%s/%s", realdir, pdirentry->d_name);
+ stat_ret = stat(stat_path, &st);
- 28/89: services: static-networking: Support netdde for the Hurd., (continued)
- 28/89: services: static-networking: Support netdde for the Hurd., guix-commits, 2023/06/20
- 32/89: gnu: commencement: gnumach-headers-boot0: Update to 1.8+git20221224., guix-commits, 2023/06/20
- 31/89: gnu: commencement: Add automake-boot0., guix-commits, 2023/06/20
- 49/89: gnu: mpfr: Skip failing test on the Hurd., guix-commits, 2023/06/20
- 66/89: gnu: tcsh: Skip substitution tests on the Hurd., guix-commits, 2023/06/20
- 54/89: gnu: libgcrypt: Skip hanging benchmark tests on the Hurd., guix-commits, 2023/06/20
- 42/89: gnu: diffutils: Remove test-perror2 from XFAIL_TESTS on the Hurd., guix-commits, 2023/06/20
- 55/89: gnu: tcl: Remove failing tests on the Hurd.., guix-commits, 2023/06/20
- 33/89: gnu: commencement: mig-boot0: Update to 1.8+git20230520., guix-commits, 2023/06/20
- 51/89: gnu: libbsd: Skip failing test on the Hurd., guix-commits, 2023/06/20
- 75/89: gnu: ghostscript: Fix build for the Hurd.,
guix-commits <=
- 73/89: gnu: guile-git: Skip http proxy test on the Hurd., guix-commits, 2023/06/20
- 76/89: gnu: harfbuzz: Support build for the Hurd., guix-commits, 2023/06/20
- 78/89: gnu: fontforge: Support build on the Hurd., guix-commits, 2023/06/20
- 81/89: system: hurd: Add procps to %base-packages/hurd., guix-commits, 2023/06/20
- 80/89: gnu: guile-2.0: Skip failing tests on the Hurd., guix-commits, 2023/06/20
- 82/89: system: hurd: Add swap-services to hurd-default-essential-services., guix-commits, 2023/06/20
- 83/89: build: Build gnu/packages/*.go in four steps., guix-commits, 2023/06/20
- 86/89: gnu: guix: Update to 1.4.0-8.656960a93a., guix-commits, 2023/06/20
- 88/89: DRAFT hurd-boot: Support second boot., guix-commits, 2023/06/20
- 03/89: gnu: gnumach-headers: Cross-build without relying on x86., guix-commits, 2023/06/20