*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / www-servers / nginx-unit / nginx-unit-1.12.0-r3.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 PYTHON_COMPAT=(python2_7 python3_{6,7})
7
8 inherit flag-o-matic python-single-r1
9
10 MY_P="unit-${PV}"
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"
14
15 LICENSE="Apache-2.0"
16 SLOT="0"
17 KEYWORDS="~amd64"
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} )"
23
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 )"
32 RDEPEND="${DEPEND}"
33 S="${WORKDIR}/${MY_P}"
34
35 PATCHES=(
36         "${FILESDIR}/auto-make.patch"
37         "${FILESDIR}/auto-os-conf.patch"
38 )
39
40 pkg_setup() {
41         use python && python-single-r1_pkg_setup
42 }
43
44 src_configure() {
45         local opt=(
46                 --control=unix:/run/${PN}.sock
47                 --log=/var/log/${PN}
48                 --modules=$(get_libdir)/${PN}
49                 --pid=/run/${PN}.pid
50                 --prefix=/usr
51                 --state=/var/lib/${PN}
52         )
53         use ssl && opt+=( --openssl )
54         export AR="$(tc-getAR)"
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
59                 if use ${flag} ; then
60                         ./configure ${flag} || die "Module configuration failed: ${flag}"
61                 fi
62         done
63         for flag in ${MY_USE_PHP} ; do
64                 if use ${flag} ; then
65                         local php_slot="/usr/$(get_libdir)/${flag/-/.}"
66                         ./configure php \
67                                 --module=${flag} \
68                                 --config=${php_slot}/bin/php-config \
69                                 --lib-path=${php_slot}/$(get_libdir) || die "Module configuration failed: ${flag}"
70                 fi
71         done
72 }
73
74 src_install() {
75         default
76         diropts -m 0770
77         keepdir /var/lib/${PN}
78         newinitd "${FILESDIR}/${PN}.initd" ${PN}
79 }