summaryrefslogtreecommitdiff
blob: 3df5a4226df0dce7f878f78fd413473bdbd96e0d (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
97
98
99
100
101
102
103
104
105
106
107
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-www/mod_contribs/mod_contribs-1.0.8-r1.ebuild,v 1.18 2004/07/06 01:01:54 zul Exp $

# The mod_layout and mod_random that come in the archive are really old,
# so I've replaced them with more current versions.
mod_layout_ver=3.0.3
mod_random_ver=1.4

DESCRIPTION="Collection of third-party contributed modules for Apache"
HOMEPAGE="http://www.apache.org/dist/httpd/contrib/modules/1.3/"
S=${WORKDIR}/apache-contrib-${PV}
SRC_URI="http://archive.apache.org/dist/httpd/contrib/modules/1.3/apache-contrib-${PV}.tar.gz"

KEYWORDS="x86 sparc"
LICENSE="Apache-1.1"
SLOT="0"

DEPEND="virtual/libc
	=net-www/apache-1*"
RDEPEND=""
IUSE=""

MY_MODS="mod_allowdev mod_auth_system mod_disallow_id mod_lock
	mod_auth_cookie mod_bandwidth mod_eaccess mod_macro mod_roaming
	mod_auth_cookie_file mod_cache mod_fastcgi mod_peephole mod_session
	mod_auth_external mod_cgisock mod_ip_forwarding mod_put mod_ticket
	mod_auth_inst mod_cvs mod_qs2ssi mod_urlcount"

src_unpack() {
	unpack ${A} ; cd ${S}

	# update mod_random..
	cd ${S}/mod_random
	rm -f mod_random.c
	cp ${S}/../mod_random-${mod_random_ver}/{mod_random.c,README,faq.html} .

	# update mod_layout..
	cd ${S}/mod_layout
	rm -f mod_layout.c
	cp ${S}/../mod_layout-${mod_layout_ver}/{*.c,*.h,README,faq.html,directives/*} .
	cp Makefile Makefile.orig
	sed -e "s%^\(SRCS\)\(.*\)%\1\2 utility.c origin.c footer.c header.c%" \
		Makefile.orig > Makefile

	# fix to be like others: libcache.so -> mod_cache.so
	cd ${S}/mod_cache
	cp Makefile Makefile.orig
	sed -e "s%^\(DSO\).*%\1=mod_cache.so%" Makefile.orig > Makefile
}

src_compile() {
	emake || die "compile problem"
}

src_install() {
	local i
	for i in ${MY_MODS}
	do
		if [ -f $i/$i.so ]
		then
			exeinto /usr/lib/apache-extramodules
			doexe $i/$i.so
		fi
		if [ -f $i/README ]
		then
			docinto $i
			dodoc $i/README
		fi
		if [ -f $i/00BLURB ]
		then
			docinto $i
			dodoc $i/00BLURB
		fi
		ls $i/*.html >/dev/null 2>&1
		if [ $? -eq 0 ]
		then
			dodir /usr/share/doc/${PF}/${i}/html
			cp $i/*.html ${D}/usr/share/doc/${PF}/${i}/html
		fi
	done
}

pkg_postinst() {
	einfo
	einfo "Execute \"ebuild /var/db/pkg/net-www/${PF}/${PF}.ebuild config\""
	einfo "to have your apache.conf auto-updated for use with these modules."
	einfo "You should then edit your /etc/conf.d/apache file to suit."
	einfo
}

pkg_config() {
	local i j k
	for i in ${MY_MODS}
	do
		j="`echo $i | sed -e 's%mod_\(.*\)%\1%'`"
		k="`echo $j | tr a-z A-Z`"
		${ROOT}/usr/sbin/apacheaddmod \
			${ROOT}/etc/apache/conf/apache.conf \
			extramodules/$i.so $i.c ${j}_module define=$k
		if [ ! $? ]
		then
			ewarn "hrmph, problem auto-updating apache.conf for $i!"
		fi
	done
	:;
}