|
| 1 | +# Copyright 1999-2020 Gentoo Authors |
| 2 | +# Distributed under the terms of the GNU General Public License v2 |
| 3 | + |
| 4 | +EAPI=5 |
| 5 | + |
| 6 | +inherit depend.apache apache-module perl-module eutils |
| 7 | + |
| 8 | +DESCRIPTION="An embedded Perl interpreter for Apache2" |
| 9 | +HOMEPAGE="https://perl.apache.org/ https://projects.apache.org/project.html?perl-mod_perl" |
| 10 | +SRC_URI="mirror://apache/perl/${P}.tar.gz" |
| 11 | + |
| 12 | +LICENSE="Apache-2.0" |
| 13 | +SLOT="1" |
| 14 | +KEYWORDS="~alpha ~amd64 ~arm ~ppc ~ppc64 ~x86" |
| 15 | +IUSE="debug ithreads test" |
| 16 | +RESTRICT="!test? ( test )" |
| 17 | + |
| 18 | +SRC_TEST=do |
| 19 | + |
| 20 | +# Apache::Reload, Apache::SizeLimit, and Apache::Test are force-unbundled. |
| 21 | +# The minimum versions requested here are the bundled versions. |
| 22 | + |
| 23 | +# The test dependencies are from CPAN (Bundle::Apache2). |
| 24 | + |
| 25 | +# When all MPMs are disabled via useflags, the apache ebuild selects a |
| 26 | +# default one, which will likely need threading. |
| 27 | + |
| 28 | +RDEPEND=" |
| 29 | + dev-lang/perl[ithreads=] |
| 30 | + >=dev-perl/Apache-Test-1.420.0 |
| 31 | + >=www-servers/apache-2.0.47 |
| 32 | + >=dev-libs/apr-util-1.4 |
| 33 | + !ithreads? ( www-servers/apache[-apache2_mpms_event,-apache2_mpms_worker,apache2_mpms_prefork] ) |
| 34 | +" |
| 35 | +DEPEND="${RDEPEND} |
| 36 | + dev-perl/Module-Build |
| 37 | + test? ( |
| 38 | + >=dev-perl/CGI-3.110.0 |
| 39 | + dev-perl/Chatbot-Eliza |
| 40 | + dev-perl/Devel-Symdump |
| 41 | + dev-perl/HTML-Parser |
| 42 | + dev-perl/IPC-Run3 |
| 43 | + dev-perl/libwww-perl |
| 44 | + www-servers/apache[apache2_modules_version,-apache2_modules_unique_id] |
| 45 | + !www-apache/mpm_itk |
| 46 | + ) |
| 47 | +" |
| 48 | +PDEPEND=" |
| 49 | + >=dev-perl/Apache-Reload-0.130.0 |
| 50 | + >=dev-perl/Apache-SizeLimit-0.970.0 |
| 51 | +" |
| 52 | + |
| 53 | +APACHE2_MOD_FILE="${S}/src/modules/perl/mod_perl.so" |
| 54 | +APACHE2_MOD_CONF="2.0.3/75_${PN}" |
| 55 | +APACHE2_MOD_DEFINE="PERL" |
| 56 | + |
| 57 | +need_apache2 |
| 58 | + |
| 59 | +PATCHES=( |
| 60 | + "${FILESDIR}/${PN}"-2.0.1-sneak-tmpdir.patch # seems to fix the make test problem |
| 61 | + "${FILESDIR}/${PN}"-2.0.4-inline.patch # 550244 |
| 62 | + "${FILESDIR}/${PN}"-2.0.10_rc1-bundled-Apache-Test.patch # 352724 |
| 63 | + "${FILESDIR}/${PN}"-2.0.10_rc1-Gentoo-not-Unix.patch |
| 64 | +) |
| 65 | + |
| 66 | +src_prepare() { |
| 67 | + perl-module_src_prepare |
| 68 | + |
| 69 | + # chainsaw unbundling |
| 70 | + rm -rf Apache-{Test,Reload,SizeLimit}/ lib/Bundle/ || die |
| 71 | +} |
| 72 | + |
| 73 | +src_configure() { |
| 74 | + local debug=$(usex debug 1 0) |
| 75 | + local nothreads=$(usex ithreads 0 1) |
| 76 | + myconf=( |
| 77 | + MP_USE_DSO=1 |
| 78 | + MP_APXS=${APXS} |
| 79 | + MP_APR_CONFIG=/usr/bin/apr-1-config |
| 80 | + MP_TRACE=${debug} |
| 81 | + MP_DEBUG=${debug} |
| 82 | + MP_NO_THREADS=${nothreads} |
| 83 | + ) |
| 84 | + |
| 85 | + perl-module_src_configure |
| 86 | +} |
| 87 | + |
| 88 | +src_test() { |
| 89 | + # make test notes whether it is running as root, and drops |
| 90 | + # privileges all the way to "nobody" if so, so we must adjust |
| 91 | + # write permissions accordingly in this case. |
| 92 | + |
| 93 | + # IF YOU SUDO TO EMERGE AND HAVE !env_reset set testing will fail! |
| 94 | + if [[ "$(id -u)" == "0" ]]; then |
| 95 | + chown nobody:nobody "${WORKDIR}" "${T}" || die |
| 96 | + fi |
| 97 | + |
| 98 | + # We force verbose tests for now to get meaningful bug reports. |
| 99 | + MAKEOPTS+=" -j1" |
| 100 | + TMPDIR="${T}" HOME="${T}/" TEST_VERBOSE=1 LC_TIME=C perl-module_src_test |
| 101 | +} |
| 102 | + |
| 103 | +src_install() { |
| 104 | + apache-module_src_install |
| 105 | + |
| 106 | + default |
| 107 | + |
| 108 | + perl_delete_localpod |
| 109 | + perl_delete_packlist |
| 110 | + |
| 111 | + insinto "${APACHE_MODULES_CONFDIR}" |
| 112 | + doins "${FILESDIR}"/2.0.3/apache2-mod_perl-startup.pl |
| 113 | + |
| 114 | + # this is an attempt to get @INC in line with /usr/bin/perl. |
| 115 | + # there is blib garbage in the mainstream one that can only be |
| 116 | + # useful during internal testing, so we wait until here and then |
| 117 | + # just go with a clean slate. should be much easier to see what's |
| 118 | + # happening and revert if problematic. |
| 119 | + |
| 120 | + perl_set_version |
| 121 | + sed -i \ |
| 122 | + -e "s,-I${S}/[^[:space:]\"\']\+[[:space:]]\?,,g" \ |
| 123 | + -e "s,-typemap[[:space:]]${S}/[^[:space:]\"\']\+[[:space:]]\?,,g" \ |
| 124 | + -e "s,${S}\(/[^[:space:]\"\']\+\)\?,/,g" \ |
| 125 | + "${D}/${VENDOR_ARCH}/Apache2/BuildConfig.pm" || die |
| 126 | + |
| 127 | + local fname |
| 128 | + for fname in $(find "${D}" -type f -not -name '*.so'); do |
| 129 | + grep -q "\(${D}\|${S}\)" "${fname}" && ewarn "QA: File contains a temporary path ${fname}" |
| 130 | + sed -i -e "s:\(${D}\|${S}\):/:g" ${fname} || die |
| 131 | + done |
| 132 | + |
| 133 | + perl_remove_temppath |
| 134 | +} |
| 135 | + |
| 136 | +pkg_postinst() { |
| 137 | + apache-module_pkg_postinst |
| 138 | +} |
0 commit comments