summaryrefslogtreecommitdiff
blob: 28ceffa1fc2be759e138d4557902edf83b81ac4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/www-apache/libapreq2/libapreq2-2.08-r1.ebuild,v 1.1 2007/08/19 11:36:17 hollow Exp $

inherit perl-module depend.apache multilib

IUSE="perl"

DESCRIPTION="An Apache Request Perl Module"
SRC_URI="mirror://cpan/authors/id/J/JO/JOESUF/${P}.tar.gz"
HOMEPAGE="http://httpd.apache.org/apreq/"
SLOT="2"
LICENSE="Apache-2.0"
KEYWORDS="alpha ~amd64 ~ppc ~ppc64 sparc x86"

DEPEND="${DEPEND}
	>=dev-perl/ExtUtils-XSBuilder-0.23
	dev-perl/version
	>=www-servers/apache-2.0.48
	>=www-apache/mod_perl-2"
RDEPEND="${DEPEND}"

mydoc="TODO README CHANGES INSTALL"
myconf="--with-apache2-apxs=${APXS2} --libdir=/usr/$(get_libdir)"
SRC_TEST="skip"

need_apache2

src_unpack() {
	unpack ${A}
	cd ${S}
	epatch ${FILESDIR}/libapreq2-2.08-doc.patch
	sed -i -e "s/PERL \$PERL_OPTS/PERL/" ${S}/acinclude.m4
	sed -i -e "s/PERL \$PERL_OPTS/PERL/" ${S}/aclocal.m4
	sed -i -e "s/PERL \$PERL_OPTS/PERL/" ${S}/configure
}
src_test() {
	if [ "${SRC_TEST}" == "do" ]; then
		if [ "`id -u`" == '0' ]; then
			chown nobody:nobody ${S}/module/t
			chown nobody:nobody ${T}
			GROUP="nobody" USER="nobody" \
				APACHE_TEST_NO_STICKY_PREFERENCES=1 \
				TMPDIR="${T}" HOME="${T}/" echo "" | emake test
		else
			APACHE_TEST_NO_STICKY_PREFERENCES=1 TMPDIR="${T}" HOME="${T}/" emake test
		fi
	fi
}

src_compile() {
	cd ${S}
	if use perl; then
		myconf="${myconf} --enable-perl-glue"
	fi
	./configure ${myconf}
}
src_install() {

	emake -j1 DESTDIR=${D} LT_LDFLAGS="-L${D}/usr/$(get_libdir)" install || die
	make docs
	rm -f ${S}/docs/man/man3/_*
	for doc in `ls ${S}/docs/man/man3/*.3`; do
		doman $doc
	done
	# install the html docs
	dohtml ${S}/docs/html/*.html

	insinto ${APACHE2_MODULES_CONFDIR}
	doins ${FILESDIR}/76_mod_apreq.conf

	fixlocalpod

	for FILE in `find ${D} -type f |grep -v '.so'`; do
		STAT=`file $FILE| grep -i " text"`
		if [ "${STAT}x" != "x" ]; then
			sed -i -e "s:${D}:/:g" ${FILE}
		fi
	done

	for doc in Change* MANIFEST* README* ${mydoc}; do
		[ -s "$doc" ] && dodoc $doc
	done

}

pkg_postinst() {
	elog
	elog "To enable ${PN}, you need to edit your /etc/conf.d/apache2 file and"
	elog "add '-D APREQ' to APACHE2_OPTS."
	elog "Configuration file installed as"
	elog "    ${APACHE2_MODULES_CONFDIR}/76_mod_apreq.conf"
	elog "You may want to edit it before turning the module on in /etc/conf.d/apache2"
	elog

}