commit:     d36d6a45aa033cb28dd5850a0fcce501cb9d85a9
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed May  7 16:35:51 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed May  7 16:35:51 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d36d6a45

dev-libs/kpathsea: C23 fixes to headers

Closes: https://bugs.gentoo.org/952902
Closes: https://bugs.gentoo.org/955549
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/kpathsea-6.4.0_p20240311-c23.patch       |  52 ++++++++++
 .../kpathsea/kpathsea-6.4.0_p20240311-r1.ebuild    | 110 +++++++++++++++++++++
 2 files changed, 162 insertions(+)

diff --git a/dev-libs/kpathsea/files/kpathsea-6.4.0_p20240311-c23.patch 
b/dev-libs/kpathsea/files/kpathsea-6.4.0_p20240311-c23.patch
new file mode 100644
index 000000000000..0c06095c3567
--- /dev/null
+++ b/dev-libs/kpathsea/files/kpathsea-6.4.0_p20240311-c23.patch
@@ -0,0 +1,52 @@
+https://bugs.gentoo.org/952902
+https://bugs.gentoo.org/955549
+https://github.com/TeX-Live/texlive-source/commit/cc687b6c0ae8c6a4b566646282a7bc702d822e6d
 (cherry-picked)
+.. then another fix on top.
+
+From cc687b6c0ae8c6a4b566646282a7bc702d822e6d Mon Sep 17 00:00:00 2001
+From: Karl Berry <[email protected]>
+Date: Tue, 8 Apr 2025 22:40:48 +0000
+Subject: [PATCH] begin groveling to C23 (fixes mostly from Hilmar)
+
+git-svn-id: svn://tug.org/texlive/trunk/Build/source@74888 
c570f23f-e606-0410-a88d-b1316a301751
+---
+ texk/kpathsea/c-memstr.h              |  7 -------
+ 17 files changed, 81 insertions(+), 25 deletions(-)
+
+diff --git a/texk/kpathsea/c-memstr.h b/texk/kpathsea/c-memstr.h
+index e8e107a6f9..fdd4faeb7e 100644
+--- a/c-memstr.h
++++ b/c-memstr.h
+@@ -53,11 +53,4 @@
+ #define memcpy(to, from, len) bcopy ((from), (to), (len))
+ #endif
+ 
+-#if !defined(HAVE_STRING_H)
+-extern char *strtok ();
+-#ifndef strstr
+-extern char *strstr ();
+-#endif
+-#endif
+-
+ #endif /* not KPATHSEA_C_MEMSTR_H */
+diff --git a/c-std.h b/c-std.h
+index 6d65d15..f001f0a 100644
+--- a/c-std.h
++++ b/c-std.h
+@@ -37,16 +37,10 @@
+ /* Be sure we have constants from <unistd.h>.  */
+ #include <kpathsea/c-unistd.h>
+ 
+-#ifdef HAVE_STDLIB_H
+ #include <stdlib.h>
+ /* Include <stdlib.h> before <stddef.h>, to help avoid NULL
+    redefinitions on some systems.  (We don't include <stddef.h>
+    ourselves any more, but FYI.)  */
+-#else
+-/* It's impossible to say for sure what the system will deign to put in
+-   <stdlib.h>, but let's hope it's at least this.  */
+-extern char *getenv ();
+-#endif /* not HAVE_STDLIB_H */
+ 
+ #ifdef WIN32
+ #include <malloc.h>

