*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / www-servers / nginx-unit / nginx-unit-1.14.0.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,8})
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 pkg_setup() {
36         use python && python-single-r1_pkg_setup
37 }
38
39 src_prepare() {
40         eapply_user
41         sed -i '/^CFLAGS/d' auto/make || die
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         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
60                 if use ${flag} ; then
61                         ./configure ${flag} || die "Module configuration failed: ${flag}"
62                 fi
63         done
64         for flag in ${MY_USE_PHP} ; do
65                 if use ${flag} ; then
66                         local php_slot="/usr/$(get_libdir)/${flag/-/.}"
67                         ./configure php \
68                                 --module=${flag} \
69                                 --config=${php_slot}/bin/php-config \
70                                 --lib-path=${php_slot}/$(get_libdir) || die "Module configuration failed: ${flag}"
71                 fi
72         done
73 }
74
75 src_install() {
76         default
77         diropts -m 0770
78         keepdir /var/lib/${PN}
79         newinitd "${FILESDIR}/${PN}.initd" ${PN}
80 }