From fdff8ff4489ddcf7826412d4ed15d163842cc3bd Mon Sep 17 00:00:00 2001 From: Flatcar Buildbot Date: Mon, 3 Nov 2025 07:07:13 +0000 Subject: [PATCH] dev-libs/libpcre2: Sync with Gentoo It's from Gentoo commit 0990ed573b83eb13c857be82a0cf2058463e9271. Signed-off-by: Flatcar Buildbot --- .../portage-stable/dev-libs/libpcre2/Manifest | 2 + .../libpcre2/files/libpcre2-10.47-riscv.patch | 118 ++++++++++++++++++ .../dev-libs/libpcre2/libpcre2-10.46.ebuild | 2 +- .../dev-libs/libpcre2/libpcre2-10.47.ebuild | 110 ++++++++++++++++ 4 files changed, 231 insertions(+), 1 deletion(-) create mode 100644 sdk_container/src/third_party/portage-stable/dev-libs/libpcre2/files/libpcre2-10.47-riscv.patch create mode 100644 sdk_container/src/third_party/portage-stable/dev-libs/libpcre2/libpcre2-10.47.ebuild diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/libpcre2/Manifest b/sdk_container/src/third_party/portage-stable/dev-libs/libpcre2/Manifest index aa329497d2..ff9d83dc8b 100644 --- a/sdk_container/src/third_party/portage-stable/dev-libs/libpcre2/Manifest +++ b/sdk_container/src/third_party/portage-stable/dev-libs/libpcre2/Manifest @@ -2,3 +2,5 @@ DIST pcre2-10.45.tar.bz2 2072403 BLAKE2B ec8a76cb28ef6680f8655828462551baf4e4801 DIST pcre2-10.45.tar.bz2.sig 566 BLAKE2B 21a7fc4d6a116c5fde78a8abc99445bd3ce8da70083e65b4117cec2520ed10fee810b8b82226cecb1e5649643be96bb8c89ec80f9dd907bbf95373477febc83d SHA512 ff8a0f036d98b902fa2476cf5875089685cc712294629fc385c8c84c8288674e83f278fe36141b4c109eb68a64b3e6a29d0049c799bd5ab77cf15142de3c8e20 DIST pcre2-10.46.tar.bz2 2035354 BLAKE2B ebd501ba2105c847bb830c932bbfafef2e14583743f62b46af7671aa801eff0ca8b1ed9ce8252f9b091f18ef6e5ef38d47777f657d3ba3813be3d94856558080 SHA512 795b0d74efb898347990c29fefc85f37ac81e7795f9d6a5598d1169a03c547df7ff7eac280f708b1fef68d3e7686e0d4cd55f0c6364e287ff2a983bbd1a3c334 DIST pcre2-10.46.tar.bz2.sig 566 BLAKE2B 6ffd9ea22526ab371f916d980af26b6b1b64e464c2b98d631712abfe2b8aa32c6de7f4eb6dd661d67bc308e18c113e705f9d52f9057fb3cec527d59ca4c92bbd SHA512 e755150e291f39222cd09cde046ce72e838a1c16f520fce3f63265126c5c6c5d143dc2f11ad8fabea45ce5e3d3cd482c434da1968354b2470e163ebfc3cc9bba +DIST pcre2-10.47.tar.bz2 2145789 BLAKE2B 9b56eddbc8b6fd6ce925575c337891c4f7790215c77325c1f0ad4a72be07e2a2a6a6b6638a5a2c49d1da6f4715320f240fd17c4ffcb77d1bb00875b990d6ee13 SHA512 889a6fdc80f8a7285e4a75d189c183b4588df81bdf048302cf0830e11bbf9b9eeb387ba43dfd3aff8ffb3aa693291e8c535845c06e8ce92d1028cefa6b474804 +DIST pcre2-10.47.tar.bz2.sig 566 BLAKE2B 0bfe968f32c410a49bf1120b05027d3171b38fdd8fd4d9d77e58cad4811770ef9cabcc3275556116a5cfe28784fc5faa0c5f5bf959e7aae9d6ef2f491ffbb936 SHA512 fbea8f001533c700e0adae881d2d13f2a5f32c272cb1323fd6b76530b011fb3e8eafdc6eb762c36d91296f66fe2fe3861887d6f5219045a2dad8de55f3825051 diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/libpcre2/files/libpcre2-10.47-riscv.patch b/sdk_container/src/third_party/portage-stable/dev-libs/libpcre2/files/libpcre2-10.47-riscv.patch new file mode 100644 index 0000000000..a95be85df7 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-libs/libpcre2/files/libpcre2-10.47-riscv.patch @@ -0,0 +1,118 @@ +https://bugs.gentoo.org/964425 +https://github.com/PCRE2Project/pcre2/issues/831 +https://github.com/PCRE2Project/pcre2/pull/835 (doc change snipped) + +From 6454fac3920d9223a2b05becf15e3cb8e6022243 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Carlo=20Marcelo=20Arenas=20Bel=C3=B3n?= +Date: Thu, 30 Oct 2025 13:57:32 -0700 +Subject: [PATCH] pcre2test: dynamically allocate buffer for JITTARGET (#835) + +Always ask `pcre2_config()` for the expected size of buffers and abort if +it is too small. + +In the documentation, remove the description of a static buffer size for +JITTARGET. +--- + src/pcre2test.c | 12 ++++++------ + src/pcre2test_inc.h | 35 ++++++++++++++++++++++++++--------- + 3 files changed, 43 insertions(+), 25 deletions(-) + +--- a/src/pcre2test.c ++++ b/src/pcre2test.c +@@ -2942,9 +2942,9 @@ static int pcre2_config(uint32_t what, void *where) + DISPATCH(return, pcre2_config_, (what, where)); + } + +-static void config_str(uint32_t what, char *where) ++static char *config_str(uint32_t what, char *where, int size) + { +-DISPATCH(, config_str_, (what, where)); ++DISPATCH(return, config_str_, (what, where, size)); + } + + static BOOL decode_modifiers(uint8_t *p, int ctx, patctl *pctl, datctl *dctl) +@@ -3014,7 +3014,7 @@ static void + print_version(FILE *f, BOOL include_mode) + { + char buf[VERSION_SIZE]; +-config_str(PCRE2_CONFIG_VERSION, buf); ++config_str(PCRE2_CONFIG_VERSION, buf, sizeof(buf)); + fprintf(f, "PCRE2 version %s", buf); + if (include_mode) + { +@@ -3033,7 +3033,7 @@ static void + print_unicode_version(FILE *f) + { + char buf[VERSION_SIZE]; +-config_str(PCRE2_CONFIG_UNICODE_VERSION, buf); ++config_str(PCRE2_CONFIG_UNICODE_VERSION, buf, sizeof(buf)); + fprintf(f, "Unicode version %s", buf); + } + +@@ -3046,9 +3046,9 @@ fprintf(f, "Unicode version %s", buf); + static void + print_jit_target(FILE *f) + { +-char buf[VERSION_SIZE]; +-config_str(PCRE2_CONFIG_JITTARGET, buf); ++char *buf = config_str(PCRE2_CONFIG_JITTARGET, NULL, 0); + fputs(buf, f); ++free(buf); + } + + +diff --git a/src/pcre2test_inc.h b/src/pcre2test_inc.h +index c47074171..ce808a82f 100644 +--- a/src/pcre2test_inc.h ++++ b/src/pcre2test_inc.h +@@ -558,24 +558,41 @@ return 0; + + Arguments: + what the item to read +- where the 8-bit buffer to receive the string ++ where the 8-bit buffer to receive the string (NULLABLE) ++ size sizeof(where) or 0 to ask for the buffer to be allocated ++ ++Returns: the string where the data was written + */ + +-static void +-config_str(uint32_t what, char *where) ++static char * ++config_str(uint32_t what, char *where, int size) + { +-int r1, r2; +-PCRE2_UCHAR buf[VERSION_SIZE]; ++int r2; ++PCRE2_UCHAR *buf; ++int needed_len; + +-r1 = pcre2_config(what, NULL); +-r2 = pcre2_config(what, buf); +-if (r1 < 0 || r1 != r2 || r1 >= VERSION_SIZE) ++needed_len = pcre2_config(what, NULL); ++if (needed_len <= 0) + { + cfprintf(clr_test_error, stderr, "pcre2test: Error in pcre2_config(%d)\n", what); + exit(1); + } ++else if (size != 0 && needed_len > size) ++ { ++ cfprintf(clr_test_error, stderr, ++ "pcre2test: Static buffer provided to pcre2_config(%d) too small\n", what); ++ exit(1); ++ } ++ ++buf = malloc(needed_len * sizeof(PCRE2_UCHAR)); ++r2 = pcre2_config(what, buf); ++PCRE2_ASSERT(r2 == needed_len); ++ ++if (where == NULL) where = malloc(needed_len); ++while (r2-- > 0) where[r2] = (char)buf[r2]; ++free(buf); + +-while (r1-- > 0) where[r1] = (char)buf[r1]; ++return where; + } + + diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/libpcre2/libpcre2-10.46.ebuild b/sdk_container/src/third_party/portage-stable/dev-libs/libpcre2/libpcre2-10.46.ebuild index 343327138b..c4ba40fc56 100644 --- a/sdk_container/src/third_party/portage-stable/dev-libs/libpcre2/libpcre2-10.46.ebuild +++ b/sdk_container/src/third_party/portage-stable/dev-libs/libpcre2/libpcre2-10.46.ebuild @@ -22,7 +22,7 @@ S="${WORKDIR}/${MY_P}" LICENSE="BSD" SLOT="0/3" # libpcre2-posix.so version if [[ ${PV} != *_rc* ]] ; then - KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" + KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" fi IUSE="bzip2 +jit libedit +pcre16 +pcre32 +readline static-libs unicode valgrind zlib" REQUIRED_USE="?? ( libedit readline )" diff --git a/sdk_container/src/third_party/portage-stable/dev-libs/libpcre2/libpcre2-10.47.ebuild b/sdk_container/src/third_party/portage-stable/dev-libs/libpcre2/libpcre2-10.47.ebuild new file mode 100644 index 0000000000..6d4c562285 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-libs/libpcre2/libpcre2-10.47.ebuild @@ -0,0 +1,110 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +# https://pcre2project.github.io/pcre2/project/security/ +VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/nicholaswilson.asc +inherit dot-a libtool multilib multilib-minimal toolchain-funcs verify-sig + +MY_P="pcre2-${PV/_rc/-RC}" + +DESCRIPTION="Perl-compatible regular expression library" +HOMEPAGE="https://pcre2project.github.io/pcre2/ https://www.pcre.org/" +SRC_URI=" + https://github.com/PCRE2Project/pcre2/releases/download/${MY_P}/${MY_P}.tar.bz2 + https://ftp.pcre.org/pub/pcre/${MY_P}.tar.bz2 + verify-sig? ( https://github.com/PCRE2Project/pcre2/releases/download/${MY_P}/${MY_P}.tar.bz2.sig ) +" + +S="${WORKDIR}/${MY_P}" + +LICENSE="BSD" +SLOT="0/3" # libpcre2-posix.so version +if [[ ${PV} != *_rc* ]] ; then + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" +fi +IUSE="bzip2 +jit libedit +pcre16 +pcre32 +readline static-libs unicode valgrind zlib" +REQUIRED_USE="?? ( libedit readline )" + +RDEPEND=" + bzip2? ( app-arch/bzip2 ) + libedit? ( dev-libs/libedit ) + readline? ( sys-libs/readline:= ) + zlib? ( sys-libs/zlib ) +" +DEPEND=" + ${RDEPEND} + valgrind? ( dev-debug/valgrind ) +" +BDEPEND=" + virtual/pkgconfig + verify-sig? ( >=sec-keys/openpgp-keys-nicholaswilson-20250910 ) +" + +MULTILIB_CHOST_TOOLS=( + /usr/bin/pcre2-config +) + +PATCHES=( + "${FILESDIR}"/${PN}-10.10-000-Fix-multilib.patch + "${FILESDIR}"/${PN}-10.47-riscv.patch +) + +src_prepare() { + default + + elibtoolize +} + +src_configure() { + use static-libs && lto-guarantee-fat + multilib-minimal_src_configure +} + +multilib_src_configure() { + local myeconfargs=( + --enable-pcre2-8 + --enable-shared + $(multilib_native_use_enable bzip2 pcre2grep-libbz2) + $(multilib_native_use_enable libedit pcre2test-libedit) + $(multilib_native_use_enable readline pcre2test-libreadline) + $(multilib_native_use_enable valgrind) + $(multilib_native_use_enable zlib pcre2grep-libz) + $(use_enable jit) + $(use_enable jit pcre2grep-jit) + $(use_enable pcre16 pcre2-16) + $(use_enable pcre32 pcre2-32) + $(use_enable static-libs static) + $(use_enable unicode) + ) + + ECONF_SOURCE="${S}" econf "${myeconfargs[@]}" +} + +multilib_src_compile() { + emake V=1 $(multilib_is_native_abi || echo "bin_PROGRAMS=") +} + +multilib_src_test() { + emake check VERBOSE=yes +} + +multilib_src_install() { + emake \ + DESTDIR="${D}" \ + $(multilib_is_native_abi || echo "bin_PROGRAMS= dist_html_DATA=") \ + install + + # bug #934977 + if ! tc-is-static-only && [[ ! -f "${ED}/usr/$(get_libdir)/libpcre2-8$(get_libname)" ]] ; then + eerror "Sanity check for libpcre2-8$(get_libname) failed." + eerror "Shared library wasn't built, possible libtool bug" + [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]] && die "libpcre2-8$(get_libname) not found in build, aborting" + fi +} + +multilib_src_install_all() { + find "${ED}" -type f -name "*.la" -delete || die + strip-lto-bytecode +}