lighttpd-1.4.43.ebuild 5.9 KB

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