diff --git a/dev-libs/kpathsea/kpathsea-6.4.0_p20240311-r1.ebuild 
b/dev-libs/kpathsea/kpathsea-6.4.0_p20240311-r1.ebuild
new file mode 100644
index 000000000000..92ba84fd116e
--- /dev/null
+++ b/dev-libs/kpathsea/kpathsea-6.4.0_p20240311-r1.ebuild
@@ -0,0 +1,110 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit texlive-common libtool prefix tmpfiles
+
+TEXMFD_VERSION="11"
+MY_SOURCE_FILE="texlive-${PV#*_p}-source.tar.xz"
+
+DESCRIPTION="Path searching library for TeX-related files"
+HOMEPAGE="https://tug.org/texlive/";
+SRC_URI="
+       https://mirrors.ctan.org/systems/texlive/Source/${MY_SOURCE_FILE}
+       https://dev.gentoo.org/~flow/distfiles/texlive/${MY_SOURCE_FILE}
+       
https://dev.gentoo.org/~sam/distfiles/texlive/${PN}-texmf.d-${TEXMFD_VERSION}.tar.xz
+"
+
+S=${WORKDIR}/texlive-${PV#*_p}-source/texk/${PN}
+LICENSE="LGPL-2.1"
+SLOT="0/${PV%_p*}"
+
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv 
~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris"
+IUSE="doc source static-libs"
+
+TL_REVISION=72376
+EXTRA_TL_MODULES="kpathsea.r${TL_REVISION}"
+EXTRA_TL_DOC_MODULES="kpathsea.doc.r${TL_REVISION}"
+
+texlive-common_append_to_src_uri EXTRA_TL_MODULES
+
+SRC_URI="${SRC_URI} doc? ( "
+texlive-common_append_to_src_uri EXTRA_TL_DOC_MODULES
+SRC_URI="${SRC_URI} ) "
+
+TEXMF_PATH=/usr/share/texmf-dist
+
+PATCHES=(
+       "${FILESDIR}"/kpathsea-6.4.0_p20240311-c23.patch
+)
+
+src_prepare() {
+       default
+       cd "${WORKDIR}/texlive-${PV#*_p}-source" || die
+       S="${WORKDIR}/texlive-${PV#*_p}-source" elibtoolize
+       cp "${FILESDIR}/texmf-update-r2" "${S}"/texmf-update || die
+       eprefixify "${S}"/texmf-update
+}
+
+src_configure() {
+       # Too many regexps use A-Z a-z constructs, what causes problems with 
locales
+       # that don't have the same alphabetical order than ascii. Bug #347798
+       # So we set LC_ALL to C in order to avoid problems.
+       export LC_ALL=C
+
+       # Disable largefile because it seems to cause problems on big endian 32 
bits
+       # systems...
+       econf \
+               --disable-largefile \
+               "$(use_enable static-libs static)"
+}
+
+src_install() {
+       emake DESTDIR="${D}" web2cdir="${EPREFIX}/usr/share/texmf-dist/web2c" 
install
+       find "${D}" -name '*.la' -delete || die
+
+       dodir /usr/share # just in case
+       cp -pR "${WORKDIR}"/texmf-dist "${ED}/usr/share/" || die "failed to 
install texmf trees"
+       if use source ; then
+               cp -pR "${WORKDIR}"/tlpkg "${ED}/usr/share/" || die "failed to 
install tlpkg files"
+       fi
+
+       # Take care of fmtutil.cnf and texmf.cnf
+       dodir /etc/texmf/{fmtutil.d,texmf.d}
+
+       # Remove default texmf.cnf to ship our own, greatly based on texlive 
dvd's
+       # texmf.cnf
+       # It will also be generated from /etc/texmf/texmf.d files by 
texmf-update
+       rm -f "${ED}${TEXMF_PATH}/web2c/texmf.cnf" || die
+
+       insinto /etc/texmf/texmf.d
+       doins "${WORKDIR}/texmf.d/"*.cnf
+
+       # Remove fmtutil.cnf, it will be regenerated from /etc/texmf/fmtutil.d 
files
+       # by texmf-update
+       rm -f "${ED}${TEXMF_PATH}/web2c/fmtutil.cnf" || die
+
+       dosym ../../../../etc/texmf/web2c/fmtutil.cnf 
${TEXMF_PATH}/web2c/fmtutil.cnf
+       dosym ../../../../etc/texmf/web2c/texmf.cnf 
${TEXMF_PATH}/web2c/texmf.cnf
+
+       newsbin "${S}/texmf-update" texmf-update
+
+       # Keep it as that's where the formats will go
+       keepdir /var/lib/texmf
+
+       dodoc ChangeLog NEWS PROJECTS README
+
+       # The default configuration expects it to be world writable, bug #266680
+       # People can still change it with texconfig though.
+       dotmpfiles "${FILESDIR}"/kpathsea.conf
+}
+
+pkg_postinst() {
+       tmpfiles_process kpathsea.conf
+       etexmf-update
+}
+
+pkg_postrm() {
+       etexmf-update
+}

Reply via email to