initial commit: 1.5.0
[systemrescuecd.git] / portage-overlay / www-servers / thttpd / thttpd-2.25b-r7.ebuild
1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/www-servers/thttpd/thttpd-2.25b-r7.ebuild,v 1.6 2008/06/26 08:39:18 bangert Exp $
4
5 inherit eutils flag-o-matic
6
7 MY_P="${P%[a-z]*}"
8
9 DESCRIPTION="Small and fast multiplexing webserver."
10 HOMEPAGE="http://www.acme.com/software/thttpd/"
11 SRC_URI="http://www.acme.com/software/thttpd/${P}.tar.gz"
12
13 LICENSE="BSD"
14 SLOT="0"
15 KEYWORDS="amd64 ~hppa ~mips ppc sparc x86 ~x86-fbsd"
16 IUSE="static"
17
18 THTTPD_USER=thttpd
19 THTTPD_GROUP=thttpd
20
21 src_unpack() {
22         unpack ${A}
23         cd "${S}"
24         epatch "${FILESDIR}"/${MY_P}/*.diff
25         epatch "${FILESDIR}"/${P}-glibc-2.10.patch
26         sed -i -e 's!if ( hc->sb.st_mode & S_IXOTH )!if (0)!g' libhttpd.c || die 'cannot allow exec files'
27 }
28
29 pkg_setup() {
30         enewgroup ${THTTPD_GROUP}
31         enewuser ${THTTPD_USER}  -1 -1 -1 ${THTTPD_GROUP}
32 }
33
34 src_compile() {
35         ## TODO: what to do with IPv6?
36         use static && append-ldflags -static
37
38         econf || die "econf failed"
39         emake || die "emake failed"
40 }
41
42 src_install () {
43         dodir /usr/share/man/man1
44         make prefix="${D}"/usr \
45                 MANDIR="${D}"/usr/share/man \
46                 WEBGROUP=${THTTPD_GROUP} \
47                 WEBDIR="${D}"/var/www/localhost \
48                 "$@" install || die "make install failed"
49
50         mv "${D}"/usr/sbin/{,th_}htpasswd
51         mv "${D}"/usr/share/man/man1/{,th_}htpasswd.1
52
53         newinitd "${FILESDIR}"/${MY_P}/thttpd.init thttpd
54         newconfd "${FILESDIR}"/${MY_P}/thttpd.confd thttpd
55
56         dodoc README INSTALL TODO
57
58         insinto /etc/logrotate.d
59         newins "${FILESDIR}/thttpd.logrotate" thttpd
60
61         insinto /etc/thttpd
62         doins "${FILESDIR}"/${MY_P}/thttpd.conf.sample
63 }
64
65 pkg_postinst() {
66         elog "Adjust THTTPD_DOCROOT in /etc/conf.d/thttpd !"
67 }