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
24 >=dev-perl/Apache-Test-1.360
26 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}"
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
86 epatch "${FILESDIR}/use-client_ip-client_add-instead-of-remote_ip-remote.patch"
87 epatch "${FILESDIR}/use-log.level-instead-of-loglevel.patch"
94 myargs="MP_TRACE=1 MP_DEBUG=1"
96 myargs="MP_TRACE=0 MP_DEBUG=0"
100 PREFIX="${EPREFIX}"/usr \
104 MP_APR_CONFIG=/usr/bin/apr-1-config \
109 # make test notes whether it is running as root, and drops
110 # privileges all the way to "nobody" if so, so we must adjust
111 # write permissions accordingly in this case.
113 # IF YOU SUDO TO EMERGE AND HAVE !env_reset set testing will fail!
114 if [[ "$(id -u)" == "0" ]]; then
115 chown nobody:nobody "${WORKDIR}"
116 chown nobody:nobody "${T}"
119 # this does not || die because of bug 21325. kudos to smark for
120 # the idea of setting HOME.
121 TMPDIR="${T}" HOME="${T}/" perl-module_src_test
125 apache-module_src_install
127 emake DESTDIR="${D}" install || die
129 # TODO: add some stuff from docs/ back?
131 # rendhalver - fix the perllocal.pod that gets installed
132 # it seems to me that this has been getting installed for ages
134 # Remove empty .bs files as well
137 insinto "${APACHE_MODULES_CONFDIR}"
138 doins "${FILESDIR}"/2.0.3/apache2-mod_perl-startup.pl || die
140 # this is an attempt to get @INC in line with /usr/bin/perl.
141 # there is blib garbage in the mainstream one that can only be
142 # useful during internal testing, so we wait until here and then
143 # just go with a clean slate. should be much easier to see what's
144 # happening and revert if problematic.
146 # Sorry for this evil hack...
147 perl_set_version # just to be sure...
148 sed -i -e "s,-I${S}/[^[:space:]\"\']\+[[:space:]]\?,,g" \
149 -e "s,-typemap[[:space:]]${S}/[^[:space:]\"\']\+[[:space:]]\?,,g" \
150 -e "s,${S}\(/[^[:space:]\"\']\+\)\?,/,g" "${D}/${VENDOR_ARCH}/Apache2/BuildConfig.pm" || die
152 for fname in $(find "${D}" -type f -not -name '*.so'); do
153 grep -q "\(${D}\|${S}\)" "${fname}" && ewarn "QA: File contains a temporary path ${fname}"
154 sed -i -e "s:\(${D}\|${S}\):/:g" ${fname}
161 apache-module_pkg_postinst