1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=(python3_{6,7,8})
8 inherit flag-o-matic python-single-r1 toolchain-funcs
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="php7-2 php7-3 php7-4"
20 IUSE="${MY_USE} ${MY_USE_PHP} ssl"
21 REQUIRED_USE="|| ( ${IUSE} )
22 python? ( ${PYTHON_REQUIRED_USE} )"
24 DEPEND="perl? ( dev-lang/perl:= )
25 php7-2? ( dev-lang/php:7.2[embed] )
26 php7-3? ( dev-lang/php:7.3[embed] )
27 php7-4? ( dev-lang/php:7.4[embed] )
28 python? ( ${PYTHON_DEPS} )
29 ruby? ( dev-lang/ruby:* )
30 ssl? ( dev-libs/openssl:0 )"
32 S="${WORKDIR}/${MY_P}"
35 use python && python-single-r1_pkg_setup
40 sed -i '/^CFLAGS/d' auto/make || die
45 --control=unix:/run/${PN}.sock
47 --modules=$(get_libdir)/${PN}
50 --state=/var/lib/${PN}
52 use ssl && opt+=( --openssl )
53 export AR="$(tc-getAR)"
54 export CC="$(tc-getCC)"
55 ./configure ${opt[@]} --ld-opt="${LDFLAGS}" || die "Core configuration failed"
56 # Modules require position-independent code
57 append-cflags $(test-flags-CC -fPIC)
58 for flag in ${MY_USE} ; do
60 ./configure ${flag} || die "Module configuration failed: ${flag}"
63 for flag in ${MY_USE_PHP} ; do
65 local php_slot="/usr/$(get_libdir)/${flag/-/.}"
68 --config=${php_slot}/bin/php-config \
69 --lib-path=${php_slot}/$(get_libdir) || die "Module configuration failed: ${flag}"
77 keepdir /var/lib/${PN}
78 newinitd "${FILESDIR}/${PN}.initd" ${PN}