]> gitweb.michael.orlitzky.com - mjo-overlay.git/blob - www-apache/mod_perl/mod_perl-2.0.8-r1.ebuild
app-backup/backuppc: working apache-2.4 ebuild.
[mjo-overlay.git] / www-apache / mod_perl / mod_perl-2.0.8-r1.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI="5"
6
7 inherit depend.apache apache-module perl-module eutils
8
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"
12
13 LICENSE="GPL-2"
14 KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86"
15 IUSE="debug"
16 SLOT="1"
17
18 # Make sure we always use the latest Apache-Test version or even check the
19 # version of the bundled Apache-Test!
20 #
21 # We need both, apache and perl but either apache without threads or perl with
22 # ithreads, bug 373943
23 DEPEND="
24 >=dev-perl/Apache-Test-1.360
25 >=dev-perl/CGI-3.08
26 dev-lang/perl[ithreads]
27 www-servers/apache
28 "
29 RDEPEND="${DEPEND}"
30 PDEPEND=">=dev-perl/Apache-Reload-0.11
31 >=dev-perl/Apache-SizeLimit-0.95"
32
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"
36
37 SRC_TEST="do"
38
39 DOCFILES="Changes INSTALL README STATUS"
40
41 need_apache2_4
42
43 src_prepare() {
44 perl-module_src_prepare
45
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.
56
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.
63
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.
67
68 # If anybody is still having problems, then commenting out "make
69 # test" below should allow the software to build properly.
70
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"
75
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
78
79 # bug 352724
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
84
85 # 410453
86 epatch "${FILESDIR}/use-client_ip-client_add-instead-of-remote_ip-remote.patch"
87 epatch "${FILESDIR}/use-log.level-instead-of-loglevel.patch"
88 }
89
90 src_configure() {
91 local myargs=
92
93 if use debug; then
94 myargs="MP_TRACE=1 MP_DEBUG=1"
95 else
96 myargs="MP_TRACE=0 MP_DEBUG=0"
97 fi
98
99 perl Makefile.PL \
100 PREFIX="${EPREFIX}"/usr \
101 INSTALLDIRS=vendor \
102 MP_USE_DSO=1 \
103 MP_APXS=${APXS} \
104 MP_APR_CONFIG=/usr/bin/apr-1-config \
105 ${myargs} || die
106 }
107
108 src_test() {
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.
112
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}"
117 fi
118
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
122 }
123
124 src_install() {
125 apache-module_src_install
126
127 emake DESTDIR="${D}" install || die
128
129 # TODO: add some stuff from docs/ back?
130
131 # rendhalver - fix the perllocal.pod that gets installed
132 # it seems to me that this has been getting installed for ages
133 perl_delete_localpod
134 # Remove empty .bs files as well
135 perl_delete_packlist
136
137 insinto "${APACHE_MODULES_CONFDIR}"
138 doins "${FILESDIR}"/2.0.3/apache2-mod_perl-startup.pl || die
139
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.
145
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
151
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}
155 done
156 # All the rest
157 perl_remove_temppath
158 }
159
160 pkg_postinst() {
161 apache-module_pkg_postinst
162 }