1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit depend.apache apache-module perl-module eutils
9 DESCRIPTION="An embedded Perl interpreter for Apache2"
10 SRC_URI="mirror://apache/perl/${P}.tar.gz"
11 HOMEPAGE="https://projects.apache.org/projects/mod_perl.html"
14 KEYWORDS="alpha amd64 ~hppa ia64 ppc ppc64 sparc x86"
18 # Make sure we always use the latest Apache-Test version or even check the
19 # version of the bundled Apache-Test!
21 # We need both, apache and perl but either apache without threads or perl with
22 # ithreads, bug 373943
23 DEPEND="<www-servers/apache-2.4
24 >=dev-perl/Apache-Test-1.360
28 || ( www-servers/apache[-threads] dev-lang/perl[ithreads] )"
30 PDEPEND=">=dev-perl/Apache-Reload-0.11
31 >=dev-perl/Apache-SizeLimit-0.95"
33 APACHE2_MOD_FILE="${S}/src/modules/perl/mod_perl.so"
34 APACHE2_MOD_CONF="2.0.3/75_${PN}.2.2"
35 APACHE2_MOD_DEFINE="PERL"
39 DOCFILES="Changes INSTALL README STATUS"
44 perl-module_src_prepare
46 # I am not entirely happy with this solution, but here's what's
47 # going on here if someone wants to take a stab at another
48 # approach. When userpriv compilation is off, then the make
49 # process drops to user "nobody" to run the test servers. This
50 # server is closed, and then the socket is rebound using
51 # SO_REUSEADDR. If the same user does this, there is no problem,
52 # and the socket may be rebound immediately. If a different user
53 # (yes, in my testing, even root) attempts to rebind, it fails.
54 # Since the "is the socket available yet" code and the
55 # second-batch bind call both run as root, this will fail.
57 # The upstream settings on my test machine cause the second batch
58 # of tests to fail, believing the socket to still be in use. I
59 # tried patching various parts to make them run as the user
60 # specified in $config->{vars}{user} using getpwnam, but found
61 # this patch to be fairly intrusive, because the userid must be
62 # restored and the patch must be applied to multiple places.
64 # For now, we will simply extend the timeout in hopes that in the
65 # non-userpriv case, the socket will clear from the kernel tables
66 # normally, and the tests will proceed.
68 # If anybody is still having problems, then commenting out "make
69 # test" below should allow the software to build properly.
71 # Robert Coie <rac@gentoo.org> 2003.05.06
72 # sed -i -e "s/sleep \$_/sleep \$_ << 2/" \
73 # "${S}"/Apache-Test/lib/Apache/TestServer.pm \
74 # || die "problem editing TestServer.pm"
76 # rendhalver - this got redone for 2.0.1 and seems to fix the make test problems
77 epatch "${FILESDIR}"/mod_perl-2.0.1-sneak-tmpdir.patch
80 epatch "${FILESDIR}/${P}-bundled-Apache-Test.patch"
81 rm -rf Apache-{Test,Reload,SizeLimit}/ lib/Bundle/
82 sed -i -e 's:^Apache-\(Reload\|SizeLimit\|Test\).*::' \
83 -e 's:^lib/Bundle/Apache2.pm::' MANIFEST || die
90 myargs="MP_TRACE=1 MP_DEBUG=1"
92 myargs="MP_TRACE=0 MP_DEBUG=0"
96 PREFIX="${EPREFIX}"/usr \
104 # make test notes whether it is running as root, and drops
105 # privileges all the way to "nobody" if so, so we must adjust
106 # write permissions accordingly in this case.
108 # IF YOU SUDO TO EMERGE AND HAVE !env_reset set testing will fail!
109 if [[ "$(id -u)" == "0" ]]; then
110 chown nobody:nobody "${WORKDIR}"
111 chown nobody:nobody "${T}"
114 # this does not || die because of bug 21325. kudos to smark for
115 # the idea of setting HOME.
116 TMPDIR="${T}" HOME="${T}/" perl-module_src_test
120 apache-module_src_install
122 emake DESTDIR="${D}" install || die
124 # TODO: add some stuff from docs/ back?
126 # rendhalver - fix the perllocal.pod that gets installed
127 # it seems to me that this has been getting installed for ages
129 # Remove empty .bs files as well
132 insinto "${APACHE_MODULES_CONFDIR}"
133 doins "${FILESDIR}"/2.0.3/apache2-mod_perl-startup.pl || die
135 # this is an attempt to get @INC in line with /usr/bin/perl.
136 # there is blib garbage in the mainstream one that can only be
137 # useful during internal testing, so we wait until here and then
138 # just go with a clean slate. should be much easier to see what's
139 # happening and revert if problematic.
141 # Sorry for this evil hack...
142 perl_set_version # just to be sure...
143 sed -i -e "s,-I${S}/[^[:space:]\"\']\+[[:space:]]\?,,g" \
144 -e "s,-typemap[[:space:]]${S}/[^[:space:]\"\']\+[[:space:]]\?,,g" \
145 -e "s,${S}\(/[^[:space:]\"\']\+\)\?,/,g" "${D}/${VENDOR_ARCH}/Apache2/BuildConfig.pm" || die
147 for fname in $(find "${D}" -type f -not -name '*.so'); do
148 grep -q "\(${D}\|${S}\)" "${fname}" && ewarn "QA: File contains a temporary path ${fname}"
149 sed -i -e "s:\(${D}\|${S}\):/:g" ${fname}
156 apache-module_pkg_postinst