| 1 |
# Copyright 1999-2010 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/www-servers/cherokee/cherokee-1.0.2-r1.ebuild,v 1.2 2010/06/21 21:10:05 mr_bones_ Exp $
|
| 4 |
|
| 5 |
EAPI=2
|
| 6 |
PYTHON_DEPEND="admin? 2"
|
| 7 |
|
| 8 |
inherit python eutils pam versionator libtool
|
| 9 |
|
| 10 |
DESCRIPTION="An extremely fast and tiny web server."
|
| 11 |
SRC_URI="http://www.cherokee-project.com/download/$(get_version_component_range 1-2)/${PV}/${P}.tar.gz"
|
| 12 |
HOMEPAGE="http://www.cherokee-project.com/"
|
| 13 |
|
| 14 |
LICENSE="GPL-2"
|
| 15 |
SLOT="0"
|
| 16 |
KEYWORDS="~x86 ~amd64"
|
| 17 |
IUSE="ipv6 nls ssl static pam coverpage threads kernel_linux admin debug geoip ldap mysql ffmpeg fastcgi"
|
| 18 |
|
| 19 |
RDEPEND="
|
| 20 |
>=sys-libs/zlib-1.1.4-r1
|
| 21 |
net-analyzer/rrdtool
|
| 22 |
nls? ( sys-devel/gettext )
|
| 23 |
ssl? ( dev-libs/openssl )
|
| 24 |
pam? ( virtual/pam )
|
| 25 |
geoip? ( dev-libs/geoip )
|
| 26 |
ldap? ( net-nds/openldap )
|
| 27 |
mysql? ( virtual/mysql )
|
| 28 |
fastcgi? ( www-servers/spawn-fcgi )
|
| 29 |
ffmpeg? ( media-video/ffmpeg )"
|
| 30 |
DEPEND="${RDEPEND}"
|
| 31 |
|
| 32 |
src_prepare() {
|
| 33 |
python_convert_shebangs -r 2 .
|
| 34 |
}
|
| 35 |
|
| 36 |
src_compile() {
|
| 37 |
local myconf
|
| 38 |
|
| 39 |
if use static ; then
|
| 40 |
myconf="${myconf} --enable-static --enable-static-module=all"
|
| 41 |
else
|
| 42 |
myconf="${myconf} --disable-static"
|
| 43 |
fi
|
| 44 |
|
| 45 |
if use debug ; then
|
| 46 |
myconf="${myconf} --enable-trace"
|
| 47 |
fi
|
| 48 |
|
| 49 |
local os="Unknown"
|
| 50 |
case "${CHOST}" in
|
| 51 |
*-freebsd*)
|
| 52 |
os="FreeBSD" ;;
|
| 53 |
*-netbsd*)
|
| 54 |
os="NetBSD" ;;
|
| 55 |
*-openbsd*)
|
| 56 |
os="OpenBSD" ;;
|
| 57 |
*)
|
| 58 |
os="Linux" ;;
|
| 59 |
esac
|
| 60 |
|
| 61 |
# No options to enable or disable ssl since Cherokee 0.11
|
| 62 |
econf \
|
| 63 |
${myconf} \
|
| 64 |
$(use_enable pam) \
|
| 65 |
$(use_enable ipv6) \
|
| 66 |
$(use_enable nls) \
|
| 67 |
$(use_enable threads pthread) \
|
| 68 |
$(use_enable kernel_linux epoll) \
|
| 69 |
$(use_with geoip) \
|
| 70 |
$(use_with ldap) \
|
| 71 |
$(use_with mysql) \
|
| 72 |
$(use_with ffmpeg) \
|
| 73 |
--disable-dependency-tracking \
|
| 74 |
--enable-os-string="Gentoo ${os}" \
|
| 75 |
--with-wwwroot=/var/www/localhost/htdocs \
|
| 76 |
--prefix=/usr \
|
| 77 |
--sysconfdir=/etc \
|
| 78 |
--localstatedir=/var \
|
| 79 |
|| die "configure failed"
|
| 80 |
|
| 81 |
emake -j1 || die "emake failed"
|
| 82 |
}
|
| 83 |
|
| 84 |
src_install () {
|
| 85 |
emake DESTDIR="${D}" docdir="/usr/share/doc/${PF}/html" install || die "make install failed"
|
| 86 |
|
| 87 |
dodoc AUTHORS ChangeLog
|
| 88 |
|
| 89 |
use pam && pamd_mimic system-auth cherokee auth account session
|
| 90 |
newinitd "${FILESDIR}/${PN}-initd-0.99.23" ${PN} || die "newinitd failed"
|
| 91 |
|
| 92 |
dodir /usr/share/doc/${PF}/contrib
|
| 93 |
insinto /usr/share/${PF}/contrib
|
| 94 |
doins contrib/07to08.py
|
| 95 |
doins contrib/08to09.py
|
| 96 |
doins contrib/09to010.py
|
| 97 |
doins contrib/011to098.py
|
| 98 |
doins contrib/098to099.py
|
| 99 |
doins contrib/0999to09910.py
|
| 100 |
doins contrib/make-cert.sh
|
| 101 |
|
| 102 |
keepdir /etc/cherokee/mods-enabled /etc/cherokee/sites-enabled /var/www/localhost/htdocs
|
| 103 |
|
| 104 |
use coverpage || rm -rf "${D}"/var/www/localhost/htdocs/{index.html,images}
|
| 105 |
if use admin ; then
|
| 106 |
exeinto /usr/share/cherokee/admin
|
| 107 |
doexe admin/server.py
|
| 108 |
else
|
| 109 |
rm -rf "${D}"/usr/sbin/admin "${D}"/usr/share/cherokee/admin
|
| 110 |
fi
|
| 111 |
|
| 112 |
# Puts logs in /var/log/cherokee/
|
| 113 |
dosed "s:/var/log/cherokee\.:/var/log/cherokee/cherokee\.:g" /etc/cherokee/cherokee.conf
|
| 114 |
|
| 115 |
}
|
| 116 |
|
| 117 |
pkg_setup() {
|
| 118 |
python_set_active_version 2
|
| 119 |
}
|
| 120 |
|
| 121 |
pkg_postinst() {
|
| 122 |
enewgroup cherokee
|
| 123 |
enewuser cherokee -1 -1 /var/www/localhost cherokee
|
| 124 |
install -o cherokee -g cherokee -m0775 -d "${ROOT}"var/log/cherokee
|
| 125 |
|
| 126 |
# check if user/group was defined if not add it
|
| 127 |
gr="/bin/grep -q"
|
| 128 |
ec="/bin/echo"
|
| 129 |
$gr server\!user /etc/cherokee/cherokee.conf ; rtu=$?
|
| 130 |
$gr server\!group /etc/cherokee/cherokee.conf ; rtg=$?
|
| 131 |
|
| 132 |
[[ "x$rtu" == "x1" ]] && $ec server\!user = cherokee >> /etc/cherokee/cherokee.conf
|
| 133 |
[[ "x$rtg" == "x1" ]] && $ec server\!group = cherokee >> /etc/cherokee/cherokee.conf
|
| 134 |
|
| 135 |
if use admin ; then
|
| 136 |
echo ""
|
| 137 |
elog "Just run 'cherokee-admin' and go to: http://localhost:9090"
|
| 138 |
echo ""
|
| 139 |
else
|
| 140 |
echo ""
|
| 141 |
elog "Try USE=admin if you want an easy way to configure cherokee."
|
| 142 |
echo ""
|
| 143 |
fi
|
| 144 |
|
| 145 |
echo ""
|
| 146 |
elog "Config format can change in different versions. Check converter script in:"
|
| 147 |
elog " /usr/share/cherokee-0.99.15/contrib/"
|
| 148 |
elog "for example:"
|
| 149 |
elog " PYTHONPATH="/usr/share/cherokee/admin/" python \\"
|
| 150 |
elog " /usr/share/cherokee-0.99.15/contrib/0999to09910.py \\"
|
| 151 |
elog " /etc/cherokee/cherokee.conf /etc/cherokee/cherokee.conf-0.99.15"
|
| 152 |
|
| 153 |
}
|