commit:     eea0e093a7d6abb484459e62dfea72772a0deecf
Author:     David Seifert <soap <AT> gentoo <DOT> org>
AuthorDate: Fri May 16 20:43:22 2025 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Fri May 16 20:43:22 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=eea0e093

dev-libs/icu: add 77.1

Signed-off-by: David Seifert <soap <AT> gentoo.org>

 dev-libs/icu/Manifest                            |   2 +
 dev-libs/icu/files/icu-77.1-invalid-malloc.patch |  30 ++++
 dev-libs/icu/icu-77.1.ebuild                     | 174 +++++++++++++++++++++++
 3 files changed, 206 insertions(+)

diff --git a/dev-libs/icu/Manifest b/dev-libs/icu/Manifest
index 54488cbffd2b..28d30f758690 100644
--- a/dev-libs/icu/Manifest
+++ b/dev-libs/icu/Manifest
@@ -1,2 +1,4 @@
 DIST icu4c-76_1-src.tgz 27437767 BLAKE2B 
67223391123d2d2c75107fc4b87510b1d8d520301a863032951b894366ec8b414692ee3fa2acd652289b0ae2f60946d71bf9ca21ed87de40825e2fd02634c658
 SHA512 
b702ab62fb37a1574d5f4a768326d0f8fa30d9db5b015605b5f8215b5d8547f83d84880c586d3dcc7b6c76f8d47ef34e04b0f51baa55908f737024dd79a42a6c
 DIST icu4c-76_1-src.tgz.asc 228 BLAKE2B 
37a058e22da5ad122e3df6de2cb3979fa734b32e4e81d91201d2095fbf20ef2dbcba4579efab3041193e49c388d09618c965ddf082a8362aa82b694184804fa7
 SHA512 
c4bd81d4e98d7e37a6ba9540748c4ce1eb740d70bd689a13e2e51da76503b6e0287afd4d1cd3af4540210f37626dec998fcbd7269976cb801f238b789e604489
+DIST icu4c-77_1-src.tgz 27384265 BLAKE2B 
7ee4457dbb9abfee543aa91314e052282fb1c73e5fd9d9b21777d2ea32ae29c3eb3d83a78aafc7d00530435c014aa0f6196faf82ed67593c844e28395ab4720e
 SHA512 
a47d6d9c327d037a05ea43d1d1a06b2fd757cc02a94f7c1a238f35cfc3dfd4ab78d0612790f3a3cca0292c77412a9c2c15c8f24b718f79a857e007e66f07e7cd
+DIST icu4c-77_1-src.tgz.asc 228 BLAKE2B 
faabf00cb79427b14286e24770cbed3cd81a367bb5e9dc935c8fa5b8d67d7401fa82425b70259740a4136bd52fe9887bf0494195c6941454cadabec475d5c0e5
 SHA512 
7051e53f5a82a9b72a07adcc9751921c0afee56c733ccfe8ed94701606cadaf3b85135d5815dbe1acddb64ffef30d3d9fc5f37016b20dcd07685baa06d633759

