1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit eutils flag-o-matic toolchain-funcs multilib
9 DESCRIPTION="A small, fast, and scalable web server"
10 HOMEPAGE="http://www.monkey-project.com/"
12 if [[ ${PV} == "9999" ]] ; then
13 EGIT_REPO_URI="https://github.com/monkey/monkey.git"
17 SRC_URI="http://monkey-project.com/releases/${PV:0:3}/${MY_P}.tar.gz"
18 KEYWORDS="~amd64 ~arm ~mips ~ppc ~ppc64 ~x86"
24 # jemalloc is also off until we figure out how to work CMakeLists.txt magic.
25 #IUSE="cgi -debug fastcgi jemalloc php static-plugins ${PLUGINS}"
27 PLUGINS="monkeyd_plugins_auth monkeyd_plugins_cheetah monkeyd_plugins_dirlisting +monkeyd_plugins_liana monkeyd_plugins_logger monkeyd_plugins_mandril monkeyd_plugins_tls"
28 IUSE="cgi -debug fastcgi php static-plugins ${PLUGINS}"
30 # uclibc is often compiled without backtrace info so we should
31 # force this off. If someone complains, consider relaxing it.
33 monkeyd_plugins_tls? ( !static-plugins )
34 elibc_uclibc? ( !debug )
37 #DEPEND="jemalloc? ( >=dev-libs/jemalloc-3.3.1 )"
40 monkeyd_plugins_tls? ( net-libs/mbedtls:= )"
43 cgi? ( dev-lang/php[cgi] )"
45 S="${WORKDIR}/${MY_P}"
47 WEBROOT="/var/www/localhost"
52 ewarn "\033[1;33m**************************************************\033[00m"
53 ewarn "Do not use debug in production!"
54 ewarn "\033[1;33m**************************************************\033[00m"
60 # Unconditionally get rid of the bundled jemalloc
62 epatch "${FILESDIR}"/${PN}-1.6.8-system-mbedtls.patch
68 use elibc_uclibc && myconf+=" --uclib-mode"
69 use elibc_musl && myconf+=" --musl-mode"
71 #use jemalloc || myconf+=" --malloc-libc"
72 myconf+=" --malloc-libc"
75 myconf+=" --debug --trace"
77 myconf+=" --no-backtrace"
80 local enable_plugins=""
81 local disable_plugins=""
82 # We use 'cgi' and 'fastcgi' because they are global flags
83 # instead of the corresponding monkeyd_plugins_*
84 use cgi && enable_plugins+="cgi," || disable_plugins+="cgi,"
85 use fastcgi && enable_plugins+="fastcgi," || disable_plugins+="fastcgi,"
86 # For the rest, we scan the monkeyd_plugins_* and parse out the plugin name.
88 for p in ${PLUGINS}; do
90 cp=${pp/monkeyd_plugins_/}
91 use $pp && enable_plugins+="${cp}," || disable_plugins+="${cp},"
93 myconf+=" --enable-plugins=${enable_plugins%,} --disable-plugins=${disable_plugins%,}"
94 if use static-plugins; then
95 myconf+=" --static-plugins=${enable_plugins%,}"
98 # For O_CLOEXEC which is guarded by _GNU_SOURCE in uClibc,
99 # but shouldn't because it is POSIX. This needs to be fixed
100 # in uClibc. Also, we really should us append-cppflags but
101 # monkey's build system doesn't respect CPPFLAGS. This needs
102 # to be fixed in monkey.
103 use elibc_uclibc && append-cflags -D_GNU_SOURCE
105 # Non-autotools configure
109 --sbindir=/usr/sbin \
110 --webroot=${WEBROOT}/htdocs \
111 --logdir=/var/log/${PN} \
112 --mandir=/usr/share/man \
113 --libdir=/usr/$(get_libdir) \
114 --pidfile=/run/monkey.pid \
115 --sysconfdir=/etc/${PN} \
127 newinitd "${FILESDIR}"/monkeyd.initd-r1 monkeyd
128 newconfd "${FILESDIR}"/monkeyd.confd monkeyd
130 # Move htdocs to docdir, bug #429632
131 docompress -x /usr/share/doc/"${PF}"/htdocs.dist
132 mv "${D}"${WEBROOT}/htdocs \
133 "${D}"/usr/share/doc/"${PF}"/htdocs.dist || die
139 # This needs to be created at runtime