summaryrefslogtreecommitdiff
blob: 33032113976e21db0774b03ee1281a7304d5317a (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
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/www-servers/monkeyd/monkeyd-0.9.2.ebuild,v 1.2 2008/10/21 19:30:54 bangert Exp $

inherit toolchain-funcs depend.php

WEBROOT=/var/www/localhost

MY_P="${PN/d}-${PV}"
DESCRIPTION="fast, efficient, (REALLY) small, and easy to configure web server"
HOMEPAGE="http://monkeyd.sourceforge.net/"
SRC_URI="http://monkeyd.sourceforge.net/versions/${MY_P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~mips ~ppc ~sparc ~x86"
IUSE="php"

RDEPEND="php? ( virtual/httpd-php )"

S="${WORKDIR}/${MY_P}"

pkg_setup() {
	use php && require_php_cgi
}

src_unpack() {
	unpack ${A}
	cd "${S}"
	epatch "${FILESDIR}/monkeyd-dont-strip-configure.patch"
	sed -i '/install -m 755 bin\/banana/d' configure || die "sed banana"
}

src_compile() {
	# monkey has it's own funky script ... cant use econf
	env STRIP=true \
	./configure \
		--prefix=/usr \
		--bindir=/usr/bin \
		--cgibin=${WEBROOT}/cgi-bin \
		--sysconfdir=/etc/${PN} \
		--datadir=${WEBROOT}/htdocs \
		--logdir=/var/log/${PN} \
		--lang=en \
		|| die
	# Don't install the banana script, it is broken as is anyway and the
	# functionality is provided by the ${FILESDIR}/monkeyd.init.d script.
	sed -i '/install -m 755 bin\/banana/d' Makefile
	emake CC="$(tc-getCC)" CFLAGS="${CFLAGS}" || die "emake failed"
}

src_install() {
	make \
		PREFIX="${D}"/usr \
		BINDIR="${D}"/usr/bin \
		CGIBIN="${D}"${WEBROOT}/cgi-bin \
		SYSCONFDIR="${D}"/etc/${PN} \
		DATADIR="${D}"${WEBROOT}/htdocs \
		LOGDIR="${D}"/var/log/${PN} \
		install \
		|| die "make install failed"

	if use php ; then
		dosed '/^#AddScript application\/x-httpd-php/s:^#::' /etc/monkeyd/monkey.conf
		dosed 's:/home/my_home/php/bin/php:/usr/bin/php-cgi:' /etc/monkeyd/monkey.conf
	fi

	[[ -e ${WEBROOT}/htdocs/index.html ]] && \
		mv "${D}"${WEBROOT}/htdocs/{index,index-monkey}.html

	dosed "s:/var/log/monkeyd/monkey.pid:/var/run/monkey.pid:" /etc/monkeyd/monkey.conf
	newinitd "${FILESDIR}"/monkeyd.init.d monkeyd
	newconfd "${FILESDIR}"/monkeyd.conf.d monkeyd
	dodoc README MODULES *.txt
}