Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: www-servers/nginx-unit/files/, www-servers/nginx-unit/
Date: Mon, 27 Feb 2023 23:54:46
Message-Id: 1677542016.a36e085bbf2fb23ff5ef6a70449edd9d135d2d1e.mpagano@gentoo
1 commit: a36e085bbf2fb23ff5ef6a70449edd9d135d2d1e
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Mon Feb 27 23:53:36 2023 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Mon Feb 27 23:53:36 2023 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a36e085b
7
8 www-servers/nginx-unit: Support nginx-unit user and group
9
10 Bug: https://bugs.gentoo.org/894778
11
12 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
13
14 www-servers/nginx-unit/files/nginx-unit.initd-r1 | 16 ++++
15 www-servers/nginx-unit/nginx-unit-1.29.0-r1.ebuild | 98 ++++++++++++++++++++++
16 2 files changed, 114 insertions(+)
17
18 diff --git a/www-servers/nginx-unit/files/nginx-unit.initd-r1 b/www-servers/nginx-unit/files/nginx-unit.initd-r1
19 new file mode 100644
20 index 000000000000..a9ad47834899
21 --- /dev/null
22 +++ b/www-servers/nginx-unit/files/nginx-unit.initd-r1
23 @@ -0,0 +1,16 @@
24 +#!/sbin/openrc-run
25 +# Copyright 1999-2023 Gentoo Authors
26 +# Distributed under the terms of the GNU General Public License v2
27 +
28 +command="/usr/sbin/unitd"
29 +pidfile="/run/nginx-unit.pid"
30 +user=${NXT_USER:-nginx-unit}
31 +group=${NXT_GROUP:-nginx-unit}
32 +
33 +depend() {
34 + use dns logger netmount
35 +}
36 +
37 +start_pre() {
38 + checkpath -d /var/lib/nginx-unit -o ${user}:${group} -m 0770
39 +}
40
41 diff --git a/www-servers/nginx-unit/nginx-unit-1.29.0-r1.ebuild b/www-servers/nginx-unit/nginx-unit-1.29.0-r1.ebuild
42 new file mode 100644
43 index 000000000000..2b5fa3f6a04f
44 --- /dev/null
45 +++ b/www-servers/nginx-unit/nginx-unit-1.29.0-r1.ebuild
46 @@ -0,0 +1,98 @@
47 +# Copyright 1999-2023 Gentoo Authors
48 +# Distributed under the terms of the GNU General Public License v2
49 +
50 +EAPI=8
51 +
52 +PYTHON_COMPAT=( python3_{9..11} )
53 +
54 +inherit flag-o-matic python-single-r1 systemd toolchain-funcs
55 +
56 +MY_P="unit-${PV}"
57 +DESCRIPTION="Dynamic web and application server"
58 +HOMEPAGE="https://unit.nginx.org"
59 +SRC_URI="https://unit.nginx.org/download/${MY_P}.tar.gz -> ${P}.tar.gz"
60 +S="${WORKDIR}/${MY_P}"
61 +
62 +LICENSE="Apache-2.0"
63 +SLOT="0"
64 +KEYWORDS="~amd64"
65 +MY_USE="perl python ruby"
66 +MY_USE_PHP="php7-4 php8-0 php8-1 "
67 +IUSE="${MY_USE} ${MY_USE_PHP} ssl"
68 +REQUIRED_USE="|| ( ${IUSE} )
69 + python? ( ${PYTHON_REQUIRED_USE} )"
70 +
71 +DEPEND="perl? ( dev-lang/perl:= )
72 + php7-4? ( dev-lang/php:7.4[embed] )
73 + php8-0? ( dev-lang/php:8.0[embed] )
74 + php8-1? ( dev-lang/php:8.1[embed] )
75 + python? ( ${PYTHON_DEPS} )
76 + ruby? (
77 + dev-lang/ruby:=
78 + dev-ruby/rubygems:=
79 + )
80 + ssl? ( dev-libs/openssl:0= )
81 + virtual/libcrypt:0="
82 +RDEPEND="${DEPEND}
83 + acct-user/nginx-unit
84 + acct-group/nginx-unit"
85 +
86 +pkg_setup() {
87 + use python && python-single-r1_pkg_setup
88 +}
89 +
90 +src_prepare() {
91 + eapply_user
92 + sed -i '/^CFLAGS/d' auto/make || die
93 + default
94 +}
95 +
96 +src_configure() {
97 + local opt=(
98 + --control=unix:/run/${PN}.sock
99 + --log=/var/log/${PN}
100 + --modules=$(get_libdir)/${PN}
101 + --pid=/run/${PN}.pid
102 + --prefix=/usr
103 + --state=/var/lib/${PN}
104 + --user=${PN}
105 + --group=${PN}
106 + )
107 +
108 + use ssl && opt+=( --openssl )
109 + export AR="$(tc-getAR)"
110 + export CC="$(tc-getCC)"
111 + ./configure ${opt[@]} --ld-opt="${LDFLAGS}" || die "Core configuration failed"
112 +
113 + # Modules require position-independent code
114 + append-cflags $(test-flags-CC -fPIC)
115 +
116 + for flag in ${MY_USE} ; do
117 + if use ${flag} ; then
118 + ./configure ${flag} || die "Module configuration failed: ${flag}"
119 + fi
120 + done
121 +
122 + for flag in ${MY_USE_PHP} ; do
123 + if use ${flag} ; then
124 + local php_slot="/usr/$(get_libdir)/${flag/-/.}"
125 + ./configure php \
126 + --module=${flag} \
127 + --config=${php_slot}/bin/php-config \
128 + --lib-path=${php_slot}/$(get_libdir) || die "Module configuration failed: ${flag}"
129 + fi
130 + done
131 +}
132 +
133 +src_install() {
134 + default
135 +
136 + diropts -m 0770
137 + keepdir /var/lib/${PN}
138 + newinitd "${FILESDIR}/${PN}.initd-r1" ${PN}
139 + systemd_newunit "${FILESDIR}"/${PN}.service ${PN}.service
140 +}
141 +
142 +pkg_postinst() {
143 + chown ${PN}:${PN} "${EROOT}"/var/lib/nginx-unit
144 +}