Subject: [alpine-aports] [PATCH] testing/apache2-mod-perl: more refined patch to work with perl 5.22

From: Valery Kartel <[email-masked]>
Date: Fri, 20 Nov 2015 16:12:50 +0200

This patch is replaces the previous one: http://patchwork.alpinelinux.org/patch/851/

- all unused patches and post-install script are removed
- added the latest patch from https://rt.cpan.org/Public/Bug/Display.html?id=101962#txn-1558194
- many tests are fail, so 'make test' is not included in build()
- some minor cleanups in APKBUILD

Now apache not crashes to segfault with this module ;)
---
 testing/apache2-mod-perl/APKBUILD                  | 54 +++++++----------
 .../apache2-mod-perl/apache2-mod-perl.apache2.conf | 11 ----
 testing/apache2-mod-perl/apache2-mod-perl.conf     | 11 ++++
 .../apache2-mod-perl/apache2-mod-perl.post-install | 10 ----
 .../apache2-mod-perl/mod_perl-2.0.5-nolfs.patch    | 14 -----
 .../apache2-mod-perl/mod_perl-2.0.6-nolfs.patch    | 13 ----
 testing/apache2-mod-perl/mod_perl-remote-ip.patch  | 70 ----------------------
 7 files changed, 31 insertions(+), 152 deletions(-)
 delete mode 100644 testing/apache2-mod-perl/apache2-mod-perl.apache2.conf
 create mode 100644 testing/apache2-mod-perl/apache2-mod-perl.conf
 delete mode 100644 testing/apache2-mod-perl/apache2-mod-perl.post-install
 delete mode 100644 testing/apache2-mod-perl/mod_perl-2.0.5-nolfs.patch
 delete mode 100644 testing/apache2-mod-perl/mod_perl-2.0.6-nolfs.patch
 delete mode 100644 testing/apache2-mod-perl/mod_perl-remote-ip.patch

diff --git a/testing/apache2-mod-perl/APKBUILD b/testing/apache2-mod-perl/APKBUILD
index 1be93cf..284fdbf 100644
--- a/testing/apache2-mod-perl/APKBUILD
+++ b/testing/apache2-mod-perl/APKBUILD
@@ -1,28 +1,30 @@
+# Contributor: Valery Kartel <[email-masked]>
 # Contributor: Matt Smith <[email-masked]>
 # Maintainer: Matt Smith <[email-masked]>
 pkgname=apache2-mod-perl
-_realname=mod_perl
+_pkgreal=mod_perl
 pkgver=2.0.9
 _pkgver=${pkgver/_rc1/-rc1}
-pkgrel=1
+pkgrel=2
 pkgdesc="Perl Module for Apache2"
 url="http://perl.apache.org/"
 arch="all"
 license="ASL 2.0"
-depends="apache2 perl"
+depends="apache2"
 depends_dev="$pkgname"
 makedepends="$depends_dev apache2-dev perl-dev perl-linux-pid apr-dev apr-util-dev"
-install="$pkgname.post-install"
+install=""
 subpackages="$pkgname-doc $pkgname-dev"
-source="http://www.eu.apache.org/dist/perl/mod_perl-$pkgver.tar.gz
-	$pkgname.apache2.conf"
+source="http://www.eu.apache.org/dist/perl/$_pkgreal-$pkgver.tar.gz
+	https://rt.cpan.org/Public/Ticket/Attachment/1549932/827564/env2.patch
+	$pkgname.conf"
 
-_builddir="$srcdir"/${_realname}-${_pkgver}
+_builddir="$srcdir"/${_pkgreal}-${_pkgver}
 prepare() {
 	cd "$_builddir"
 	for i in $source; do
 		case $i in
-		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+		*.patch) msg $i; [ ! -f "$srcdir"/$i ]; patch -p$? -i "$srcdir"/${i##*/} || return 1;;
 		esac
 	done
 }
