summaryrefslogtreecommitdiff
blob: 4b61fd2d12edc34e65233cf4cbb96f4284bd7b30 (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
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-www/mod_bandwidth/mod_bandwidth-2.0.4.ebuild,v 1.6 2004/06/25 01:00:28 agriffis Exp $

DESCRIPTION="Bandwidth Management Module for Apache"
HOMEPAGE="http://www.cohprog.com/v3/bandwidth/intro-en.html"
SRC_URI="ftp://ftp.cohprog.com/pub/apache/module/1.3.0/mod_bandwidth.c"
LICENSE="Apache-1.1"
SLOT="0"
KEYWORDS="x86 ~sparc"
IUSE=""
DEPEND="=net-www/apache-1*"
RDEPEND=""

src_unpack() {
	mkdir -p ${S} && cp ${DISTDIR}/${A} ${S} || die
	cd ${S} || die
	patch <${FILESDIR}/mod_bandwidth-2.0.4-register.patch || die
}

src_compile() {
	apxs -c ${S}/mod_bandwidth.c -o ${S}/mod_bandwidth.so
}

src_install() {
	exeinto /usr/lib/apache-extramodules
	doexe ${PN}.so

	insinto /etc/apache/conf/addon-modules
	doins ${FILESDIR}/${PN}.conf

	dodoc ${PN}.c
}

pkg_postinst() {
	# empty dirs..
	install -m0755 -o apache -g apache -d \
		${ROOT}/var/cache/mod_bandwidth/{link,master}

	einfo
	einfo "Execute \"ebuild /var/db/pkg/net-www/${PF}/${PF}.ebuild config\""
	einfo "to have your apache.conf auto-updated for use with this module."
	einfo "You should then edit your /etc/conf.d/apache file to suit."
	einfo
	einfo "For configuration documentation, look at"
	einfo "http://www.cohprog.com/v3/bandwidth/doc-en.html"
	einfo
	einfo "Be sure to add -D BANDWIDTH to your /etc/conf.d/apache in order for"
	einfo "the module to be actually loaded."
	einfo
}

pkg_config() {
	${ROOT}/usr/sbin/apacheaddmod \
		${ROOT}/etc/apache/conf/apache.conf \
		extramodules/mod_bandwidth.so mod_bandwidth.c bandwidth_module \
		define=BANDWIDTH addconf=conf/addon-modules/mod_bandwidth.conf
	:;
}