diff --git a/dev-libs/icu/files/icu-77.1-invalid-malloc.patch 
b/dev-libs/icu/files/icu-77.1-invalid-malloc.patch
new file mode 100644
index 000000000000..a0ae4728a9c1
--- /dev/null
+++ b/dev-libs/icu/files/icu-77.1-invalid-malloc.patch
@@ -0,0 +1,30 @@
+https://unicode-org.atlassian.net/browse/ICU-23120
+https://github.com/unicode-org/icu/pull/3496
+
+From a0d280e4b4df6c09dfd82b63499f308d416c9b60 Mon Sep 17 00:00:00 2001
+From: David Seifert <[email protected]>
+Date: Fri, 16 May 2025 12:55:47 +0200
+Subject: [PATCH] ICU-23120 Fix malloc request larger than PTRDIFF_MAX bytes
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+* glibc does not allow allocations that exceed PTRDIFF_MAX bytes:
+  
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9bf8e29ca136094f73f69f725f15c51facc97206
+* Without this, we get compile failures on 32-bit platforms:
+
+    work/icu/source/test/intltest/ustrtest.cpp: In member function ‘void 
UnicodeStringTest::TestLargeMemory()’:
+    work/icu/source/test/intltest/ustrtest.cpp:2360:37: error: size 
‘4294967286’ of array exceeds maximum object size ‘2147483647’
+     2360 |     char16_t *buf = new char16_t[len];
+          |                                     ^
+--- a/test/intltest/ustrtest.cpp
++++ b/test/intltest/ustrtest.cpp
+@@ -2356,7 +2356,7 @@ void UnicodeStringTest::TestLargeMemory() {
+ #if U_PLATFORM_IS_LINUX_BASED || U_PLATFORM_IS_DARWIN_BASED
+     if(quick) { return; }
+     IcuTestErrorCode status(*this, "TestLargeMemory");
+-    constexpr uint32_t len = 2147483643;
++    constexpr uint32_t len = (PTRDIFF_MAX - 10) / sizeof(char16_t);
+     char16_t *buf = new char16_t[len];
+     if (buf == nullptr) { return; }
+     uprv_memset(buf, 0x4e, len * 2);

diff --git a/dev-libs/icu/icu-77.1.ebuild b/dev-libs/icu/icu-77.1.ebuild
new file mode 100644
index 000000000000..80956d686723
--- /dev/null
+++ b/dev-libs/icu/icu-77.1.ebuild
@@ -0,0 +1,174 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Please bump with dev-libs/icu-layoutex
+
+PYTHON_COMPAT=( python3_{10..13} )
+VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/icu.asc
+inherit autotools multilib-minimal python-any-r1 toolchain-funcs verify-sig
+
+MY_PV=${PV/_rc/-rc}
+MY_PV=${MY_PV//./_}
+
+DESCRIPTION="International Components for Unicode"
+HOMEPAGE="https://icu.unicode.org/";
+SRC_URI="https://github.com/unicode-org/icu/releases/download/release-${MY_PV/_/-}/icu4c-${MY_PV/-rc/rc}-src.tgz";
+SRC_URI+=" verify-sig? ( 
https://github.com/unicode-org/icu/releases/download/release-${MY_PV/_/-}/icu4c-${MY_PV/-rc/rc}-src.tgz.asc
 )"
+S="${WORKDIR}"/${PN}/source
+
+if [[ ${PV} != *_rc* ]] ; then
+       KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc 
~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos 
~x64-solaris"
+fi
+LICENSE="BSD"
+SLOT="0/${PV%.*}"
+IUSE="debug doc examples static-libs test"
+RESTRICT="!test? ( test )"
+
+BDEPEND="
+       ${PYTHON_DEPS}
+       dev-build/autoconf-archive
+       virtual/pkgconfig
+       doc? ( app-text/doxygen[dot] )
+       verify-sig? ( >=sec-keys/openpgp-keys-icu-20241110 )
+"
+
+MULTILIB_CHOST_TOOLS=(
+       /usr/bin/icu-config
+)
+
+PATCHES=(
+       "${FILESDIR}/${PN}-76.1-remove-bashisms.patch"
+       "${FILESDIR}/${PN}-64.2-darwin.patch"
+       "${FILESDIR}/${PN}-68.1-nonunicode.patch"
+
+       # Undo change for now which exposes underlinking in consumers;
+       # revisit when things are a bit quieter and tinderbox its removal.
+       "${FILESDIR}/${PN}-76.1-undo-pkgconfig-change-for-now.patch"
+       # https://unicode-org.atlassian.net/browse/ICU-23120
+       "${FILESDIR}/${PN}-77.1-invalid-malloc.patch"
+)
+
+HTML_DOCS=( ../readme.html )
+
+src_prepare() {
+       default
+
+       # TODO: switch uconfig.h hacks to use uconfig_local
+       #
+       # Disable renaming as it assumes stable ABI and that consumers
+       # won't use unofficial APIs. We need this despite the configure 
argument.
+       sed -i \
+               -e "s/#define U_DISABLE_RENAMING 0/#define U_DISABLE_RENAMING 
1/" \
+               common/unicode/uconfig.h || die
+       #
+       # ODR violations, experimental API
+       sed -i \
+               -e "s/#   define UCONFIG_NO_MF2 0/#define UCONFIG_NO_MF2 1/" \
+               common/unicode/uconfig.h || die
+
+       # Fix linking of icudata
+       sed -i \
+               -e "s:LDFLAGSICUDT=-nodefaultlibs -nostdlib:LDFLAGSICUDT=:" \
+               config/mh-linux || die
+
+       # Append doxygen configuration to configure
+       sed -i \
+               -e 's:icudefs.mk:icudefs.mk Doxyfile:' \
+               configure.ac || die
+
+       eautoreconf
+}
+
+src_configure() {
+       MAKEOPTS+=" VERBOSE=1"
+
+       if tc-is-cross-compiler; then
+               mkdir "${WORKDIR}"/host || die
+               pushd "${WORKDIR}"/host >/dev/null || die
+
+               CFLAGS="" CXXFLAGS="" ASFLAGS="" LDFLAGS="" \
+               CC="$(tc-getBUILD_CC)" CXX="$(tc-getBUILD_CXX)" 
AR="$(tc-getBUILD_AR)" \
+               RANLIB="$(tc-getBUILD_RANLIB)" LD="$(tc-getBUILD_LD)" \
+               "${S}"/configure --disable-renaming --disable-debug \
+                       --disable-samples --enable-static || die
+               emake
+
+               popd >/dev/null || die
+       fi
+
+       multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+       local myeconfargs=(
+               --disable-renaming
+               --disable-samples
+               # TODO: Merge with dev-libs/icu-layoutex
+               # Planned to do this w/ 73.2 but seem to get test failures
+               # only with --enable-layoutex.
+               --disable-layoutex
+               $(use_enable debug)
+               $(use_enable static-libs static)
+               $(use_enable test tests)
+               $(multilib_native_use_enable examples samples)
+       )
+
+       #if use test ; then
+       #       myeconfargs+=(
+       #               --enable-extras
+       #               --enable-tools
+       #       )
+       #else
+       #       myeconfargs+=(
+       #               $(multilib_native_enable extras)
+       #               $(multilib_native_enable tools)
+       #       )
+       #fi
+
+       tc-is-cross-compiler && myeconfargs+=(
+               --with-cross-build="${WORKDIR}"/host
+       )
+
+       # Work around cross-endian testing failures with LTO, bug #757681
+       if tc-is-cross-compiler && tc-is-lto ; then
+               myeconfargs+=( --disable-strict )
+       fi
+
+       # ICU tries to use clang by default
+       tc-export CC CXX
+
+       # Make sure we configure with the same shell as we run icu-config
+       # with, or ECHO_N, ECHO_T and ECHO_C will be wrongly defined
+       export CONFIG_SHELL="${EPREFIX}/bin/sh"
+       # Probably have no /bin/sh in prefix-chain
+       [[ -x ${CONFIG_SHELL} ]] || CONFIG_SHELL="${BASH}"
+
+       ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
+}
+
+multilib_src_compile() {
+       default
+
+       if multilib_is_native_abi && use doc; then
+               doxygen -u Doxyfile || die
+               doxygen Doxyfile || die
+
+               HTML_DOCS+=( "${BUILD_DIR}"/doc/html/. )
+       fi
+}
+
+multilib_src_test() {
+       # INTLTEST_OPTS: intltest options
+       #   -e: Exhaustive testing
+       #   -l: Reporting of memory leaks
+       #   -v: Increased verbosity
+       # IOTEST_OPTS: iotest options
+       #   -e: Exhaustive testing
+       #   -v: Increased verbosity
+       # CINTLTST_OPTS: cintltst options
+       #   -e: Exhaustive testing
+       #   -v: Increased verbosity
+       emake check
+}

Reply via email to