@@ -33,6 +35,7 @@ build() {
 	make xs_generate
 
 	PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor \
+		MP_CCOPTS=-fgnu89-inline \
 		MP_APXS=/usr/bin/apxs \
 		MP_APR_CONFIG=/usr/bin/apr-1-config || return 1
 	make || return 1
@@ -42,34 +45,17 @@ package() {
 	cd "$_builddir"
 	make DESTDIR="$pkgdir" install || return 1
 	find "$pkgdir" \( -name perllocal.pod -o -name .packlist \) -delete
-
-	# install the apache2 config
-	install -Dm644 "$srcdir"/$pkgname.apache2.conf \
-		"$pkgdir"/etc/apache2/conf.d/perl-module.conf || return 1
-}
-
-doc() {
-	arch="noarch"
-
-	# man pages
-	mkdir -p "$subpkgdir"/usr/share/man || return 1
-	mv "$pkgdir"/usr/share/man/man* "$subpkgdir"/usr/share/man/ \
-		|| return 1
-
-	# doc files
-	_docs="BRANCHING Changes INSTALL LICENSE MANIFEST NOTICE README \
-	README-SVN RELEASE STATUS SVN-MOVE"
-	for _doc in $_docs; do
-		install -Dm644 "$_builddir"/$_doc \
-			"$subpkgdir"/usr/share/doc/$pkgname/$_doc || return 1
-	done
-	cp -ra "$_builddir"/docs/ "$subpkgdir"/usr/share/doc/$pkgname/ \
-		|| return 1
+	rm -fr "$pkgdir"/usr/bin
+	install -Dm644 "$srcdir"/$pkgname.conf \
+		"$pkgdir"/etc/apache2/conf.d/$_pkgreal.conf || return 1
 }
 
 md5sums="fdab9a145bf35f54fce997c96c76f8e2  mod_perl-2.0.9.tar.gz
-86b84bb56b49a95772a7f773fc019043  apache2-mod-perl.apache2.conf"
+f8c2de81056faea64a4d5e53fef9fb99  env2.patch
+86b84bb56b49a95772a7f773fc019043  apache2-mod-perl.conf"
 sha256sums="0260f26ab771c1c95fadc67544b3400e420bb30b8a77565d2d02ad05498ef52b  mod_perl-2.0.9.tar.gz
-92dfc84c1506f34fc55cb65f4f2b0399254d811a03c5bcea1e6cf010e60a5227  apache2-mod-perl.apache2.conf"
+6d2cd5d39dc6a53e5c9e2211f6e59d195af582ffa0313f61cb08d1654a456a6f  env2.patch
+92dfc84c1506f34fc55cb65f4f2b0399254d811a03c5bcea1e6cf010e60a5227  apache2-mod-perl.conf"
 sha512sums="421d385f0d5d04cbe8c1e9559960eea86a017fa1bed88e614009143550baf852e2345001faff1fb849d9b3e6383786e0011f45ebc3e7d26ad57651fbad4e2f2c  mod_perl-2.0.9.tar.gz
-716650058af077b0494833301f3dfdf517499bdb2021427431cacc7f63e5fe520cd6f5f7daee44bed15e257c9a2d1fb7d18a75954455fa894dd24a8ef32af50b  apache2-mod-perl.apache2.conf"
+add28358a740005baa0891d910ea8597341a3cb07f6baa629059c782d90282b4a1e8275d2fffe6d90d0faac9820037e5e06ab4196d1beb6a663634b7f0832bdd  env2.patch
+716650058af077b0494833301f3dfdf517499bdb2021427431cacc7f63e5fe520cd6f5f7daee44bed15e257c9a2d1fb7d18a75954455fa894dd24a8ef32af50b  apache2-mod-perl.conf"
diff --git a/testing/apache2-mod-perl/apache2-mod-perl.apache2.conf b/testing/apache2-mod-perl/apache2-mod-perl.apache2.conf
deleted file mode 100644
index c1a75c7..0000000
--- a/testing/apache2-mod-perl/apache2-mod-perl.apache2.conf
+++ /dev/null
@@ -1,11 +0,0 @@
-LoadModule perl_module modules/mod_perl.so
-
-# For mod_perl 1.0 compatibility, uncomment:
-#PerlModule Apache2::compat
-
-<Location /cgi-bin>
-    AddHandler perl-script .pl
-    PerlResponseHandler ModPerl::Registry
-    PerlOptions +ParseHeaders
-    Options +ExecCGI
-</Location>
diff --git a/testing/apache2-mod-perl/apache2-mod-perl.conf b/testing/apache2-mod-perl/apache2-mod-perl.conf
new file mode 100644
index 0000000..c1a75c7
--- /dev/null
+++ b/testing/apache2-mod-perl/apache2-mod-perl.conf
@@ -0,0 +1,11 @@
+LoadModule perl_module modules/mod_perl.so
+
+# For mod_perl 1.0 compatibility, uncomment:
+#PerlModule Apache2::compat
+
+<Location /cgi-bin>
+    AddHandler perl-script .pl
+    PerlResponseHandler ModPerl::Registry
+    PerlOptions +ParseHeaders
+    Options +ExecCGI
+</Location>
diff --git a/testing/apache2-mod-perl/apache2-mod-perl.post-install b/testing/apache2-mod-perl/apache2-mod-perl.post-install
deleted file mode 100644
index 8cfc5a8..0000000
--- a/testing/apache2-mod-perl/apache2-mod-perl.post-install
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-echo "*" >&2
-echo "* To finish installing apache2-mod-perl:" >&2
-echo "*     1) See if you need to modify the apache2 config:" >&2
-echo "*            /etc/apache2/conf.d/perl-module.conf" >&2
-echo "*     2) Restart apache2 when done." >&2
-echo "*" >&2
-
-exit 0
diff --git a/testing/apache2-mod-perl/mod_perl-2.0.5-nolfs.patch b/testing/apache2-mod-perl/mod_perl-2.0.5-nolfs.patch
deleted file mode 100644
index 3eb345b..0000000
--- a/testing/apache2-mod-perl/mod_perl-2.0.5-nolfs.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-Index: mod_perl-2.0.5/lib/Apache2/Build.pm
-===================================================================
---- mod_perl-2.0.5.orig/lib/Apache2/Build.pm	2011-02-02 21:23:47.000000000 +0100
-+++ mod_perl-2.0.5/lib/Apache2/Build.pm	2011-05-26 17:12:46.276946520 +0200
-@@ -2147,7 +2147,8 @@ sub has_large_files_conflict {
-     # with it is that we didn't have such a case yet, but may need to
-     # deal with it later
- 
--    return $perl_lfs64 ^ $apr_lfs64;
-+    return 0;
-+    # $perl_lfs64 ^ $apr_lfs64;
- }
- 
- # if perl is built with uselargefiles, but apr not, the build won't
diff --git a/testing/apache2-mod-perl/mod_perl-2.0.6-nolfs.patch b/testing/apache2-mod-perl/mod_perl-2.0.6-nolfs.patch
deleted file mode 100644
index 13e5ccc..0000000
--- a/testing/apache2-mod-perl/mod_perl-2.0.6-nolfs.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff -upr mod_perl-2.0.6.orig/lib/Apache2/Build.pm mod_perl-2.0.6/lib/Apache2/Build.pm
---- mod_perl-2.0.6.orig/lib/Apache2/Build.pm	2012-05-26 22:31:00.000000000 +0300
-+++ mod_perl-2.0.6/lib/Apache2/Build.pm	2012-05-26 22:31:32.000000000 +0300
-@@ -2207,7 +2207,8 @@ sub has_large_files_conflict {
-     # with it is that we didn't have such a case yet, but may need to
-     # deal with it later
- 
--    return $perl_lfs64 ^ $apr_lfs64;
-+    return 0;
-+    # $perl_lfs64 ^ $apr_lfs64;
- }
- 
- # if perl is built with uselargefiles, but apr not, the build won't
diff --git a/testing/apache2-mod-perl/mod_perl-remote-ip.patch b/testing/apache2-mod-perl/mod_perl-remote-ip.patch
deleted file mode 100644
index e39d629..0000000
--- a/testing/apache2-mod-perl/mod_perl-remote-ip.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-Index: xs/tables/current/Apache2/StructureTable.pm
-===================================================================
---- a/xs/tables/current/Apache2/StructureTable.pm	(revision 1324590)
-+++ b/xs/tables/current/Apache2/StructureTable.pm	(working copy)
-@@ -2708,11 +2708,11 @@
-       },
-       {
-         'type' => 'apr_sockaddr_t *',
--        'name' => 'remote_addr'
-+        'name' => 'client_addr'
-       },
-       {
-         'type' => 'char *',
--        'name' => 'remote_ip'
-+        'name' => 'client_ip'
-       },
-       {
-         'type' => 'char *',
-@@ -2955,6 +2955,14 @@
-       },
-       {
-         'type' => 'char *',
-+        'name' => 'useragent_ip'
-+      },
-+      {
-+        'type' => 'apr_sockaddr_t *',
-+        'name' => 'useragent_addr'
-+      },
-+      {
-+        'type' => 'char *',
-         'name' => 'the_request'
-       },
-       {
-@@ -3245,10 +3253,6 @@
-       },
-       {
-         'type' => 'int',
--        'name' => 'loglevel'
--      },
--      {
--        'type' => 'int',
-         'name' => 'is_virtual'
-       },
-       {
-Index: Apache-Reload/Makefile.PL
-===================================================================
---- a/Apache-Reload/Makefile.PL	(revision 1324590)
-+++ b/Apache-Reload/Makefile.PL	(working copy)
-@@ -11,7 +11,7 @@
- # MOD_PERL_2_BUILD is set from building from mod_perl Makefile.PL which should
- # also set MP_APXS
- if ($ENV{MOD_PERL_2_BUILD}) {
--    push @ARGV, "-apxs", $ENV{MP_APXS};
-+    push @ARGV, "-apxs $ENV{MP_APXS}";
-     my $mp_gen = satisfy_mp_generation(2);
- }
- else {
-Index: Apache-SizeLimit/Makefile.PL
-===================================================================
---- a/Apache-SizeLimit/Makefile.PL	(revision 1324590)
-+++ b/Apache-SizeLimit/Makefile.PL	(working copy)
-@@ -11,7 +11,7 @@
- # MOD_PERL_2_BUILD is set from building from mod_perl Makefile.PL which should
- # also set MP_APXS
- if ($ENV{MOD_PERL_2_BUILD}) {
--    push @ARGV, "-apxs", $ENV{MP_APXS};
-+    push @ARGV, "-apxs $ENV{MP_APXS}";
-     my $mp_gen = satisfy_mp_generation(2);
- }
- else {
-- 
2.6.3

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---