1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 # latest gentoo apache files
7 GENTOO_PATCHSTAMP="20180529"
8 GENTOO_DEVELOPER="polynomial-c"
9 GENTOO_PATCHNAME="gentoo-apache-2.4.33-r1"
11 # IUSE/USE_EXPAND magic
12 IUSE_MPMS_FORK="prefork"
13 IUSE_MPMS_THREAD="event worker"
15 # << obsolete modules:
16 # authn_default authz_default mem_cache
17 # mem_cache is replaced by cache_disk
19 # proxy_scgi: startup error: undefined symbol "ap_proxy_release_connection", no fix found
20 # >> added modules for reason:
21 # compat: compatibility with 2.2 access control
22 # authz_host: new module for access control
23 # authn_core: functionality provided by authn_alias in previous versions
24 # authz_core: new module, provides core authorization capabilities
25 # cache_disk: replacement for mem_cache
26 # lbmethod_byrequests: Split off from mod_proxy_balancer in 2.3
27 # lbmethod_bytraffic: Split off from mod_proxy_balancer in 2.3
28 # lbmethod_bybusyness: Split off from mod_proxy_balancer in 2.3
29 # lbmethod_heartbeat: Split off from mod_proxy_balancer in 2.3
30 # slotmem_shm: Slot-based shared memory provider (for lbmethod_byrequests).
31 # socache_shmcb: shared object cache provider. Default config with ssl needs it
32 # unixd: fixes startup error: Invalid command 'User'
33 IUSE_MODULES="access_compat actions alias asis auth_basic auth_digest
34 authn_alias authn_anon authn_core authn_dbd authn_dbm authn_file authz_core
35 authz_dbd authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex
36 brotli cache cache_disk cache_socache cern_meta charset_lite cgi cgid dav dav_fs dav_lock
37 dbd deflate dir dumpio env expires ext_filter file_cache filter headers http2
38 ident imagemap include info lbmethod_byrequests lbmethod_bytraffic lbmethod_bybusyness
39 lbmethod_heartbeat log_config log_forensic logio macro md mime mime_magic negotiation
40 proxy proxy_ajp proxy_balancer proxy_connect proxy_ftp proxy_html proxy_http proxy_scgi
41 proxy_fcgi proxy_wstunnel rewrite ratelimit remoteip reqtimeout setenvif
42 slotmem_shm speling socache_shmcb status substitute unique_id userdir usertrack
43 unixd version vhost_alias watchdog xml2enc"
44 # The following are also in the source as of this version, but are not available
46 # bucketeer case_filter case_filter_in echo http isapi optional_fn_export
47 # optional_fn_import optional_hook_export optional_hook_import
49 # inter-module dependencies
50 # TODO: this may still be incomplete
59 lbmethod_byrequests:proxy_balancer
60 lbmethod_byrequests:slotmem_shm
61 lbmethod_bytraffic:proxy_balancer
62 lbmethod_bybusyness:proxy_balancer
63 lbmethod_heartbeat:proxy_balancer
64 log_forensic:log_config
72 proxy_balancer:slotmem_shm
84 # module<->define mappings
86 auth_digest:AUTH_DIGEST
87 authnz_ldap:AUTHNZ_LDAP
116 # critical modules for the default config
125 inherit eutils apache-2 systemd toolchain-funcs
127 DESCRIPTION="The Apache Web Server"
128 HOMEPAGE="https://httpd.apache.org/"
130 # some helper scripts are Apache-1.1, thus both are here
131 LICENSE="Apache-2.0 Apache-1.1"
133 KEYWORDS="alpha amd64 arm ~arm64 ~hppa ia64 ~mips ~ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x64-macos ~x86-macos ~m68k-mint ~sparc64-solaris ~x64-solaris"
134 # Enable http2 by default (bug #563452)
135 # FIXME: Move to apache-2.eclass once this has reached stable.
136 IUSE="${IUSE/apache2_modules_http2/+apache2_modules_http2}"
138 CDEPEND="apache2_modules_brotli? ( >=app-arch/brotli-0.6.0:= )
139 apache2_modules_http2? ( >=net-libs/nghttp2-1.2.1 )
140 apache2_modules_md? ( >=dev-libs/jansson-2.10 )"
143 RDEPEND+="${CDEPEND}"
145 REQUIRED_USE="apache2_modules_http2? ( ssl )
146 apache2_modules_md? ( ssl )"
149 # this *should* be included from upstream in the next release as it is currently in Git head
150 "${FILESDIR}/${P}-libressl-compatibility.patch"
154 # dependend critical modules which are not allowed in global scope due
155 # to USE flag conditionals (bug #499260)
156 use ssl && MODULE_CRITICAL+=" socache_shmcb"
157 use doc && MODULE_CRITICAL+=" alias negotiation setenvif"
163 tc-is-cross-compiler && export ap_cv_void_ptr_lt_long="no"
165 apache-2_src_configure
169 if tc-is-cross-compiler; then
170 # This header is the same across targets, so use the build compiler.
171 pushd server >/dev/null
173 tc-export_build_env BUILD_CC
174 ${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_CPPFLAGS} ${BUILD_LDFLAGS} \
175 gen_test_char.c -o gen_test_char $(apr-1-config --includes) || die
185 for i in /usr/bin/{htdigest,logresolve,htpasswd,htdbm,ab,httxt2dbm}; do
186 rm "${ED%/}"/$i || die "Failed to prune apache-tools bits"
188 for i in /usr/share/man/man8/{rotatelogs.8,htcacheclean.8}; do
189 rm "${ED%/}"/$i || die "Failed to prune apache-tools bits"
191 for i in /usr/share/man/man1/{logresolve.1,htdbm.1,htdigest.1,htpasswd.1,dbmmanage.1,ab.1}; do
192 rm "${ED%/}"/$i || die "Failed to prune apache-tools bits"
194 for i in /usr/sbin/{checkgid,fcgistarter,htcacheclean,rotatelogs}; do
195 rm "${ED%/}/"$i || die "Failed to prune apache-tools bits"
198 # install apxs in /usr/bin (bug #502384) and put a symlink into the
199 # old location until all ebuilds and eclasses have been modified to
200 # use the new location.
202 dosym ../bin/apxs /usr/sbin/apxs
204 # Note: wait for mod_systemd to be included in some forthcoming release,
205 # Then apache2.4.service can be used and systemd support controlled
206 # through --enable-systemd
207 systemd_newunit "${FILESDIR}/apache2.2-hardened.service" "apache2.service"
208 systemd_dotmpfilesd "${FILESDIR}/apache.conf"
209 #insinto /etc/apache2/modules.d
210 #doins "${FILESDIR}/00_systemd.conf"
212 # Install http2 module config
213 insinto /etc/apache2/modules.d
214 doins "${FILESDIR}"/41_mod_http2.conf
216 # Fix path to apache libdir
217 sed "s|@LIBDIR@|$(get_libdir)|" -i "${ED%/}"/usr/sbin/apache2ctl || die
221 apache-2_pkg_postinst || die "apache-2_pkg_postinst failed"
222 # warnings that default config might not work out of the box
223 for mod in $MODULE_CRITICAL; do
224 if ! use "apache2_modules_${mod}"; then
226 ewarn "Warning: Critical module not installed!"
227 ewarn "Modules 'authn_core', 'authz_core' and 'unixd'"
228 ewarn "are highly recomended but might not be in the base profile yet."
229 ewarn "Default config for ssl needs module 'socache_shmcb'."
230 ewarn "Enabling the following flags is highly recommended:"
231 for cmod in $MODULE_CRITICAL; do
232 use "apache2_modules_${cmod}" || \
233 ewarn "+ apache2_modules_${cmod}"
239 # warning for proxy_balancer and missing load balancing scheduler
240 if use apache2_modules_proxy_balancer; then
242 for mod in lbmethod_byrequests lbmethod_bytraffic lbmethod_bybusyness lbmethod_heartbeat; do
243 if use "apache2_modules_${mod}"; then
247 if [ ! ${lbset} ] ; then
249 ewarn "Info: Missing load balancing scheduler algorithm module"
250 ewarn "(They were split off from proxy_balancer in 2.3)"
251 ewarn "In order to get the ability of load balancing, at least"
252 ewarn "one of these modules has to be present:"
253 ewarn "lbmethod_byrequests lbmethod_bytraffic lbmethod_bybusyness lbmethod_heartbeat"