commit:     8d736f33c58024e9dc238aa4c7692c8fbfb3340f
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 30 12:24:53 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jun 30 12:24:53 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8d736f33

www-apache/libapreq2: fix modern C issue

Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../libapreq2/files/libapreq2-2.08-c99.patch       | 46 ++++++++++++
 www-apache/libapreq2/libapreq2-2.17-r2.ebuild      | 84 ++++++++++++++++++++++
 2 files changed, 130 insertions(+)

diff --git a/www-apache/libapreq2/files/libapreq2-2.08-c99.patch 
b/www-apache/libapreq2/files/libapreq2-2.08-c99.patch
new file mode 100644
index 000000000000..eaf20c523a86
--- /dev/null
+++ b/www-apache/libapreq2/files/libapreq2-2.08-c99.patch
@@ -0,0 +1,46 @@
+https://salsa.debian.org/debian/libapreq2/-/blob/debian/2.17-7/debian/patches/32-bit-build.patch
+
+Description: fix type mismatch of MGVTBL.svt_copy namelen argument
+ Since Perl 5.12, the type of the namelen argument of the svt_copy member of
+ MGVTBL struct has changed its type from `int` to `I32`.
+ .
+ Perl commit:
+ https://github.com/Perl/perl5/commit/3468c7eaa8d7687e8ae89928492b408a4d6c752f
+ .
+ On 64-bit platforms `int` and `I32` are both 32-bit integers, but on 32-bit
+ platforms I32 is `long int` and a simple `int` is 16-bit.
+Author: Damyan Ivanov <[email protected]>
+Forwarded: https://bz.apache.org/bugzilla/show_bug.cgi?id=69346
+
+--- a/glue/perl/xsbuilder/apreq_xs_tables.h
++++ b/glue/perl/xsbuilder/apreq_xs_tables.h
+@@ -24,6 +24,11 @@
+ 
+ /**************************************************/
+ 
++#if (PERL_VERSION >= 12)
++#define MG_COPY_NAMELEN I32
++#else
++#define MG_COPY_NAMELEN int
++#endif
+ 
+ #if (PERL_VERSION >= 8) /* MAGIC ITERATOR REQUIRES 5.8 */
+ 
+@@ -42,7 +47,7 @@
+  */
+ 
+ static int apreq_xs_cookie_table_magic_copy(pTHX_ SV *sv, MAGIC *mg, SV *nsv,
+-                                            const char *name, int namelen)
++                                            const char *name, MG_COPY_NAMELEN 
namelen)
+ {
+     /* Prefetch the value whenever the table iterator is > 0 */
+     MAGIC *tie_magic = mg_find(nsv, PERL_MAGIC_tiedelem);
+@@ -151,7 +156,7 @@ static int apreq_xs_cookie_table_values(
+  */
+ 
+ static int apreq_xs_param_table_magic_copy(pTHX_ SV *sv, MAGIC *mg, SV *nsv,
+-                                  const char *name, int namelen)
++                                  const char *name, MG_COPY_NAMELEN namelen)
+ {
+     /* Prefetch the value whenever the table iterator is > 0 */
+     MAGIC *tie_magic = mg_find(nsv, PERL_MAGIC_tiedelem);

diff --git a/www-apache/libapreq2/libapreq2-2.17-r2.ebuild 
b/www-apache/libapreq2/libapreq2-2.17-r2.ebuild
new file mode 100644
index 000000000000..44ddc70f8034
--- /dev/null
+++ b/www-apache/libapreq2/libapreq2-2.17-r2.ebuild
@@ -0,0 +1,84 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit apache-module perl-module
+
+DESCRIPTION="A library for manipulating client request data via the Apache API"
+HOMEPAGE="https://httpd.apache.org/apreq/";
+SRC_URI="mirror://apache/httpd/libapreq/${P}.tar.gz"
+
+LICENSE="Apache-2.0"
+SLOT="2"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~riscv ~x86"
+IUSE="perl test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+       || (
+               dev-libs/apr-util[openssl]
+               dev-libs/apr-util[nss]
+       )
+       perl? (
+               >=dev-perl/ExtUtils-XSBuilder-0.23
+               virtual/perl-version
+               >=www-apache/mod_perl-2
+       )
+       virtual/libcrypt:="
+DEPEND="
+       ${RDEPEND}
+       test? ( dev-perl/Apache-Test )"
+BDEPEND="sys-apps/file"
+
+PATCHES=(
+       "${FILESDIR}"/libapreq2-2.08-doc.patch
+       "${FILESDIR}"/libapreq2-2.08-fix-linkage.patch
+       "${FILESDIR}"/libapreq2-2.08-c99.patch
+)
+
+APACHE2_MOD_FILE="module/apache2/.libs/mod_apreq2.so"
+APACHE2_MOD_CONF="76_mod_apreq"
+APACHE2_MOD_DEFINE="APREQ"
+
+need_apache2
+
+pkg_setup() {
+       perl_set_version
+}
+
+src_prepare() {
+       default
+
+       sed -i -e "s/PERL \$PERL_OPTS/PERL/" acinclude.m4 aclocal.m4 configure 
|| die
+}
+
+src_configure() {
+       econf \
+               --disable-static \
+               --with-apache2-apxs=${APXS} \
+               $(use_enable perl perl-glue)
+}
+
+src_install() {
+       APACHE_MODULESDIR="/usr/$(get_libdir)/apache2/modules"
+       apache-module_src_install
+
+       emake DESTDIR="${D}" INSTALLDIRS=vendor install
+       doman docs/man/man3/*.3
+
+       perl_delete_localpod
+
+       HTML_DOCS=( docs/html/. )
+       einstalldocs
+       dodoc INSTALL MANIFEST
+
+       local f
+       while IFS="" read -d $'\0' -r f ; do
+               if file "${f}" | grep -i " text"; then
+                       sed -i -e "s:${ED}:/:g" "${f}" || die
+               fi
+       done < <(find "${ED}" -type f -not -name '*.so' -print0)
+
+       find "${ED}" -name '*.la' -delete || die
+}

Reply via email to