1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=(python2_7 python3_{6,7,8})
8 inherit flag-o-matic python-single-r1
11 DESCRIPTION="Dynamic web and application server"
12 HOMEPAGE="https://unit.nginx.org"
13 SRC_URI="https://unit.nginx.org/download/${MY_P}.tar.gz -> ${P}.tar.gz"
18 MY_USE="perl python ruby"
19 MY_USE_PHP="php5-6 php7-1 php7-2 php7-3"
20 IUSE="${MY_USE} ${MY_USE_PHP} ssl"
21 REQUIRED_USE="|| ( ${IUSE} )
22 python? ( ${PYTHON_REQUIRED_USE} )"
24 DEPEND="perl? ( dev-lang/perl:= )
25 php5-6? ( dev-lang/php:5.6[embed] )
26 php7-1? ( dev-lang/php:7.1[embed] )
27 php7-2? ( dev-lang/php:7.2[embed] )
28 php7-3? ( dev-lang/php:7.3[embed] )
29 python? ( ${PYTHON_DEPS} )
30 ruby? ( dev-lang/ruby:* )
31 ssl? ( dev-libs/openssl:0 )"
33 S="${WORKDIR}/${MY_P}"
36 use python && python-single-r1_pkg_setup
41 sed -i '/^CFLAGS/d' auto/make || die
46 --control=unix:/run/${PN}.sock
48 --modules=$(get_libdir)/${PN}
51 --state=/var/lib/${PN}
53 use ssl && opt+=( --openssl )
54 export AR="$(tc-getAR)"
55 export CC="$(tc-getCC)"
56 ./configure ${opt[@]} --ld-opt="${LDFLAGS}" || die "Core configuration failed"
57 # Modules require position-independent code
58 append-cflags $(test-flags-CC -fPIC)
59 for flag in ${MY_USE} ; do
61 ./configure ${flag} || die "Module configuration failed: ${flag}"
64 for flag in ${MY_USE_PHP} ; do
66 local php_slot="/usr/$(get_libdir)/${flag/-/.}"
69 --config=${php_slot}/bin/php-config \
70 --lib-path=${php_slot}/$(get_libdir) || die "Module configuration failed: ${flag}"
78 keepdir /var/lib/${PN}
79 newinitd "${FILESDIR}/${PN}.initd" ${PN}