summaryrefslogtreecommitdiff
blob: e4c4bb0bf4f406f2cfe99471592ba1ce44e1a87a (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
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-python/mod_python/mod_python-3.1.3.ebuild,v 1.10 2005/02/11 19:45:40 pythonhead Exp $

inherit python eutils

DESCRIPTION="An Apache2 DSO providing an embedded Python interpreter"
HOMEPAGE="http://www.modpython.org/"
SRC_URI="mirror://apache/modpython/${P}.tgz"
LICENSE="Apache-1.1"
SLOT="0"
KEYWORDS="x86 alpha ppc ~sparc ~amd64"
IUSE=""
DEPEND="dev-lang/python
	>=net-www/apache-2.0"

src_unpack() {
	unpack ${A} || die
	cd ${S} || die
	# remove optimisations, we do that outside portage
	sed -i -e 's:--optimize 2:--no-compile:' dist/Makefile.in

	# Fix compilation when using Python-2.3
	has_version ">=dev-lang/python-2.3" && \
		sed -i -e 's:LONG_LONG:PY_LONG_LONG:g' \
		"${S}/src/requestobject.c"
	#Fixes publisher info leak bug# 80109 CAN-2005-0088
	epatch ${FILESDIR}/publisher-2.diff
}

src_compile() {
	./configure --with-apxs=/usr/sbin/apxs2 || die
	make OPT="`apxs2 -q CFLAGS` -fPIC" || die
}

src_install() {
	dodir /usr/lib/apache2-extramodules
	make install DESTDIR=${D} LIBEXECDIR=/usr/lib/apache2-extramodules || die
	insinto /etc/apache2/conf/modules.d
	doins ${FILESDIR}/16_mod_python.conf
	dodoc ${FILESDIR}/16_mod_python.conf README NEWS CREDITS COPYRIGHT
	dohtml doc-html/*
	insinto /usr/share/doc/${PF}/html/icons
	doins doc-html/icons/*
}

pkg_postinst() {
	python_version
	python_mod_optimize /usr/lib/python${PYVER}/site-packages/mod_python

	einfo "To have Apache run python programs, please do the following:"
	einfo "Edit /etc/conf.d/apache2 and add \"-D PYTHON\""
	einfo "That will setup Apache to load python when it starts."
	einfo
	einfo "If you're new to mod_python there's a manual and tutorial"
	einfo "installed in /usr/share/doc/${PF}/html/index.html."
}

pkg_postrm() {
	python_mod_cleanup
}