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/cherokee/cherokee-1.2.101-r1.ebuild,v 1.2 2012/07/11 23:06:39 blueness Exp $ |
4 |
|
5 |
EAPI=4 |
6 |
PYTHON_DEPEND="admin? 2" |
7 |
PYTHON_USE_WITH="threads" |
8 |
|
9 |
inherit eutils multilib pam python versionator |
10 |
|
11 |
DESCRIPTION="An extremely fast and tiny web server." |
12 |
SRC_URI="http://www.cherokee-project.com/download/$(get_version_component_range 1-2)/${PV}/${P}.tar.gz" |
13 |
HOMEPAGE="http://www.cherokee-project.com/" |
14 |
|
15 |
LICENSE="GPL-2" |
16 |
SLOT="0" |
17 |
KEYWORDS="~amd64 ~arm ~mips ~ppc ~ppc64 ~x86" |
18 |
IUSE="admin coverpage ffmpeg debug geoip ipv6 kernel_linux ldap mysql nls pam php rrdtool ssl static static-libs" |
19 |
|
20 |
COMMON_DEPEND="dev-libs/libpcre |
21 |
>=sys-libs/zlib-1.1.4-r1 |
22 |
ffmpeg? ( virtual/ffmpeg ) |
23 |
geoip? ( dev-libs/geoip ) |
24 |
ldap? ( net-nds/openldap ) |
25 |
mysql? ( >=virtual/mysql-5 ) |
26 |
nls? ( virtual/libintl ) |
27 |
pam? ( virtual/pam ) |
28 |
php? ( || ( |
29 |
dev-lang/php[fpm] |
30 |
dev-lang/php[cgi] |
31 |
) ) |
32 |
ssl? ( dev-libs/openssl )" |
33 |
DEPEND="${COMMON_DEPEND} |
34 |
nls? ( sys-devel/gettext )" |
35 |
RDEPEND="${COMMON_DEPEND} |
36 |
rrdtool? ( net-analyzer/rrdtool )" |
37 |
|
38 |
RESTRICT="test" |
39 |
|
40 |
pkg_setup() { |
41 |
python_pkg_setup |
42 |
|
43 |
python_set_active_version 2 |
44 |
|
45 |
enewgroup cherokee |
46 |
enewuser cherokee -1 -1 /var/www cherokee |
47 |
} |
48 |
|
49 |
src_prepare() { |
50 |
epatch \ |
51 |
"${FILESDIR}/${PN}-1.2.99-gentoo.patch" \ |
52 |
"${FILESDIR}/${PN}-1.2.98-linux3.patch" |
53 |
|
54 |
python_convert_shebangs -r 2 . |
55 |
} |
56 |
|
57 |
src_configure() { |
58 |
local myconf |
59 |
|
60 |
if use admin ; then |
61 |
myconf="${myconf} --enable-admin --with-python=$(PYTHON -2)" |
62 |
else |
63 |
myconf="${myconf} --disable-admin --without-python" |
64 |
fi |
65 |
|
66 |
# Uses autodetect because --with-php requires path to php-{fpm,cgi}. |
67 |
if ! use php ; then |
68 |
myconf="${myconf} --without-php" |
69 |
fi |
70 |
|
71 |
if use static ; then |
72 |
myconf="${myconf} --enable-static-module=all" |
73 |
fi |
74 |
|
75 |
local os="Unknown" |
76 |
case "${CHOST}" in |
77 |
*-freebsd*) |
78 |
os="FreeBSD" ;; |
79 |
*-netbsd*) |
80 |
os="NetBSD" ;; |
81 |
*-openbsd*) |
82 |
os="OpenBSD" ;; |
83 |
*) |
84 |
os="Linux" ;; |
85 |
esac |
86 |
|
87 |
# This make cherokee 1.2 sad |
88 |
# $(use_enable threads pthread) \ |
89 |
econf \ |
90 |
$(use_enable debug trace) \ |
91 |
$(use_enable debug backtraces) \ |
92 |
$(use_enable ipv6) \ |
93 |
$(use_enable kernel_linux epoll) \ |
94 |
$(use_enable nls) \ |
95 |
$(use_enable pam) \ |
96 |
$(use_enable static-libs static) \ |
97 |
$(use_with ffmpeg) \ |
98 |
$(use_with geoip) \ |
99 |
$(use_with ldap) \ |
100 |
$(use_with mysql) \ |
101 |
$(use_with ssl libssl) \ |
102 |
--disable-dependency-tracking \ |
103 |
--docdir="${EPREFIX}/usr/share/doc/${PF}/html" \ |
104 |
--enable-os-string="Gentoo ${os}" \ |
105 |
--enable-tmpdir="${EPREFIX}/var/tmp" \ |
106 |
--localstatedir="${EPREFIX}/var" \ |
107 |
--with-wwwroot="${EPREFIX}/var/www/localhost/htdocs" \ |
108 |
--with-cgiroot="${EPREFIX}/var/www/localhost/cgi-bin" \ |
109 |
--with-wwwuser=cherokee \ |
110 |
--with-wwwgroup=cherokee \ |
111 |
${myconf} |
112 |
} |
113 |
|
114 |
src_install() { |
115 |
emake DESTDIR="${D}" install |
116 |
|
117 |
if ! use static-libs ; then |
118 |
find "${ED}" -name '*.la' -delete || die |
119 |
elif ! use static ; then |
120 |
find "${ED}/usr/$(get_libdir)/cherokee" '(' -name '*.la' -o -name '*.a' ')' -delete || die |
121 |
fi |
122 |
|
123 |
dodoc AUTHORS ChangeLog README |
124 |
|
125 |
if use pam ; then |
126 |
pamd_mimic system-auth cherokee auth account session || die |
127 |
fi |
128 |
|
129 |
newinitd "${FILESDIR}/${PN}-initd-1.2.99" ${PN} |
130 |
newconfd "${FILESDIR}/${PN}-confd-1.2.98" ${PN} |
131 |
|
132 |
if ! use admin ; then |
133 |
rm -r \ |
134 |
"${ED}"/usr/bin/cherokee-admin-launcher \ |
135 |
"${ED}"/usr/bin/CTK-run \ |
136 |
"${ED}"/usr/sbin/cherokee-admin \ |
137 |
"${ED}"/usr/share/cherokee/admin || die |
138 |
fi |
139 |
|
140 |
exeinto /usr/share/doc/${PF}/contrib |
141 |
doexe contrib/{bin2buffer.py,make-cert.sh,make-dh_params.sh,tracelor.py} |
142 |
|
143 |
keepdir \ |
144 |
/var/www/localhost/htdocs \ |
145 |
/var/log/cherokee \ |
146 |
/var/lib/cherokee/graphs/images |
147 |
fowners cherokee:cherokee \ |
148 |
/var/log/cherokee \ |
149 |
/var/lib/cherokee/graphs \ |
150 |
/var/lib/cherokee/graphs/images |
151 |
|
152 |
# logrotate |
153 |
insinto /etc/logrotate.d |
154 |
newins "${FILESDIR}"/${PN}.logrotate-r1 ${PN} |
155 |
|
156 |
if ! use coverpage ; then |
157 |
rm -r "${ED}"/var/www/localhost/htdocs/* || die |
158 |
fi |
159 |
} |
160 |
|
161 |
pkg_postinst() { |
162 |
elog |
163 |
if use admin ; then |
164 |
python_mod_optimize "${EPREFIX}/usr/share/cherokee/admin/" |
165 |
elog "Just run '/usr/sbin/cherokee-admin' and go to: http://localhost:9090" |
166 |
elog |
167 |
elog "Cherokee currently supports configuration versioning, so from now on," |
168 |
elog "whenever a change is made to the configuration file format," |
169 |
elog "Cherokee-Admin will be able to automatically convert yours to the new" |
170 |
elog "release. You simply have to load Cherokee-Admin and it will be converted" |
171 |
elog "once you proceed to saving it." |
172 |
elog |
173 |
elog "There is also a command line utility that you can use to do the exact" |
174 |
elog "same thing. Config format can change in different versions. It is" |
175 |
elog "provided under:" |
176 |
elog " ${EPREFIX}/usr/share/cherokee/admin/upgrade_config.py" |
177 |
else |
178 |
elog "Try USE=admin if you want an easy way to configure cherokee." |
179 |
fi |
180 |
elog |
181 |
elog "emerge www-servers/spawn-fcgi if you use Ruby on Rails with ${PN}." |
182 |
elog |
183 |
} |
184 |
|
185 |
pkg_postrm() { |
186 |
if use admin ; then |
187 |
python_mod_cleanup "${EPREFIX}/usr/share/cherokee/admin/" |
188 |
fi |
189 |
} |