[PATCH 93/94] app-text/opensp: fix build with Hurd

Sam James <[email protected]>
Newsgroups gmane.linux.gentoo.devel
Message-ID <ec04504b0fb961a875ecac99b1ef20661998a937.1774994380.git.sam@gentoo.org>
From: Andreas K. Hüttel <[email protected]>

Signed-off-by: Andreas K. Hüttel <[email protected]>
Signed-off-by: Sam James <[email protected]>
---
 app-text/opensp/files/opensp-1.5.2-hurd.patch | 48 +++++++++++++++++++
 app-text/opensp/opensp-1.5.2-r10.ebuild       |  3 +-
 2 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 app-text/opensp/files/opensp-1.5.2-hurd.patch

diff --git a/app-text/opensp/files/opensp-1.5.2-hurd.patch b/app-text/opensp/files/opensp-1.5.2-hurd.patch
new file mode 100644
index 0000000000000..c0574403820c4
--- /dev/null
+++ b/app-text/opensp/files/opensp-1.5.2-hurd.patch
@@ -0,0 +1,48 @@
+Handle undefined MAXPATHLEN for Hurd
+
+Extracted from the Debian bulk patch
+
+Source: https://sources.debian.org/patches/opensp/1.5.2-15.2/diff-1.0.patch/
+Description: Patch created in switch to source format 3.0 (quilt)
+ The orig.tar.gz for this software is eighteen years old.  This patch captures
+ the state of all changes in this file applied in Debian since then.
+Author: Neil Roeth <[email protected]>
+Last-Update: 2023-12-29
+
+--- a/sx/XmlOutputEventHandler.cxx
++++ b/sx/XmlOutputEventHandler.cxx
+@@ -1199,12 +1199,22 @@
+           // Check to make sure we haven't passed outside of the
+           // output directory
+ 	  char *dirs = strdup (filePath);
++#ifdef MAXPATHLEN
+           char realDirs[MAXPATHLEN];
+           char realOutputDir[MAXPATHLEN];
++#else
++          char *realDirs;
++          char *realOutputDir;
++#endif
+           char *outputDir = strdup(outputDir_);
+ 
++#ifdef MAXPATHLEN
+           realpath((const char *)dirname(dirs), realDirs);
+           realpath((const char *)dirname(outputDir), realOutputDir);
++#else
++          realDirs = realpath((const char *)dirname(dirs), NULL);
++          realOutputDir = realpath((const char *)dirname(outputDir), NULL);
++#endif
+ 
+           if (strncmp(realDirs, realOutputDir, strlen (realOutputDir)) != 0) {
+             app_->message(XmlOutputMessages::pathOutsideOutputDirectory,
+@@ -1214,6 +1224,11 @@
+             }
+           }
+ 
++#ifndef MAXPATHLEN
++	  free(realDirs);
++	  free(realOutputDir);
++#endif
++
+ 	  // Make the necessary directories
+ 	  maybeCreateDirectories(dirname(dirs));
+ 
diff --git a/app-text/opensp/opensp-1.5.2-r10.ebuild b/app-text/opensp/opensp-1.5.2-r10.ebuild
index b097ba7761243..cc1ad7bc38925 100644
--- a/app-text/opensp/opensp-1.5.2-r10.ebuild
+++ b/app-text/opensp/opensp-1.5.2-r10.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2025 Gentoo Authors
+# Copyright 1999-2026 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -36,6 +36,7 @@ PATCHES=(
 	"${FILESDIR}"/${P}-configure-clang16.patch
 	"${FILESDIR}"/${P}-fix-ar-intl.patch
 	"${FILESDIR}"/${P}-gcc15-musl.patch
+	"${FILESDIR}"/${P}-hurd.patch
 )
 
 src_prepare() {
-- 
2.53.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.