| 1 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/www-servers/lighttpd/lighttpd-1.4.31.ebuild,v 1.11 2012/11/20 19:07:35 wired Exp $
|
| 4 |
|
| 5 |
EAPI="4"
|
| 6 |
|
| 7 |
inherit base autotools eutils depend.php user
|
| 8 |
|
| 9 |
DESCRIPTION="Lightweight high-performance web server"
|
| 10 |
HOMEPAGE="http://www.lighttpd.net/"
|
| 11 |
SRC_URI="http://download.lighttpd.net/lighttpd/releases-1.4.x/${P}.tar.bz2"
|
| 12 |
|
| 13 |
LICENSE="BSD GPL-2"
|
| 14 |
SLOT="0"
|
| 15 |
KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
|
| 16 |
IUSE="bzip2 doc fam gdbm ipv6 kerberos ldap libev lua minimal mmap memcache mysql pcre php rrdtool selinux ssl test uploadprogress webdav xattr zlib"
|
| 17 |
|
| 18 |
REQUIRED_USE="kerberos? ( ssl )"
|
| 19 |
|
| 20 |
RDEPEND="
|
| 21 |
bzip2? ( app-arch/bzip2 )
|
| 22 |
fam? ( virtual/fam )
|
| 23 |
gdbm? ( sys-libs/gdbm )
|
| 24 |
ldap? ( >=net-nds/openldap-2.1.26 )
|
| 25 |
libev? ( >=dev-libs/libev-4.01 )
|
| 26 |
lua? ( >=dev-lang/lua-5.1 )
|
| 27 |
memcache? ( dev-libs/libmemcache )
|
| 28 |
mysql? ( >=virtual/mysql-4.0 )
|
| 29 |
pcre? ( >=dev-libs/libpcre-3.1 )
|
| 30 |
php? ( dev-lang/php[cgi] )
|
| 31 |
rrdtool? ( net-analyzer/rrdtool )
|
| 32 |
selinux? ( sec-policy/selinux-apache )
|
| 33 |
ssl? ( >=dev-libs/openssl-0.9.7[kerberos?] )
|
| 34 |
webdav? (
|
| 35 |
dev-libs/libxml2
|
| 36 |
>=dev-db/sqlite-3
|
| 37 |
sys-fs/e2fsprogs
|
| 38 |
)
|
| 39 |
xattr? ( kernel_linux? ( sys-apps/attr ) )
|
| 40 |
zlib? ( >=sys-libs/zlib-1.1 )"
|
| 41 |
|
| 42 |
DEPEND="${RDEPEND}
|
| 43 |
virtual/pkgconfig
|
| 44 |
doc? ( dev-python/docutils )
|
| 45 |
test? (
|
| 46 |
virtual/perl-Test-Harness
|
| 47 |
dev-libs/fcgi
|
| 48 |
)"
|
| 49 |
|
| 50 |
# update certain parts of lighttpd.conf based on conditionals
|
| 51 |
update_config() {
|
| 52 |
local config="${D}/etc/lighttpd/lighttpd.conf"
|
| 53 |
|
| 54 |
# enable php/mod_fastcgi settings
|
| 55 |
use php && { sed -i -e 's|#.*\(include.*fastcgi.*$\)|\1|' ${config} || die; }
|
| 56 |
|
| 57 |
# enable stat() caching
|
| 58 |
use fam && { sed -i -e 's|#\(.*stat-cache.*$\)|\1|' ${config} || die; }
|
| 59 |
|
| 60 |
# automatically listen on IPv6 if built with USE=ipv6. Bug #234987
|
| 61 |
use ipv6 && { sed -i -e 's|# server.use-ipv6|server.use-ipv6|' ${config} || die; }
|
| 62 |
}
|
| 63 |
|
| 64 |
# remove non-essential stuff (for USE=minimal)
|
| 65 |
remove_non_essential() {
|
| 66 |
local libdir="${D}/usr/$(get_libdir)/${PN}"
|
| 67 |
|
| 68 |
# text docs
|
| 69 |
use doc || rm -fr "${D}"/usr/share/doc/${PF}/txt
|
| 70 |
|
| 71 |
# non-essential modules
|
| 72 |
rm -f \
|
| 73 |
${libdir}/mod_{compress,evhost,expire,proxy,scgi,secdownload,simple_vhost,status,setenv,trigger*,usertrack}.*
|
| 74 |
|
| 75 |
# allow users to keep some based on USE flags
|
| 76 |
use pcre || rm -f ${libdir}/mod_{ssi,re{direct,write}}.*
|
| 77 |
use webdav || rm -f ${libdir}/mod_webdav.*
|
| 78 |
use mysql || rm -f ${libdir}/mod_mysql_vhost.*
|
| 79 |
use lua || rm -f ${libdir}/mod_{cml,magnet}.*
|
| 80 |
use rrdtool || rm -f ${libdir}/mod_rrdtool.*
|
| 81 |
use zlib || rm -f ${libdir}/mod_compress.*
|
| 82 |
}
|
| 83 |
|
| 84 |
pkg_setup() {
|
| 85 |
if ! use pcre ; then
|
| 86 |
ewarn "It is highly recommended that you build ${PN}"
|
| 87 |
ewarn "with perl regular expressions support via USE=pcre."
|
| 88 |
ewarn "Otherwise you lose support for some core options such"
|
| 89 |
ewarn "as conditionals and modules such as mod_re{write,direct}"
|
| 90 |
ewarn "and mod_ssi."
|
| 91 |
fi
|
| 92 |
if use mmap; then
|
| 93 |
ewarn "You have enabled the mmap option. This option may allow"
|
| 94 |
ewarn "local users to trigger SIGBUG crashes. Use this option"
|
| 95 |
ewarn "with EXTRA care."
|
| 96 |
fi
|
| 97 |
enewgroup lighttpd
|
| 98 |
enewuser lighttpd -1 -1 /var/www/localhost/htdocs lighttpd
|
| 99 |
}
|
| 100 |
|
| 101 |
src_prepare() {
|
| 102 |
base_src_prepare
|
| 103 |
#dev-python/docutils installs rst2html.py not rst2html
|
| 104 |
sed -i -e 's|\(rst2html\)|\1.py|g' doc/outdated/Makefile.am || \
|
| 105 |
die "sed doc/Makefile.am failed"
|
| 106 |
# Experimental patch for progress bar. Bug #380093
|
| 107 |
if use uploadprogress; then
|
| 108 |
epatch "${FILESDIR}"/${PN}-1.4.29-mod_uploadprogress.patch
|
| 109 |
fi
|
| 110 |
epatch "${FILESDIR}"/${P}-automake-1.12.patch
|
| 111 |
eautoreconf
|
| 112 |
}
|
| 113 |
src_configure() {
|
| 114 |
econf --libdir=/usr/$(get_libdir)/${PN} \
|
| 115 |
--enable-lfs \
|
| 116 |
$(use_enable ipv6) \
|
| 117 |
$(use_enable mmap) \
|
| 118 |
$(use_with bzip2) \
|
| 119 |
$(use_with fam) \
|
| 120 |
$(use_with gdbm) \
|
| 121 |
$(use_with kerberos kerberos5) \
|
| 122 |
$(use_with ldap) \
|
| 123 |
$(use_with libev) \
|
| 124 |
$(use_with lua) \
|
| 125 |
$(use_with memcache) \
|
| 126 |
$(use_with mysql) \
|
| 127 |
$(use_with pcre) \
|
| 128 |
$(use_with ssl openssl) \
|
| 129 |
$(use_with webdav webdav-props) \
|
| 130 |
$(use_with webdav webdav-locks) \
|
| 131 |
$(use_with xattr attr) \
|
| 132 |
$(use_with zlib)
|
| 133 |
}
|
| 134 |
|
| 135 |
src_compile() {
|
| 136 |
emake
|
| 137 |
|
| 138 |
if use doc ; then
|
| 139 |
einfo "Building HTML documentation"
|
| 140 |
cd doc || die
|
| 141 |
emake html
|
| 142 |
fi
|
| 143 |
}
|
| 144 |
|
| 145 |
src_test() {
|
| 146 |
if [[ ${EUID} -eq 0 ]]; then
|
| 147 |
default_src_test
|
| 148 |
else
|
| 149 |
ewarn "test skipped, please re-run as root if you wish to test ${PN}"
|
| 150 |
fi
|
| 151 |
}
|
| 152 |
|
| 153 |
src_install() {
|
| 154 |
emake DESTDIR="${D}" install
|
| 155 |
|
| 156 |
# init script stuff
|
| 157 |
newinitd "${FILESDIR}"/lighttpd.initd lighttpd
|
| 158 |
newconfd "${FILESDIR}"/lighttpd.confd lighttpd
|
| 159 |
use fam && has_version app-admin/fam && \
|
| 160 |
{ sed -i 's/after famd/need famd/g' "${D}"/etc/init.d/lighttpd || die; }
|
| 161 |
|
| 162 |
# configs
|
| 163 |
insinto /etc/lighttpd
|
| 164 |
doins "${FILESDIR}"/conf/lighttpd.conf
|
| 165 |
doins "${FILESDIR}"/conf/mime-types.conf
|
| 166 |
doins "${FILESDIR}"/conf/mod_cgi.conf
|
| 167 |
doins "${FILESDIR}"/conf/mod_fastcgi.conf
|
| 168 |
# Secure directory for fastcgi sockets
|
| 169 |
keepdir /var/run/lighttpd/
|
| 170 |
fperms 0750 /var/run/lighttpd/
|
| 171 |
fowners lighttpd:lighttpd /var/run/lighttpd/
|
| 172 |
|
| 173 |
# update lighttpd.conf directives based on conditionals
|
| 174 |
update_config
|
| 175 |
|
| 176 |
# docs
|
| 177 |
dodoc AUTHORS README NEWS doc/scripts/*.sh
|
| 178 |
newdoc doc/config//lighttpd.conf lighttpd.conf.distrib
|
| 179 |
|
| 180 |
use doc && dohtml -r doc/*
|
| 181 |
|
| 182 |
docinto txt
|
| 183 |
dodoc doc/outdated/*.txt
|
| 184 |
|
| 185 |
# logrotate
|
| 186 |
insinto /etc/logrotate.d
|
| 187 |
newins "${FILESDIR}"/lighttpd.logrotate lighttpd
|
| 188 |
|
| 189 |
keepdir /var/l{ib,og}/lighttpd /var/www/localhost/htdocs
|
| 190 |
fowners lighttpd:lighttpd /var/l{ib,og}/lighttpd
|
| 191 |
fperms 0750 /var/l{ib,og}/lighttpd
|
| 192 |
|
| 193 |
#spawn-fcgi may optionally be installed via www-servers/spawn-fcgi
|
| 194 |
rm -f "${D}"/usr/bin/spawn-fcgi "${D}"/usr/share/man/man1/spawn-fcgi.*
|
| 195 |
|
| 196 |
use minimal && remove_non_essential
|
| 197 |
}
|
| 198 |
|
| 199 |
pkg_postinst () {
|
| 200 |
if use ipv6; then
|
| 201 |
elog "IPv6 migration guide:"
|
| 202 |
elog "http://redmine.lighttpd.net/projects/lighttpd/wiki/IPv6-Config"
|
| 203 |
fi
|
| 204 |
if [[ -f ${ROOT}etc/conf.d/spawn-fcgi.conf ]] ; then
|
| 205 |
einfo "spawn-fcgi is now provided by www-servers/spawn-fcgi."
|
| 206 |
einfo "spawn-fcgi's init script configuration is now located"
|
| 207 |
einfo "at /etc/conf.d/spawn-fcgi."
|
| 208 |
fi
|
| 209 |
|
| 210 |
if [[ -f ${ROOT}etc/lighttpd.conf ]] ; then
|
| 211 |
elog "Gentoo has a customized configuration,"
|
| 212 |
elog "which is now located in /etc/lighttpd. Please migrate your"
|
| 213 |
elog "existing configuration."
|
| 214 |
fi
|
| 215 |
|
| 216 |
if use uploadprogress; then
|
| 217 |
elog "WARNING! mod_uploadprogress is a backported module from the"
|
| 218 |
elog "1.5x-branch, which is not considered stable yet. Please go to"
|
| 219 |
elog "http://redmine.lighttpd.net/wiki/1/Docs:ModUploadProgress"
|
| 220 |
elog "for more information. This configuration also is NOT supported"
|
| 221 |
elog "by upstream, so please refrain from reporting bugs. You have"
|
| 222 |
elog "been warned!"
|
| 223 |
fi
|
| 224 |
}
|