Lines 1-716
Link Here
|
1 |
# Copyright 1999-2023 Gentoo Authors |
1 |
# Copyright 1999-2023 Gentoo Authors |
2 |
# Distributed under the terms of the GNU General Public License v2 |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
|
3 |
|
4 |
# @ECLASS: apache-2.eclass |
4 |
# @ECLASS: apache-2.eclass |
5 |
# @MAINTAINER: |
5 |
# @MAINTAINER: |
6 |
# apache-bugs@gentoo.org |
6 |
# apache-bugs@gentoo.org |
7 |
# @AUTHOR: |
7 |
# @AUTHOR: |
8 |
# polynomial-c@gentoo.org |
8 |
# polynomial-c@gentoo.org |
9 |
# @SUPPORTED_EAPIS: 7 |
9 |
# @SUPPORTED_EAPIS: 7 |
10 |
# @BLURB: Provides a common set of functions for apache-2.x ebuilds |
10 |
# @BLURB: Provides a common set of functions for apache-2.x ebuilds |
11 |
# @DESCRIPTION: |
11 |
# @DESCRIPTION: |
12 |
# This eclass handles apache-2.x ebuild functions such as LoadModule generation |
12 |
# This eclass handles apache-2.x ebuild functions such as LoadModule generation |
13 |
# and inter-module dependency checking. |
13 |
# and inter-module dependency checking. |
14 |
|
14 |
|
15 |
LUA_COMPAT=( lua5-{1..4} ) |
15 |
LUA_COMPAT=( lua5-{1..4} ) |
16 |
inherit autotools flag-o-matic lua-single multilib ssl-cert toolchain-funcs |
16 |
inherit autotools flag-o-matic lua-single multilib ssl-cert toolchain-funcs |
17 |
|
17 |
|
18 |
[[ ${CATEGORY}/${PN} != www-servers/apache ]] \ |
18 |
[[ ${CATEGORY}/${PN} != www-servers/apache ]] \ |
19 |
&& die "Do not use this eclass with anything else than www-servers/apache ebuilds!" |
19 |
&& die "Do not use this eclass with anything else than www-servers/apache ebuilds!" |
20 |
|
20 |
|
21 |
case ${EAPI} in |
21 |
case ${EAPI} in |
22 |
7) ;; |
22 |
7) ;; |
23 |
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; |
23 |
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; |
24 |
esac |
24 |
esac |
25 |
|
25 |
|
26 |
# settings which are version specific go in here: |
26 |
# settings which are version specific go in here: |
27 |
case $(ver_cut 1-2) in |
27 |
case $(ver_cut 1-2) in |
28 |
2.4) |
28 |
2.4) |
29 |
DEFAULT_MPM_THREADED="event" #509922 |
29 |
DEFAULT_MPM_THREADED="event" #509922 |
30 |
;; |
30 |
;; |
31 |
*) |
31 |
*) |
32 |
die "Unknown MAJOR.MINOR apache version." |
32 |
die "Unknown MAJOR.MINOR apache version." |
33 |
;; |
33 |
;; |
34 |
esac |
34 |
esac |
35 |
|
35 |
|
36 |
# ============================================================================== |
36 |
# ============================================================================== |
37 |
# INTERNAL VARIABLES |
37 |
# INTERNAL VARIABLES |
38 |
# ============================================================================== |
38 |
# ============================================================================== |
39 |
|
39 |
|
40 |
# @ECLASS_VARIABLE: GENTOO_PATCHNAME |
40 |
# @ECLASS_VARIABLE: GENTOO_PATCHNAME |
41 |
# @DESCRIPTION: |
41 |
# @DESCRIPTION: |
42 |
# This internal variable contains the prefix for the patch tarball. |
42 |
# This internal variable contains the prefix for the patch tarball. |
43 |
# Defaults to the full name and version (including revision) of the package. |
43 |
# Defaults to the full name and version (including revision) of the package. |
44 |
# If you want to override this in an ebuild, use: |
44 |
# If you want to override this in an ebuild, use: |
45 |
# ORIG_PR="(revision of Gentoo stuff you want)" |
45 |
# ORIG_PR="(revision of Gentoo stuff you want)" |
46 |
# GENTOO_PATCHNAME="gentoo-${PN}-${PV}${ORIG_PR:+-${ORIG_PR}}" |
46 |
# GENTOO_PATCHNAME="gentoo-${PN}-${PV}${ORIG_PR:+-${ORIG_PR}}" |
47 |
[[ -n "${GENTOO_PATCHNAME}" ]] || GENTOO_PATCHNAME="gentoo-${PF}" |
47 |
[[ -n "${GENTOO_PATCHNAME}" ]] || GENTOO_PATCHNAME="gentoo-${PF}" |
48 |
|
48 |
|
49 |
# @ECLASS_VARIABLE: GENTOO_PATCHDIR |
49 |
# @ECLASS_VARIABLE: GENTOO_PATCHDIR |
50 |
# @DESCRIPTION: |
50 |
# @DESCRIPTION: |
51 |
# This internal variable contains the working directory where patches and config |
51 |
# This internal variable contains the working directory where patches and config |
52 |
# files are located. |
52 |
# files are located. |
53 |
# Defaults to the patchset name appended to the working directory. |
53 |
# Defaults to the patchset name appended to the working directory. |
54 |
[[ -n "${GENTOO_PATCHDIR}" ]] || GENTOO_PATCHDIR="${WORKDIR}/${GENTOO_PATCHNAME}" |
54 |
[[ -n "${GENTOO_PATCHDIR}" ]] || GENTOO_PATCHDIR="${WORKDIR}/${GENTOO_PATCHNAME}" |
55 |
|
55 |
|
56 |
# @VARIABLE: GENTOO_DEVELOPER |
56 |
# @VARIABLE: GENTOO_DEVELOPER |
57 |
# @DESCRIPTION: |
57 |
# @DESCRIPTION: |
58 |
# This variable needs to be set in the ebuild and contains the name of the |
58 |
# This variable needs to be set in the ebuild and contains the name of the |
59 |
# gentoo developer who created the patch tarball |
59 |
# gentoo developer who created the patch tarball |
60 |
|
60 |
|
61 |
# @VARIABLE: GENTOO_PATCHSTAMP |
61 |
# @VARIABLE: GENTOO_PATCHSTAMP |
62 |
# @DESCRIPTION: |
62 |
# @DESCRIPTION: |
63 |
# This variable needs to be set in the ebuild and contains the date the patch |
63 |
# This variable needs to be set in the ebuild and contains the date the patch |
64 |
# tarball was created at in YYYYMMDD format |
64 |
# tarball was created at in YYYYMMDD format |
65 |
|
65 |
|
66 |
# @VARIABLE: GENTOO_PATCH_A |
66 |
# @VARIABLE: GENTOO_PATCH_A |
67 |
# @DESCRIPTION: |
67 |
# @DESCRIPTION: |
68 |
# This variable should contain the entire filename of patch tarball. |
68 |
# This variable should contain the entire filename of patch tarball. |
69 |
# Defaults to the name of the patchset, with a datestamp. |
69 |
# Defaults to the name of the patchset, with a datestamp. |
70 |
[[ -n "${GENTOO_PATCH_A}" ]] || GENTOO_PATCH_A="${GENTOO_PATCHNAME}-${GENTOO_PATCHSTAMP}.tar.bz2" |
70 |
[[ -n "${GENTOO_PATCH_A}" ]] || GENTOO_PATCH_A="${GENTOO_PATCHNAME}-${GENTOO_PATCHSTAMP}.tar.bz2" |
71 |
|
71 |
|
72 |
SRC_URI="mirror://apache/httpd/httpd-${PV}.tar.bz2 |
72 |
SRC_URI="mirror://apache/httpd/httpd-${PV}.tar.bz2 |
73 |
https://dev.gentoo.org/~${GENTOO_DEVELOPER}/dist/apache/${GENTOO_PATCH_A}" |
73 |
https://dev.gentoo.org/~${GENTOO_DEVELOPER}/dist/apache/${GENTOO_PATCH_A}" |
74 |
|
74 |
|
75 |
# @VARIABLE: IUSE_MPMS_FORK |
75 |
# @VARIABLE: IUSE_MPMS_FORK |
76 |
# @DESCRIPTION: |
76 |
# @DESCRIPTION: |
77 |
# This variable needs to be set in the ebuild and contains a list of forking |
77 |
# This variable needs to be set in the ebuild and contains a list of forking |
78 |
# (i.e. non-threaded) MPMs |
78 |
# (i.e. non-threaded) MPMs |
79 |
|
79 |
|
80 |
# @VARIABLE: IUSE_MPMS_THREAD |
80 |
# @VARIABLE: IUSE_MPMS_THREAD |
81 |
# @DESCRIPTION: |
81 |
# @DESCRIPTION: |
82 |
# This variable needs to be set in the ebuild and contains a list of threaded |
82 |
# This variable needs to be set in the ebuild and contains a list of threaded |
83 |
# MPMs |
83 |
# MPMs |
84 |
|
84 |
|
85 |
# @VARIABLE: IUSE_MODULES |
85 |
# @VARIABLE: IUSE_MODULES |
86 |
# @DESCRIPTION: |
86 |
# @DESCRIPTION: |
87 |
# This variable needs to be set in the ebuild and contains a list of available |
87 |
# This variable needs to be set in the ebuild and contains a list of available |
88 |
# built-in modules |
88 |
# built-in modules |
89 |
|
89 |
|
90 |
IUSE_MPMS="${IUSE_MPMS_FORK} ${IUSE_MPMS_THREAD}" |
90 |
IUSE_MPMS="${IUSE_MPMS_FORK} ${IUSE_MPMS_THREAD}" |
91 |
IUSE="${IUSE} debug doc gdbm ldap selinux ssl static suexec +suexec-caps suexec-syslog split-usr threads" |
91 |
IUSE="${IUSE} debug doc gdbm ldap selinux ssl static suexec +suexec-caps suexec-syslog threads" |
92 |
|
92 |
|
93 |
for module in ${IUSE_MODULES} ; do |
93 |
for module in ${IUSE_MODULES} ; do |
94 |
case ${module} in |
94 |
case ${module} in |
95 |
# Enable http2 by default (bug #563452) |
95 |
# Enable http2 by default (bug #563452) |
96 |
http2) |
96 |
http2) |
97 |
IUSE+=" +apache2_modules_${module}" |
97 |
IUSE+=" +apache2_modules_${module}" |
98 |
;; |
98 |
;; |
99 |
systemd) |
99 |
systemd) |
100 |
IUSE+=" systemd" |
100 |
IUSE+=" systemd" |
101 |
;; |
101 |
;; |
102 |
*) |
102 |
*) |
103 |
IUSE+=" apache2_modules_${module}" |
103 |
IUSE+=" apache2_modules_${module}" |
104 |
;; |
104 |
;; |
105 |
esac |
105 |
esac |
106 |
done |
106 |
done |
107 |
|
107 |
|
108 |
_apache2_set_mpms() { |
108 |
_apache2_set_mpms() { |
109 |
local mpm |
109 |
local mpm |
110 |
local ompm |
110 |
local ompm |
111 |
|
111 |
|
112 |
for mpm in ${IUSE_MPMS} ; do |
112 |
for mpm in ${IUSE_MPMS} ; do |
113 |
IUSE="${IUSE} apache2_mpms_${mpm}" |
113 |
IUSE="${IUSE} apache2_mpms_${mpm}" |
114 |
|
114 |
|
115 |
REQUIRED_USE+=" apache2_mpms_${mpm}? (" |
115 |
REQUIRED_USE+=" apache2_mpms_${mpm}? (" |
116 |
for ompm in ${IUSE_MPMS} ; do |
116 |
for ompm in ${IUSE_MPMS} ; do |
117 |
if [[ "${mpm}" != "${ompm}" ]] ; then |
117 |
if [[ "${mpm}" != "${ompm}" ]] ; then |
118 |
REQUIRED_USE+=" !apache2_mpms_${ompm}" |
118 |
REQUIRED_USE+=" !apache2_mpms_${ompm}" |
119 |
fi |
119 |
fi |
120 |
done |
120 |
done |
121 |
|
121 |
|
122 |
if has ${mpm} ${IUSE_MPMS_FORK} ; then |
122 |
if has ${mpm} ${IUSE_MPMS_FORK} ; then |
123 |
REQUIRED_USE+=" !threads" |
123 |
REQUIRED_USE+=" !threads" |
124 |
else |
124 |
else |
125 |
REQUIRED_USE+=" threads" |
125 |
REQUIRED_USE+=" threads" |
126 |
fi |
126 |
fi |
127 |
REQUIRED_USE+=" )" |
127 |
REQUIRED_USE+=" )" |
128 |
done |
128 |
done |
129 |
|
129 |
|
130 |
REQUIRED_USE+=" apache2_mpms_prefork? ( !apache2_modules_http2 )" |
130 |
REQUIRED_USE+=" apache2_mpms_prefork? ( !apache2_modules_http2 )" |
131 |
} |
131 |
} |
132 |
_apache2_set_mpms |
132 |
_apache2_set_mpms |
133 |
unset -f _apache2_set_mpms |
133 |
unset -f _apache2_set_mpms |
134 |
|
134 |
|
135 |
NGHTTP2_VERSION=1.2.1 |
135 |
NGHTTP2_VERSION=1.2.1 |
136 |
if ver_test ${PV} -ge 2.4.55 ; then |
136 |
if ver_test ${PV} -ge 2.4.55 ; then |
137 |
NGHTTP2_VERSION=1.50.0 |
137 |
NGHTTP2_VERSION=1.50.0 |
138 |
fi |
138 |
fi |
139 |
|
139 |
|
140 |
# Dependencies |
140 |
# Dependencies |
141 |
RDEPEND=" |
141 |
RDEPEND=" |
142 |
acct-group/apache |
142 |
acct-group/apache |
143 |
acct-user/apache |
143 |
acct-user/apache |
144 |
dev-lang/perl |
144 |
dev-lang/perl |
145 |
>=dev-libs/apr-1.5.1:= |
145 |
>=dev-libs/apr-1.5.1:= |
146 |
=dev-libs/apr-util-1*:=[gdbm=,ldap?] |
146 |
=dev-libs/apr-util-1*:=[gdbm=,ldap?] |
147 |
dev-libs/libpcre2 |
147 |
dev-libs/libpcre2 |
148 |
virtual/libcrypt:= |
148 |
virtual/libcrypt:= |
149 |
apache2_modules_brotli? ( >=app-arch/brotli-0.6.0:= ) |
149 |
apache2_modules_brotli? ( >=app-arch/brotli-0.6.0:= ) |
150 |
apache2_modules_deflate? ( sys-libs/zlib ) |
150 |
apache2_modules_deflate? ( sys-libs/zlib ) |
151 |
apache2_modules_http2? ( |
151 |
apache2_modules_http2? ( |
152 |
>=net-libs/nghttp2-${NGHTTP2_VERSION}:= |
152 |
>=net-libs/nghttp2-${NGHTTP2_VERSION}:= |
153 |
kernel_linux? ( sys-apps/util-linux ) |
153 |
kernel_linux? ( sys-apps/util-linux ) |
154 |
) |
154 |
) |
155 |
apache2_modules_lua? ( ${LUA_DEPS} ) |
155 |
apache2_modules_lua? ( ${LUA_DEPS} ) |
156 |
apache2_modules_md? ( >=dev-libs/jansson-2.10:= ) |
156 |
apache2_modules_md? ( >=dev-libs/jansson-2.10:= ) |
157 |
apache2_modules_mime? ( app-misc/mime-types ) |
157 |
apache2_modules_mime? ( app-misc/mime-types ) |
158 |
apache2_modules_proxy_http2? ( |
158 |
apache2_modules_proxy_http2? ( |
159 |
>=net-libs/nghttp2-${NGHTTP2_VERSION}:= |
159 |
>=net-libs/nghttp2-${NGHTTP2_VERSION}:= |
160 |
kernel_linux? ( sys-apps/util-linux ) |
160 |
kernel_linux? ( sys-apps/util-linux ) |
161 |
) |
161 |
) |
162 |
apache2_modules_session_crypto? ( |
162 |
apache2_modules_session_crypto? ( |
163 |
dev-libs/apr-util[openssl] |
163 |
dev-libs/apr-util[openssl] |
164 |
) |
164 |
) |
165 |
apache2_modules_tls? ( >=net-libs/rustls-ffi-0.9.2:= ) |
165 |
apache2_modules_tls? ( >=net-libs/rustls-ffi-0.9.2:= ) |
166 |
gdbm? ( sys-libs/gdbm:= ) |
166 |
gdbm? ( sys-libs/gdbm:= ) |
167 |
ldap? ( net-nds/openldap:= ) |
167 |
ldap? ( net-nds/openldap:= ) |
168 |
selinux? ( sec-policy/selinux-apache ) |
168 |
selinux? ( sec-policy/selinux-apache ) |
169 |
ssl? ( |
169 |
ssl? ( |
170 |
>=dev-libs/openssl-1.0.2:= |
170 |
>=dev-libs/openssl-1.0.2:= |
171 |
kernel_linux? ( sys-apps/util-linux ) |
171 |
kernel_linux? ( sys-apps/util-linux ) |
172 |
) |
172 |
) |
173 |
systemd? ( sys-apps/systemd ) |
173 |
systemd? ( sys-apps/systemd ) |
174 |
" |
174 |
" |
175 |
DEPEND="${RDEPEND}" |
175 |
DEPEND="${RDEPEND}" |
176 |
BDEPEND=" |
176 |
BDEPEND=" |
177 |
virtual/pkgconfig |
177 |
virtual/pkgconfig |
178 |
suexec? ( suexec-caps? ( sys-libs/libcap ) ) |
178 |
suexec? ( suexec-caps? ( sys-libs/libcap ) ) |
179 |
" |
179 |
" |
180 |
PDEPEND="~app-admin/apache-tools-${PV}" |
180 |
PDEPEND="~app-admin/apache-tools-${PV}" |
181 |
|
181 |
|
182 |
REQUIRED_USE+=" |
182 |
REQUIRED_USE+=" |
183 |
apache2_modules_http2? ( ssl ) |
183 |
apache2_modules_http2? ( ssl ) |
184 |
apache2_modules_lua? ( ${LUA_REQUIRED_USE} ) |
184 |
apache2_modules_lua? ( ${LUA_REQUIRED_USE} ) |
185 |
apache2_modules_md? ( ssl ) |
185 |
apache2_modules_md? ( ssl ) |
186 |
" |
186 |
" |
187 |
|
187 |
|
188 |
S="${WORKDIR}/httpd-${PV}" |
188 |
S="${WORKDIR}/httpd-${PV}" |
189 |
|
189 |
|
190 |
# @VARIABLE: MODULE_DEPENDS |
190 |
# @VARIABLE: MODULE_DEPENDS |
191 |
# @DESCRIPTION: |
191 |
# @DESCRIPTION: |
192 |
# This variable needs to be set in the ebuild and contains a space-separated |
192 |
# This variable needs to be set in the ebuild and contains a space-separated |
193 |
# list of dependency tokens each with a module and the module it depends on |
193 |
# list of dependency tokens each with a module and the module it depends on |
194 |
# separated by a colon |
194 |
# separated by a colon |
195 |
|
195 |
|
196 |
# now extend REQUIRED_USE to reflect the module dependencies to portage |
196 |
# now extend REQUIRED_USE to reflect the module dependencies to portage |
197 |
_apache2_set_module_depends() { |
197 |
_apache2_set_module_depends() { |
198 |
local dep |
198 |
local dep |
199 |
|
199 |
|
200 |
for dep in ${MODULE_DEPENDS} ; do |
200 |
for dep in ${MODULE_DEPENDS} ; do |
201 |
REQUIRED_USE+=" apache2_modules_${dep%:*}? ( apache2_modules_${dep#*:} )" |
201 |
REQUIRED_USE+=" apache2_modules_${dep%:*}? ( apache2_modules_${dep#*:} )" |
202 |
done |
202 |
done |
203 |
} |
203 |
} |
204 |
_apache2_set_module_depends |
204 |
_apache2_set_module_depends |
205 |
unset -f _apache2_set_module_depends |
205 |
unset -f _apache2_set_module_depends |
206 |
|
206 |
|
207 |
# ============================================================================== |
207 |
# ============================================================================== |
208 |
# INTERNAL FUNCTIONS |
208 |
# INTERNAL FUNCTIONS |
209 |
# ============================================================================== |
209 |
# ============================================================================== |
210 |
|
210 |
|
211 |
# @ECLASS_VARIABLE: MY_MPM |
211 |
# @ECLASS_VARIABLE: MY_MPM |
212 |
# @DESCRIPTION: |
212 |
# @DESCRIPTION: |
213 |
# This internal variable contains the selected MPM after a call to setup_mpm() |
213 |
# This internal variable contains the selected MPM after a call to setup_mpm() |
214 |
|
214 |
|
215 |
# @FUNCTION: setup_mpm |
215 |
# @FUNCTION: setup_mpm |
216 |
# @DESCRIPTION: |
216 |
# @DESCRIPTION: |
217 |
# This internal function makes sure that only one of APACHE2_MPMS was selected |
217 |
# This internal function makes sure that only one of APACHE2_MPMS was selected |
218 |
# or a default based on USE=threads is selected if APACHE2_MPMS is empty |
218 |
# or a default based on USE=threads is selected if APACHE2_MPMS is empty |
219 |
setup_mpm() { |
219 |
setup_mpm() { |
220 |
MY_MPM="" |
220 |
MY_MPM="" |
221 |
for x in ${IUSE_MPMS} ; do |
221 |
for x in ${IUSE_MPMS} ; do |
222 |
if use apache2_mpms_${x} ; then |
222 |
if use apache2_mpms_${x} ; then |
223 |
# there can at most be one MPM selected because of REQUIRED_USE constraints |
223 |
# there can at most be one MPM selected because of REQUIRED_USE constraints |
224 |
MY_MPM=${x} |
224 |
MY_MPM=${x} |
225 |
elog |
225 |
elog |
226 |
elog "Selected MPM: ${MY_MPM}" |
226 |
elog "Selected MPM: ${MY_MPM}" |
227 |
elog |
227 |
elog |
228 |
break |
228 |
break |
229 |
fi |
229 |
fi |
230 |
done |
230 |
done |
231 |
|
231 |
|
232 |
if [[ -z "${MY_MPM}" ]] ; then |
232 |
if [[ -z "${MY_MPM}" ]] ; then |
233 |
if use threads ; then |
233 |
if use threads ; then |
234 |
MY_MPM=${DEFAULT_MPM_THREADED} |
234 |
MY_MPM=${DEFAULT_MPM_THREADED} |
235 |
elog |
235 |
elog |
236 |
elog "Selected default threaded MPM: ${MY_MPM}" |
236 |
elog "Selected default threaded MPM: ${MY_MPM}" |
237 |
elog |
237 |
elog |
238 |
else |
238 |
else |
239 |
MY_MPM=prefork |
239 |
MY_MPM=prefork |
240 |
elog |
240 |
elog |
241 |
elog "Selected default MPM: ${MY_MPM}" |
241 |
elog "Selected default MPM: ${MY_MPM}" |
242 |
elog |
242 |
elog |
243 |
fi |
243 |
fi |
244 |
fi |
244 |
fi |
245 |
} |
245 |
} |
246 |
|
246 |
|
247 |
# @VARIABLE: MODULE_CRITICAL |
247 |
# @VARIABLE: MODULE_CRITICAL |
248 |
# @DESCRIPTION: |
248 |
# @DESCRIPTION: |
249 |
# This variable needs to be set in the ebuild and contains a space-separated |
249 |
# This variable needs to be set in the ebuild and contains a space-separated |
250 |
# list of modules critical for the default apache. A user may still |
250 |
# list of modules critical for the default apache. A user may still |
251 |
# disable these modules for custom minimal installation at their own risk. |
251 |
# disable these modules for custom minimal installation at their own risk. |
252 |
|
252 |
|
253 |
# @FUNCTION: check_module_critical |
253 |
# @FUNCTION: check_module_critical |
254 |
# @DESCRIPTION: |
254 |
# @DESCRIPTION: |
255 |
# This internal function warns the user about modules critical for the default |
255 |
# This internal function warns the user about modules critical for the default |
256 |
# apache configuration. |
256 |
# apache configuration. |
257 |
check_module_critical() { |
257 |
check_module_critical() { |
258 |
local unsupported=0 |
258 |
local unsupported=0 |
259 |
|
259 |
|
260 |
for m in ${MODULE_CRITICAL} ; do |
260 |
for m in ${MODULE_CRITICAL} ; do |
261 |
if ! has ${m} ${MY_MODS[@]} ; then |
261 |
if ! has ${m} ${MY_MODS[@]} ; then |
262 |
ewarn "Module '${m}' is required in the default apache configuration." |
262 |
ewarn "Module '${m}' is required in the default apache configuration." |
263 |
unsupported=1 |
263 |
unsupported=1 |
264 |
fi |
264 |
fi |
265 |
done |
265 |
done |
266 |
|
266 |
|
267 |
if [[ ${unsupported} -ne 0 ]] ; then |
267 |
if [[ ${unsupported} -ne 0 ]] ; then |
268 |
ewarn |
268 |
ewarn |
269 |
ewarn "You have disabled one or more required modules" |
269 |
ewarn "You have disabled one or more required modules" |
270 |
ewarn "for the default apache configuration." |
270 |
ewarn "for the default apache configuration." |
271 |
ewarn "Although this is not an error, please be" |
271 |
ewarn "Although this is not an error, please be" |
272 |
ewarn "aware that this setup is UNSUPPORTED." |
272 |
ewarn "aware that this setup is UNSUPPORTED." |
273 |
ewarn |
273 |
ewarn |
274 |
fi |
274 |
fi |
275 |
} |
275 |
} |
276 |
|
276 |
|
277 |
# @ECLASS_VARIABLE: MY_CONF |
277 |
# @ECLASS_VARIABLE: MY_CONF |
278 |
# @DESCRIPTION: |
278 |
# @DESCRIPTION: |
279 |
# This internal variable contains the econf options for the current module |
279 |
# This internal variable contains the econf options for the current module |
280 |
# selection after a call to setup_modules() |
280 |
# selection after a call to setup_modules() |
281 |
|
281 |
|
282 |
# @ECLASS_VARIABLE: MY_MODS |
282 |
# @ECLASS_VARIABLE: MY_MODS |
283 |
# @DESCRIPTION: |
283 |
# @DESCRIPTION: |
284 |
# This internal variable contains a sorted, space separated list of currently |
284 |
# This internal variable contains a sorted, space separated list of currently |
285 |
# selected modules after a call to setup_modules() |
285 |
# selected modules after a call to setup_modules() |
286 |
|
286 |
|
287 |
# @FUNCTION: setup_modules |
287 |
# @FUNCTION: setup_modules |
288 |
# @DESCRIPTION: |
288 |
# @DESCRIPTION: |
289 |
# This internal function selects all built-in modules based on USE flags and |
289 |
# This internal function selects all built-in modules based on USE flags and |
290 |
# APACHE2_MODULES USE_EXPAND flags |
290 |
# APACHE2_MODULES USE_EXPAND flags |
291 |
setup_modules() { |
291 |
setup_modules() { |
292 |
local mod_type= x= |
292 |
local mod_type= x= |
293 |
|
293 |
|
294 |
if use static ; then |
294 |
if use static ; then |
295 |
mod_type="static" |
295 |
mod_type="static" |
296 |
else |
296 |
else |
297 |
mod_type="shared" |
297 |
mod_type="shared" |
298 |
fi |
298 |
fi |
299 |
|
299 |
|
300 |
MY_CONF=( --enable-so=static --disable-static ) |
300 |
MY_CONF=( --enable-so=static --disable-static ) |
301 |
MY_MODS=() |
301 |
MY_MODS=() |
302 |
|
302 |
|
303 |
if use ldap ; then |
303 |
if use ldap ; then |
304 |
MY_CONF+=( |
304 |
MY_CONF+=( |
305 |
--enable-authnz_ldap=${mod_type} |
305 |
--enable-authnz_ldap=${mod_type} |
306 |
--enable-ldap=${mod_type} |
306 |
--enable-ldap=${mod_type} |
307 |
) |
307 |
) |
308 |
MY_MODS+=( ldap authnz_ldap ) |
308 |
MY_MODS+=( ldap authnz_ldap ) |
309 |
else |
309 |
else |
310 |
MY_CONF+=( --disable-authnz_ldap --disable-ldap ) |
310 |
MY_CONF+=( --disable-authnz_ldap --disable-ldap ) |
311 |
fi |
311 |
fi |
312 |
|
312 |
|
313 |
if use ssl ; then |
313 |
if use ssl ; then |
314 |
MY_CONF+=( --with-ssl --enable-ssl=${mod_type} ) |
314 |
MY_CONF+=( --with-ssl --enable-ssl=${mod_type} ) |
315 |
MY_MODS+=( ssl ) |
315 |
MY_MODS+=( ssl ) |
316 |
else |
316 |
else |
317 |
MY_CONF+=( --without-ssl --disable-ssl ) |
317 |
MY_CONF+=( --without-ssl --disable-ssl ) |
318 |
fi |
318 |
fi |
319 |
|
319 |
|
320 |
if use suexec ; then |
320 |
if use suexec ; then |
321 |
elog "You can manipulate several configure options of suexec" |
321 |
elog "You can manipulate several configure options of suexec" |
322 |
elog "through the following environment variables:" |
322 |
elog "through the following environment variables:" |
323 |
elog |
323 |
elog |
324 |
elog " SUEXEC_SAFEPATH: Default PATH for suexec (default: '${EPREFIX}/usr/local/bin:${EPREFIX}/usr/bin:${EPREFIX}/bin')" |
324 |
elog " SUEXEC_SAFEPATH: Default PATH for suexec (default: '${EPREFIX}/usr/local/bin:${EPREFIX}/usr/bin:${EPREFIX}/bin')" |
325 |
if ! use suexec-syslog ; then |
325 |
if ! use suexec-syslog ; then |
326 |
elog " SUEXEC_LOGFILE: Path to the suexec logfile (default: '${EPREFIX}/var/log/apache2/suexec_log')" |
326 |
elog " SUEXEC_LOGFILE: Path to the suexec logfile (default: '${EPREFIX}/var/log/apache2/suexec_log')" |
327 |
fi |
327 |
fi |
328 |
elog " SUEXEC_CALLER: Name of the user Apache is running as (default: apache)" |
328 |
elog " SUEXEC_CALLER: Name of the user Apache is running as (default: apache)" |
329 |
elog " SUEXEC_DOCROOT: Directory in which suexec will run scripts (default: '${EPREFIX}/var/www')" |
329 |
elog " SUEXEC_DOCROOT: Directory in which suexec will run scripts (default: '${EPREFIX}/var/www')" |
330 |
elog " SUEXEC_MINUID: Minimum UID, which is allowed to run scripts via suexec (default: 1000)" |
330 |
elog " SUEXEC_MINUID: Minimum UID, which is allowed to run scripts via suexec (default: 1000)" |
331 |
elog " SUEXEC_MINGID: Minimum GID, which is allowed to run scripts via suexec (default: 100)" |
331 |
elog " SUEXEC_MINGID: Minimum GID, which is allowed to run scripts via suexec (default: 100)" |
332 |
elog " SUEXEC_USERDIR: User subdirectories (like /home/user/html) (default: public_html)" |
332 |
elog " SUEXEC_USERDIR: User subdirectories (like /home/user/html) (default: public_html)" |
333 |
elog " SUEXEC_UMASK: Umask for the suexec process (default: 077)" |
333 |
elog " SUEXEC_UMASK: Umask for the suexec process (default: 077)" |
334 |
elog |
334 |
elog |
335 |
|
335 |
|
336 |
MY_CONF+=( --with-suexec-safepath="${SUEXEC_SAFEPATH:-${EPREFIX}/usr/local/bin:${EPREFIX}/usr/bin:${EPREFIX}/bin}" ) |
336 |
MY_CONF+=( --with-suexec-safepath="${SUEXEC_SAFEPATH:-${EPREFIX}/usr/local/bin:${EPREFIX}/usr/bin:${EPREFIX}/bin}" ) |
337 |
MY_CONF+=( $(use_with !suexec-syslog suexec-logfile "${SUEXEC_LOGFILE:-${EPREFIX}/var/log/apache2/suexec_log}") ) |
337 |
MY_CONF+=( $(use_with !suexec-syslog suexec-logfile "${SUEXEC_LOGFILE:-${EPREFIX}/var/log/apache2/suexec_log}") ) |
338 |
MY_CONF+=( $(use_with suexec-syslog) ) |
338 |
MY_CONF+=( $(use_with suexec-syslog) ) |
339 |
if use suexec-syslog && use suexec-caps ; then |
339 |
if use suexec-syslog && use suexec-caps ; then |
340 |
MY_CONF+=( --enable-suexec-capabilities ) |
340 |
MY_CONF+=( --enable-suexec-capabilities ) |
341 |
fi |
341 |
fi |
342 |
MY_CONF+=( --with-suexec-bin="${EPREFIX}/usr/sbin/suexec" ) |
342 |
MY_CONF+=( --with-suexec-bin="${EPREFIX}/usr/sbin/suexec" ) |
343 |
MY_CONF+=( --with-suexec-userdir=${SUEXEC_USERDIR:-public_html} ) |
343 |
MY_CONF+=( --with-suexec-userdir=${SUEXEC_USERDIR:-public_html} ) |
344 |
MY_CONF+=( --with-suexec-caller=${SUEXEC_CALLER:-apache} ) |
344 |
MY_CONF+=( --with-suexec-caller=${SUEXEC_CALLER:-apache} ) |
345 |
MY_CONF+=( --with-suexec-docroot="${SUEXEC_DOCROOT:-${EPREFIX}/var/www}" ) |
345 |
MY_CONF+=( --with-suexec-docroot="${SUEXEC_DOCROOT:-${EPREFIX}/var/www}" ) |
346 |
MY_CONF+=( --with-suexec-uidmin=${SUEXEC_MINUID:-1000} ) |
346 |
MY_CONF+=( --with-suexec-uidmin=${SUEXEC_MINUID:-1000} ) |
347 |
MY_CONF+=( --with-suexec-gidmin=${SUEXEC_MINGID:-100} ) |
347 |
MY_CONF+=( --with-suexec-gidmin=${SUEXEC_MINGID:-100} ) |
348 |
MY_CONF+=( --with-suexec-umask=${SUEXEC_UMASK:-077} ) |
348 |
MY_CONF+=( --with-suexec-umask=${SUEXEC_UMASK:-077} ) |
349 |
MY_CONF+=( --enable-suexec=${mod_type} ) |
349 |
MY_CONF+=( --enable-suexec=${mod_type} ) |
350 |
MY_MODS+=( suexec ) |
350 |
MY_MODS+=( suexec ) |
351 |
else |
351 |
else |
352 |
MY_CONF+=( --disable-suexec ) |
352 |
MY_CONF+=( --disable-suexec ) |
353 |
fi |
353 |
fi |
354 |
|
354 |
|
355 |
if use systemd ; then |
355 |
if use systemd ; then |
356 |
MY_CONF+=( --enable-systemd=${mod_type} ) |
356 |
MY_CONF+=( --enable-systemd=${mod_type} ) |
357 |
MY_MODS+=( systemd ) |
357 |
MY_MODS+=( systemd ) |
358 |
fi |
358 |
fi |
359 |
|
359 |
|
360 |
for x in ${IUSE_MODULES/ systemd} ; do |
360 |
for x in ${IUSE_MODULES/ systemd} ; do |
361 |
if use apache2_modules_${x} ; then |
361 |
if use apache2_modules_${x} ; then |
362 |
MY_CONF+=( --enable-${x}=${mod_type} ) |
362 |
MY_CONF+=( --enable-${x}=${mod_type} ) |
363 |
MY_MODS+=( ${x} ) |
363 |
MY_MODS+=( ${x} ) |
364 |
else |
364 |
else |
365 |
MY_CONF+=( --disable-${x} ) |
365 |
MY_CONF+=( --disable-${x} ) |
366 |
fi |
366 |
fi |
367 |
done |
367 |
done |
368 |
|
368 |
|
369 |
# sort and uniquify MY_MODS |
369 |
# sort and uniquify MY_MODS |
370 |
MY_MODS=( $(echo ${MY_MODS[@]} | tr ' ' '\n' | sort -u) ) |
370 |
MY_MODS=( $(echo ${MY_MODS[@]} | tr ' ' '\n' | sort -u) ) |
371 |
check_module_critical |
371 |
check_module_critical |
372 |
} |
372 |
} |
373 |
|
373 |
|
374 |
# @VARIABLE: MODULE_DEFINES |
374 |
# @VARIABLE: MODULE_DEFINES |
375 |
# @DESCRIPTION: |
375 |
# @DESCRIPTION: |
376 |
# This variable needs to be set in the ebuild and contains a space-separated |
376 |
# This variable needs to be set in the ebuild and contains a space-separated |
377 |
# list of tokens each mapping a module to a runtime define which can be |
377 |
# list of tokens each mapping a module to a runtime define which can be |
378 |
# specified in APACHE2_OPTS in /etc/conf.d/apache2 to enable this particular |
378 |
# specified in APACHE2_OPTS in /etc/conf.d/apache2 to enable this particular |
379 |
# module. |
379 |
# module. |
380 |
|
380 |
|
381 |
# @FUNCTION: generate_load_module |
381 |
# @FUNCTION: generate_load_module |
382 |
# @DESCRIPTION: |
382 |
# @DESCRIPTION: |
383 |
# This internal function generates the LoadModule lines for httpd.conf based on |
383 |
# This internal function generates the LoadModule lines for httpd.conf based on |
384 |
# the current module selection and MODULE_DEFINES |
384 |
# the current module selection and MODULE_DEFINES |
385 |
generate_load_module() { |
385 |
generate_load_module() { |
386 |
local def= endit=0 m= mod_lines= mod_dir="${ED}/usr/$(get_libdir)/apache2/modules" |
386 |
local def= endit=0 m= mod_lines= mod_dir="${ED}/usr/$(get_libdir)/apache2/modules" |
387 |
|
387 |
|
388 |
if use static; then |
388 |
if use static; then |
389 |
sed -i -e "/%%LOAD_MODULE%%/d" \ |
389 |
sed -i -e "/%%LOAD_MODULE%%/d" \ |
390 |
"${GENTOO_PATCHDIR}"/conf/httpd.conf |
390 |
"${GENTOO_PATCHDIR}"/conf/httpd.conf |
391 |
return |
391 |
return |
392 |
fi |
392 |
fi |
393 |
|
393 |
|
394 |
for m in ${MY_MODS[@]} ; do |
394 |
for m in ${MY_MODS[@]} ; do |
395 |
if [[ -e "${mod_dir}/mod_${m}.so" ]] ; then |
395 |
if [[ -e "${mod_dir}/mod_${m}.so" ]] ; then |
396 |
for def in ${MODULE_DEFINES} ; do |
396 |
for def in ${MODULE_DEFINES} ; do |
397 |
if [[ "${m}" == "${def%:*}" ]] ; then |
397 |
if [[ "${m}" == "${def%:*}" ]] ; then |
398 |
mod_lines="${mod_lines}\n<IfDefine ${def#*:}>" |
398 |
mod_lines="${mod_lines}\n<IfDefine ${def#*:}>" |
399 |
endit=1 |
399 |
endit=1 |
400 |
fi |
400 |
fi |
401 |
done |
401 |
done |
402 |
|
402 |
|
403 |
mod_lines="${mod_lines}\nLoadModule ${m}_module modules/mod_${m}.so" |
403 |
mod_lines="${mod_lines}\nLoadModule ${m}_module modules/mod_${m}.so" |
404 |
|
404 |
|
405 |
if [[ ${endit} -ne 0 ]] ; then |
405 |
if [[ ${endit} -ne 0 ]] ; then |
406 |
mod_lines="${mod_lines}\n</IfDefine>" |
406 |
mod_lines="${mod_lines}\n</IfDefine>" |
407 |
endit=0 |
407 |
endit=0 |
408 |
fi |
408 |
fi |
409 |
fi |
409 |
fi |
410 |
done |
410 |
done |
411 |
|
411 |
|
412 |
sed -i -e "s:%%LOAD_MODULE%%:${mod_lines}:" \ |
412 |
sed -i -e "s:%%LOAD_MODULE%%:${mod_lines}:" \ |
413 |
"${GENTOO_PATCHDIR}"/conf/httpd.conf |
413 |
"${GENTOO_PATCHDIR}"/conf/httpd.conf |
414 |
} |
414 |
} |
415 |
|
415 |
|
416 |
# @FUNCTION: check_upgrade |
416 |
# @FUNCTION: check_upgrade |
417 |
# @DESCRIPTION: |
417 |
# @DESCRIPTION: |
418 |
# This internal function checks if the previous configuration file for built-in |
418 |
# This internal function checks if the previous configuration file for built-in |
419 |
# modules exists in ROOT and prevents upgrade in this case. Users are supposed |
419 |
# modules exists in ROOT and prevents upgrade in this case. Users are supposed |
420 |
# to convert this file to the new APACHE2_MODULES USE_EXPAND variable and remove |
420 |
# to convert this file to the new APACHE2_MODULES USE_EXPAND variable and remove |
421 |
# it afterwards. |
421 |
# it afterwards. |
422 |
check_upgrade() { |
422 |
check_upgrade() { |
423 |
if [[ -e "${EROOT}"etc/apache2/apache2-builtin-mods ]]; then |
423 |
if [[ -e "${EROOT}"etc/apache2/apache2-builtin-mods ]]; then |
424 |
eerror "The previous configuration file for built-in modules" |
424 |
eerror "The previous configuration file for built-in modules" |
425 |
eerror "(${EROOT}etc/apache2/apache2-builtin-mods) exists on your" |
425 |
eerror "(${EROOT}etc/apache2/apache2-builtin-mods) exists on your" |
426 |
eerror "system." |
426 |
eerror "system." |
427 |
eerror |
427 |
eerror |
428 |
eerror "Please read https://wiki.gentoo.org/wiki/Project:Apache/Upgrading" |
428 |
eerror "Please read https://wiki.gentoo.org/wiki/Project:Apache/Upgrading" |
429 |
eerror "for detailed information how to convert this file to the new" |
429 |
eerror "for detailed information how to convert this file to the new" |
430 |
eerror "APACHE2_MODULES USE_EXPAND variable." |
430 |
eerror "APACHE2_MODULES USE_EXPAND variable." |
431 |
eerror |
431 |
eerror |
432 |
die "upgrade not possible with existing ${ROOT}etc/apache2/apache2-builtin-mods" |
432 |
die "upgrade not possible with existing ${ROOT}etc/apache2/apache2-builtin-mods" |
433 |
fi |
433 |
fi |
434 |
} |
434 |
} |
435 |
|
435 |
|
436 |
# ============================================================================== |
436 |
# ============================================================================== |
437 |
# EXPORTED FUNCTIONS |
437 |
# EXPORTED FUNCTIONS |
438 |
# ============================================================================== |
438 |
# ============================================================================== |
439 |
|
439 |
|
440 |
# @FUNCTION: apache-2_pkg_setup |
440 |
# @FUNCTION: apache-2_pkg_setup |
441 |
# @DESCRIPTION: |
441 |
# @DESCRIPTION: |
442 |
# This function selects built-in modules, the MPM and other configure options, |
442 |
# This function selects built-in modules, the MPM and other configure options, |
443 |
# creates the apache user and group and informs about CONFIG_SYSVIPC being |
443 |
# creates the apache user and group and informs about CONFIG_SYSVIPC being |
444 |
# needed (we don't depend on kernel sources and therefore cannot check). |
444 |
# needed (we don't depend on kernel sources and therefore cannot check). |
445 |
apache-2_pkg_setup() { |
445 |
apache-2_pkg_setup() { |
446 |
check_upgrade |
446 |
check_upgrade |
447 |
|
447 |
|
448 |
setup_mpm |
448 |
setup_mpm |
449 |
setup_modules |
449 |
setup_modules |
450 |
|
450 |
|
451 |
if use debug; then |
451 |
if use debug; then |
452 |
MY_CONF+=( --enable-exception-hook ) |
452 |
MY_CONF+=( --enable-exception-hook ) |
453 |
fi |
453 |
fi |
454 |
|
454 |
|
455 |
elog "Please note that you need SysV IPC support in your kernel." |
455 |
elog "Please note that you need SysV IPC support in your kernel." |
456 |
elog "Make sure CONFIG_SYSVIPC=y is set." |
456 |
elog "Make sure CONFIG_SYSVIPC=y is set." |
457 |
elog |
457 |
elog |
458 |
|
458 |
|
459 |
if use apache2_modules_lua ; then |
459 |
if use apache2_modules_lua ; then |
460 |
lua-single_pkg_setup |
460 |
lua-single_pkg_setup |
461 |
fi |
461 |
fi |
462 |
} |
462 |
} |
463 |
|
463 |
|
464 |
# @FUNCTION: apache-2_src_prepare |
464 |
# @FUNCTION: apache-2_src_prepare |
465 |
# @DESCRIPTION: |
465 |
# @DESCRIPTION: |
466 |
# This function applies patches, configures a custom file-system layout and |
466 |
# This function applies patches, configures a custom file-system layout and |
467 |
# rebuilds the configure scripts. |
467 |
# rebuilds the configure scripts. |
468 |
apache-2_src_prepare() { |
468 |
apache-2_src_prepare() { |
469 |
#fix prefix in conf files etc (bug #433736) |
469 |
#fix prefix in conf files etc (bug #433736) |
470 |
use !prefix || sed -e "s@/\(usr\|var\|etc\|run\)/@${EPREFIX}&@g" \ |
470 |
use !prefix || sed -e "s@/\(usr\|var\|etc\|run\)/@${EPREFIX}&@g" \ |
471 |
-i "${GENTOO_PATCHDIR}"/conf/httpd.conf "${GENTOO_PATCHDIR}"/scripts/* \ |
471 |
-i "${GENTOO_PATCHDIR}"/conf/httpd.conf "${GENTOO_PATCHDIR}"/scripts/* \ |
472 |
"${GENTOO_PATCHDIR}"/docs/*.example "${GENTOO_PATCHDIR}"/patches/*.layout \ |
472 |
"${GENTOO_PATCHDIR}"/docs/*.example "${GENTOO_PATCHDIR}"/patches/*.layout \ |
473 |
"${GENTOO_PATCHDIR}"/init/* "${GENTOO_PATCHDIR}"/conf/vhosts.d/* \ |
473 |
"${GENTOO_PATCHDIR}"/init/* "${GENTOO_PATCHDIR}"/conf/vhosts.d/* \ |
474 |
"${GENTOO_PATCHDIR}"/conf/modules.d/* || die |
474 |
"${GENTOO_PATCHDIR}"/conf/modules.d/* || die |
475 |
|
475 |
|
476 |
# 03_all_gentoo-apache-tools.patch injects -Wl,-z,now, which is not a good |
476 |
# 03_all_gentoo-apache-tools.patch injects -Wl,-z,now, which is not a good |
477 |
# idea for everyone |
477 |
# idea for everyone |
478 |
case ${CHOST} in |
478 |
case ${CHOST} in |
479 |
*-linux-gnu|*-solaris*) |
479 |
*-linux-gnu|*-solaris*) |
480 |
# do nothing, these use GNU binutils |
480 |
# do nothing, these use GNU binutils |
481 |
: |
481 |
: |
482 |
;; |
482 |
;; |
483 |
*-darwin*) |
483 |
*-darwin*) |
484 |
sed -i -e 's/-Wl,-z,now/-Wl,-bind_at_load/g' \ |
484 |
sed -i -e 's/-Wl,-z,now/-Wl,-bind_at_load/g' \ |
485 |
"${GENTOO_PATCHDIR}"/patches/03_all_gentoo_apache-tools.patch \ |
485 |
"${GENTOO_PATCHDIR}"/patches/03_all_gentoo_apache-tools.patch \ |
486 |
|| die |
486 |
|| die |
487 |
;; |
487 |
;; |
488 |
*) |
488 |
*) |
489 |
# patch it out to be like upstream |
489 |
# patch it out to be like upstream |
490 |
sed -i -e 's/-Wl,-z,now//g' \ |
490 |
sed -i -e 's/-Wl,-z,now//g' \ |
491 |
"${GENTOO_PATCHDIR}"/patches/03_all_gentoo_apache-tools.patch \ |
491 |
"${GENTOO_PATCHDIR}"/patches/03_all_gentoo_apache-tools.patch \ |
492 |
|| die |
492 |
|| die |
493 |
;; |
493 |
;; |
494 |
esac |
494 |
esac |
495 |
|
495 |
|
496 |
# Use correct multilib libdir in gentoo patches |
496 |
# Use correct multilib libdir in gentoo patches |
497 |
sed -i -e "s:/usr/lib:/usr/$(get_libdir):g" \ |
497 |
sed -i -e "s:/usr/lib:/usr/$(get_libdir):g" \ |
498 |
"${GENTOO_PATCHDIR}"/{conf/httpd.conf,init/*,patches/config.layout} \ |
498 |
"${GENTOO_PATCHDIR}"/{conf/httpd.conf,init/*,patches/config.layout} \ |
499 |
|| die "libdir sed failed" |
499 |
|| die "libdir sed failed" |
500 |
|
500 |
|
501 |
eapply "${GENTOO_PATCHDIR}"/patches/*.patch |
501 |
eapply "${GENTOO_PATCHDIR}"/patches/*.patch |
502 |
default |
502 |
default |
503 |
|
503 |
|
504 |
# Don't rename configure.in _before_ any possible user patches! |
504 |
# Don't rename configure.in _before_ any possible user patches! |
505 |
if [[ -f "configure.in" ]] ; then |
505 |
if [[ -f "configure.in" ]] ; then |
506 |
einfo "Renaming configure.in to configure.ac" |
506 |
einfo "Renaming configure.in to configure.ac" |
507 |
mv configure.{in,ac} || die |
507 |
mv configure.{in,ac} || die |
508 |
fi |
508 |
fi |
509 |
|
509 |
|
510 |
# setup the filesystem layout config |
510 |
# setup the filesystem layout config |
511 |
cat "${GENTOO_PATCHDIR}"/patches/config.layout >> "${S}"/config.layout || \ |
511 |
cat "${GENTOO_PATCHDIR}"/patches/config.layout >> "${S}"/config.layout || \ |
512 |
die "Failed preparing config.layout!" |
512 |
die "Failed preparing config.layout!" |
513 |
sed -i -e "s:version:${PF}:g" "${S}"/config.layout || die |
513 |
sed -i -e "s:version:${PF}:g" "${S}"/config.layout || die |
514 |
|
514 |
|
515 |
# apache2.8 instead of httpd.8 (bug #194828) |
515 |
# apache2.8 instead of httpd.8 (bug #194828) |
516 |
mv docs/man/{httpd,apache2}.8 || die |
516 |
mv docs/man/{httpd,apache2}.8 || die |
517 |
sed -i -e 's/httpd\.8/apache2.8/g' Makefile.in || die |
517 |
sed -i -e 's/httpd\.8/apache2.8/g' Makefile.in || die |
518 |
|
518 |
|
519 |
# patched-in MPMs need the build environment rebuilt |
519 |
# patched-in MPMs need the build environment rebuilt |
520 |
sed -i -e '/sinclude/d' configure.ac || die |
520 |
sed -i -e '/sinclude/d' configure.ac || die |
521 |
AT_M4DIR=build eautoreconf |
521 |
AT_M4DIR=build eautoreconf |
522 |
|
522 |
|
523 |
# ${T} must be not group-writable, else grsec TPE will block it |
523 |
# ${T} must be not group-writable, else grsec TPE will block it |
524 |
chmod g-w "${T}" || die |
524 |
chmod g-w "${T}" || die |
525 |
|
525 |
|
526 |
# This package really should upgrade to using pcre's .pc file. |
526 |
# This package really should upgrade to using pcre's .pc file. |
527 |
cat <<-\EOF > "${T}"/pcre2-config |
527 |
cat <<-\EOF > "${T}"/pcre2-config |
528 |
#!/usr/bin/env bash |
528 |
#!/usr/bin/env bash |
529 |
flags=() |
529 |
flags=() |
530 |
for flag; do |
530 |
for flag; do |
531 |
if [[ ${flag} == "--version" ]]; then |
531 |
if [[ ${flag} == "--version" ]]; then |
532 |
flags+=( --modversion ) |
532 |
flags+=( --modversion ) |
533 |
else |
533 |
else |
534 |
flags+=( "${flag}" ) |
534 |
flags+=( "${flag}" ) |
535 |
fi |
535 |
fi |
536 |
done |
536 |
done |
537 |
exec ${PKG_CONFIG} libpcre2-8 "${flags[@]}" |
537 |
exec ${PKG_CONFIG} libpcre2-8 "${flags[@]}" |
538 |
EOF |
538 |
EOF |
539 |
chmod a+x "${T}"/pcre2-config || die |
539 |
chmod a+x "${T}"/pcre2-config || die |
540 |
} |
540 |
} |
541 |
|
541 |
|
542 |
# @FUNCTION: apache-2_src_configure |
542 |
# @FUNCTION: apache-2_src_configure |
543 |
# @DESCRIPTION: |
543 |
# @DESCRIPTION: |
544 |
# This function adds compiler flags and runs econf and emake based on MY_MPM and |
544 |
# This function adds compiler flags and runs econf and emake based on MY_MPM and |
545 |
# MY_CONF |
545 |
# MY_CONF |
546 |
apache-2_src_configure() { |
546 |
apache-2_src_configure() { |
547 |
tc-export PKG_CONFIG |
547 |
tc-export PKG_CONFIG |
548 |
export ac_cv_path_PKGCONFIG="${PKG_CONFIG}" |
548 |
export ac_cv_path_PKGCONFIG="${PKG_CONFIG}" |
549 |
|
549 |
|
550 |
# Sanity check in case people have bad mounts/TPE settings. #500928 |
550 |
# Sanity check in case people have bad mounts/TPE settings. #500928 |
551 |
if ! "${T}"/pcre2-config --help &>/dev/null ; then |
551 |
if ! "${T}"/pcre2-config --help &>/dev/null ; then |
552 |
eerror "Could not execute ${T}/pcre2-config; do you have bad mount" |
552 |
eerror "Could not execute ${T}/pcre2-config; do you have bad mount" |
553 |
eerror "permissions in ${T} or have TPE turned on in your kernel?" |
553 |
eerror "permissions in ${T} or have TPE turned on in your kernel?" |
554 |
die "check your runtime settings #500928" |
554 |
die "check your runtime settings #500928" |
555 |
fi |
555 |
fi |
556 |
|
556 |
|
557 |
# Instead of filtering --as-needed (bug #128505), append --no-as-needed |
557 |
# Instead of filtering --as-needed (bug #128505), append --no-as-needed |
558 |
# Thanks to Harald van Dijk |
558 |
# Thanks to Harald van Dijk |
559 |
append-ldflags $(no-as-needed) |
559 |
append-ldflags $(no-as-needed) |
560 |
|
560 |
|
561 |
# peruser MPM debugging with -X is nearly impossible |
561 |
# peruser MPM debugging with -X is nearly impossible |
562 |
if has peruser ${IUSE_MPMS} && use apache2_mpms_peruser ; then |
562 |
if has peruser ${IUSE_MPMS} && use apache2_mpms_peruser ; then |
563 |
use debug && append-flags -DMPM_PERUSER_DEBUG |
563 |
use debug && append-flags -DMPM_PERUSER_DEBUG |
564 |
fi |
564 |
fi |
565 |
|
565 |
|
566 |
# econf overwrites the stuff from config.layout, so we have to put them into |
566 |
# econf overwrites the stuff from config.layout, so we have to put them into |
567 |
# our myconf line too |
567 |
# our myconf line too |
568 |
MY_CONF+=( |
568 |
MY_CONF+=( |
569 |
--includedir="${EPREFIX}"/usr/include/apache2 |
569 |
--includedir="${EPREFIX}"/usr/include/apache2 |
570 |
--libexecdir="${EPREFIX}"/usr/$(get_libdir)/apache2/modules |
570 |
--libexecdir="${EPREFIX}"/usr/$(get_libdir)/apache2/modules |
571 |
--datadir="${EPREFIX}"/var/www/localhost |
571 |
--datadir="${EPREFIX}"/var/www/localhost |
572 |
--sysconfdir="${EPREFIX}"/etc/apache2 |
572 |
--sysconfdir="${EPREFIX}"/etc/apache2 |
573 |
--localstatedir="${EPREFIX}"/var |
573 |
--localstatedir="${EPREFIX}"/var |
574 |
--with-mpm=${MY_MPM} |
574 |
--with-mpm=${MY_MPM} |
575 |
--with-apr="${SYSROOT}${EPREFIX}"/usr |
575 |
--with-apr="${SYSROOT}${EPREFIX}"/usr |
576 |
--with-apr-util="${SYSROOT}${EPREFIX}"/usr |
576 |
--with-apr-util="${SYSROOT}${EPREFIX}"/usr |
577 |
--with-z="${EPREFIX}"/usr |
577 |
--with-z="${EPREFIX}"/usr |
578 |
--with-port=80 |
578 |
--with-port=80 |
579 |
--with-program-name=apache2 |
579 |
--with-program-name=apache2 |
580 |
--enable-layout=Gentoo |
580 |
--enable-layout=Gentoo |
581 |
) |
581 |
) |
582 |
|
582 |
|
583 |
export ac_cv_prog_ac_ct_PCRE_CONFIG="${T}"/pcre2-config |
583 |
export ac_cv_prog_ac_ct_PCRE_CONFIG="${T}"/pcre2-config |
584 |
|
584 |
|
585 |
MY_CONF+=( |
585 |
MY_CONF+=( |
586 |
--without-pcre |
586 |
--without-pcre |
587 |
--with-pcre2="${T}"/pcre2-config |
587 |
--with-pcre2="${T}"/pcre2-config |
588 |
) |
588 |
) |
589 |
|
589 |
|
590 |
econf "${MY_CONF[@]}" |
590 |
econf "${MY_CONF[@]}" |
591 |
|
591 |
|
592 |
sed -i -e 's:apache2\.conf:httpd.conf:' include/ap_config_auto.h || die |
592 |
sed -i -e 's:apache2\.conf:httpd.conf:' include/ap_config_auto.h || die |
593 |
} |
593 |
} |
594 |
|
594 |
|
595 |
# @FUNCTION: apache-2_src_install |
595 |
# @FUNCTION: apache-2_src_install |
596 |
# @DESCRIPTION: |
596 |
# @DESCRIPTION: |
597 |
# This function runs `emake install' and generates, installs and adapts the gentoo |
597 |
# This function runs `emake install' and generates, installs and adapts the gentoo |
598 |
# specific configuration files found in the tarball |
598 |
# specific configuration files found in the tarball |
599 |
apache-2_src_install() { |
599 |
apache-2_src_install() { |
600 |
emake DESTDIR="${D}" MKINSTALLDIRS="mkdir -p" install |
600 |
emake DESTDIR="${D}" MKINSTALLDIRS="mkdir -p" install |
601 |
|
601 |
|
602 |
# install our configuration files |
602 |
# install our configuration files |
603 |
keepdir /etc/apache2/vhosts.d |
603 |
keepdir /etc/apache2/vhosts.d |
604 |
keepdir /etc/apache2/modules.d |
604 |
keepdir /etc/apache2/modules.d |
605 |
|
605 |
|
606 |
generate_load_module |
606 |
generate_load_module |
607 |
insinto /etc/apache2 |
607 |
insinto /etc/apache2 |
608 |
doins -r "${GENTOO_PATCHDIR}"/conf/* |
608 |
doins -r "${GENTOO_PATCHDIR}"/conf/* |
609 |
use apache2_modules_mime_magic && doins docs/conf/magic |
609 |
use apache2_modules_mime_magic && doins docs/conf/magic |
610 |
|
610 |
|
611 |
insinto /etc/logrotate.d |
611 |
insinto /etc/logrotate.d |
612 |
newins "${GENTOO_PATCHDIR}"/scripts/apache2-logrotate apache2 |
612 |
newins "${GENTOO_PATCHDIR}"/scripts/apache2-logrotate apache2 |
613 |
|
613 |
|
614 |
# generate a sane default APACHE2_OPTS |
614 |
# generate a sane default APACHE2_OPTS |
615 |
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO" |
615 |
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO" |
616 |
use doc && APACHE2_OPTS+=" -D MANUAL" |
616 |
use doc && APACHE2_OPTS+=" -D MANUAL" |
617 |
use ssl && APACHE2_OPTS+=" -D SSL -D SSL_DEFAULT_VHOST" |
617 |
use ssl && APACHE2_OPTS+=" -D SSL -D SSL_DEFAULT_VHOST" |
618 |
use suexec && APACHE2_OPTS+=" -D SUEXEC" |
618 |
use suexec && APACHE2_OPTS+=" -D SUEXEC" |
619 |
if has negotiation ${APACHE2_MODULES} && use apache2_modules_negotiation; then |
619 |
if has negotiation ${APACHE2_MODULES} && use apache2_modules_negotiation; then |
620 |
APACHE2_OPTS+=" -D LANGUAGE" |
620 |
APACHE2_OPTS+=" -D LANGUAGE" |
621 |
fi |
621 |
fi |
622 |
|
622 |
|
623 |
sed -i -e "s:APACHE2_OPTS=\".*\":APACHE2_OPTS=\"${APACHE2_OPTS}\":" \ |
623 |
sed -i -e "s:APACHE2_OPTS=\".*\":APACHE2_OPTS=\"${APACHE2_OPTS}\":" \ |
624 |
"${GENTOO_PATCHDIR}"/init/apache2.confd || die |
624 |
"${GENTOO_PATCHDIR}"/init/apache2.confd || die |
625 |
|
625 |
|
626 |
newconfd "${GENTOO_PATCHDIR}"/init/apache2.confd apache2 |
626 |
newconfd "${GENTOO_PATCHDIR}"/init/apache2.confd apache2 |
627 |
newinitd "${GENTOO_PATCHDIR}"/init/apache2.initd apache2 |
627 |
newinitd "${GENTOO_PATCHDIR}"/init/apache2.initd apache2 |
628 |
|
628 |
|
629 |
# install apache2ctl wrapper for our init script if available |
629 |
# install apache2ctl wrapper for our init script if available |
630 |
if test -e "${GENTOO_PATCHDIR}"/scripts/apache2ctl; then |
630 |
if test -e "${GENTOO_PATCHDIR}"/scripts/apache2ctl; then |
631 |
exeinto /usr/sbin |
631 |
exeinto /usr/sbin |
632 |
doexe "${GENTOO_PATCHDIR}"/scripts/apache2ctl |
632 |
doexe "${GENTOO_PATCHDIR}"/scripts/apache2ctl |
633 |
else |
633 |
else |
634 |
dosym /etc/init.d/apache2 /usr/sbin/apache2ctl |
634 |
dosym /etc/init.d/apache2 /usr/sbin/apache2ctl |
635 |
fi |
635 |
fi |
636 |
|
636 |
|
637 |
# provide legacy symlink for apxs, bug 177697 |
637 |
# provide legacy symlink for apxs, bug 177697 |
638 |
dosym apxs /usr/sbin/apxs2 |
638 |
dosym apxs /usr/sbin/apxs2 |
639 |
|
639 |
|
640 |
# install some documentation |
640 |
# install some documentation |
641 |
dodoc ABOUT_APACHE CHANGES LAYOUT README README.platforms VERSIONING |
641 |
dodoc ABOUT_APACHE CHANGES LAYOUT README README.platforms VERSIONING |
642 |
dodoc "${GENTOO_PATCHDIR}"/docs/* |
642 |
dodoc "${GENTOO_PATCHDIR}"/docs/* |
643 |
|
643 |
|
644 |
# drop in a convenient link to the manual |
644 |
# drop in a convenient link to the manual |
645 |
if use doc ; then |
645 |
if use doc ; then |
646 |
sed -i -e "s:VERSION:${PVR}:" \ |
646 |
sed -i -e "s:VERSION:${PVR}:" \ |
647 |
"${ED}/etc/apache2/modules.d/00_apache_manual.conf" \ |
647 |
"${ED}/etc/apache2/modules.d/00_apache_manual.conf" \ |
648 |
|| die |
648 |
|| die |
649 |
docompress -x /usr/share/doc/${PF}/manual # 503640 |
649 |
docompress -x /usr/share/doc/${PF}/manual # 503640 |
650 |
else |
650 |
else |
651 |
rm -f "${ED}/etc/apache2/modules.d/00_apache_manual.conf" \ |
651 |
rm -f "${ED}/etc/apache2/modules.d/00_apache_manual.conf" \ |
652 |
|| die |
652 |
|| die |
653 |
rm -rf "${ED}/usr/share/doc/${PF}/manual" || die |
653 |
rm -rf "${ED}/usr/share/doc/${PF}/manual" || die |
654 |
fi |
654 |
fi |
655 |
|
655 |
|
656 |
# the default icons and error pages get stored in |
656 |
# the default icons and error pages get stored in |
657 |
# /usr/share/apache2/{error,icons} |
657 |
# /usr/share/apache2/{error,icons} |
658 |
dodir /usr/share/apache2 |
658 |
dodir /usr/share/apache2 |
659 |
mv -f "${ED}/var/www/localhost/error" \ |
659 |
mv -f "${ED}/var/www/localhost/error" \ |
660 |
"${ED}/usr/share/apache2/error" || die |
660 |
"${ED}/usr/share/apache2/error" || die |
661 |
mv -f "${ED}/var/www/localhost/icons" \ |
661 |
mv -f "${ED}/var/www/localhost/icons" \ |
662 |
"${ED}/usr/share/apache2/icons" || die |
662 |
"${ED}/usr/share/apache2/icons" || die |
663 |
rm -rf "${ED}/var/www/localhost/" || die |
663 |
rm -rf "${ED}/var/www/localhost/" || die |
664 |
|
664 |
|
665 |
# set some sane permissions for suexec |
665 |
# set some sane permissions for suexec |
666 |
if use suexec ; then |
666 |
if use suexec ; then |
667 |
if ! use suexec-syslog || ! use suexec-caps ; then |
667 |
if ! use suexec-syslog || ! use suexec-caps ; then |
668 |
fowners 0:${SUEXEC_CALLER:-apache} /usr/sbin/suexec |
668 |
fowners 0:${SUEXEC_CALLER:-apache} /usr/sbin/suexec |
669 |
fperms 4710 /usr/sbin/suexec |
669 |
fperms 4710 /usr/sbin/suexec |
670 |
# provide legacy symlink for suexec, bug 177697 |
670 |
# provide legacy symlink for suexec, bug 177697 |
671 |
dosym /usr/sbin/suexec /usr/sbin/suexec2 |
671 |
dosym /usr/sbin/suexec /usr/sbin/suexec2 |
672 |
fi |
672 |
fi |
673 |
fi |
673 |
fi |
674 |
|
674 |
|
675 |
# empty dirs |
675 |
# empty dirs |
676 |
local i |
676 |
local i |
677 |
for i in /var/lib/dav /var/log/apache2 ; do |
677 |
for i in /var/lib/dav /var/log/apache2 ; do |
678 |
keepdir ${i} |
678 |
keepdir ${i} |
679 |
fowners apache:apache ${i} |
679 |
fowners apache:apache ${i} |
680 |
fperms 0750 ${i} |
680 |
fperms 0750 ${i} |
681 |
done |
681 |
done |
682 |
} |
682 |
} |
683 |
|
683 |
|
684 |
# @FUNCTION: apache-2_pkg_postinst |
684 |
# @FUNCTION: apache-2_pkg_postinst |
685 |
# @DESCRIPTION: |
685 |
# @DESCRIPTION: |
686 |
# This function creates test certificates if SSL is enabled and installs the |
686 |
# This function creates test certificates if SSL is enabled and installs the |
687 |
# default index.html to /var/www/localhost if it does not exist. We do this here |
687 |
# default index.html to /var/www/localhost if it does not exist. We do this here |
688 |
# because the default webroot is a copy of the files that exist elsewhere and we |
688 |
# because the default webroot is a copy of the files that exist elsewhere and we |
689 |
# don't want them to be managed/removed by portage when apache is upgraded. |
689 |
# don't want them to be managed/removed by portage when apache is upgraded. |
690 |
apache-2_pkg_postinst() { |
690 |
apache-2_pkg_postinst() { |
691 |
if use ssl && [[ ! -e "${EROOT}/etc/ssl/apache2/server.pem" ]]; then |
691 |
if use ssl && [[ ! -e "${EROOT}/etc/ssl/apache2/server.pem" ]]; then |
692 |
SSL_ORGANIZATION="${SSL_ORGANIZATION:-Apache HTTP Server}" |
692 |
SSL_ORGANIZATION="${SSL_ORGANIZATION:-Apache HTTP Server}" |
693 |
install_cert /etc/ssl/apache2/server |
693 |
install_cert /etc/ssl/apache2/server |
694 |
ewarn |
694 |
ewarn |
695 |
ewarn "The location of SSL certificates has changed. If you are" |
695 |
ewarn "The location of SSL certificates has changed. If you are" |
696 |
ewarn "upgrading from ${CATEGORY}/${PN}-2.2.13 or earlier (or remerged" |
696 |
ewarn "upgrading from ${CATEGORY}/${PN}-2.2.13 or earlier (or remerged" |
697 |
ewarn "*any* apache version), you might want to move your old" |
697 |
ewarn "*any* apache version), you might want to move your old" |
698 |
ewarn "certificates from /etc/apache2/ssl/ to /etc/ssl/apache2/ and" |
698 |
ewarn "certificates from /etc/apache2/ssl/ to /etc/ssl/apache2/ and" |
699 |
ewarn "update your config files." |
699 |
ewarn "update your config files." |
700 |
ewarn |
700 |
ewarn |
701 |
fi |
701 |
fi |
702 |
|
702 |
|
703 |
if [[ ! -e "${EROOT}/var/www/localhost" ]] ; then |
703 |
if [[ ! -e "${EROOT}/var/www/localhost" ]] ; then |
704 |
mkdir -p "${EROOT}/var/www/localhost/htdocs" |
704 |
mkdir -p "${EROOT}/var/www/localhost/htdocs" |
705 |
echo "<html><body><h1>It works!</h1></body></html>" > "${EROOT}/var/www/localhost/htdocs/index.html" |
705 |
echo "<html><body><h1>It works!</h1></body></html>" > "${EROOT}/var/www/localhost/htdocs/index.html" |
706 |
fi |
706 |
fi |
707 |
|
707 |
|
708 |
echo |
708 |
echo |
709 |
elog "Attention: cgi and cgid modules are now handled via APACHE2_MODULES flags" |
709 |
elog "Attention: cgi and cgid modules are now handled via APACHE2_MODULES flags" |
710 |
elog "in make.conf. Make sure to enable those in order to compile them." |
710 |
elog "in make.conf. Make sure to enable those in order to compile them." |
711 |
elog "In general, you should use 'cgid' with threaded MPMs and 'cgi' otherwise." |
711 |
elog "In general, you should use 'cgid' with threaded MPMs and 'cgi' otherwise." |
712 |
echo |
712 |
echo |
713 |
|
713 |
|
714 |
} |
714 |
} |
715 |
|
715 |
|
716 |
EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_install pkg_postinst |
716 |
EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_install pkg_postinst |