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