1################################################################################
2#
3# apache
4#
5################################################################################
6
7APACHE_VERSION = 2.4.59
8APACHE_SOURCE = httpd-$(APACHE_VERSION).tar.bz2
9APACHE_SITE = https://dlcdn.apache.org/httpd
10APACHE_LICENSE = Apache-2.0
11APACHE_LICENSE_FILES = LICENSE
12APACHE_CPE_ID_VENDOR = apache
13APACHE_CPE_ID_PRODUCT = http_server
14APACHE_SELINUX_MODULES = apache
15# Needed for mod_php
16APACHE_INSTALL_STAGING = YES
17# We have a patch touching configure.in and Makefile.in,
18# so we need to autoreconf:
19APACHE_AUTORECONF = YES
20APACHE_DEPENDENCIES = host-pkgconf apr apr-util pcre2
21
22APACHE_CONF_ENV= \
23	ap_cv_void_ptr_lt_long=no \
24	PCRE_CONFIG=$(STAGING_DIR)/usr/bin/pcre2-config
25
26ifeq ($(BR2_PACKAGE_APACHE_MPM_EVENT),y)
27APACHE_MPM = event
28else ifeq ($(BR2_PACKAGE_APACHE_MPM_PREFORK),y)
29APACHE_MPM = prefork
30else ifeq ($(BR2_PACKAGE_APACHE_MPM_WORKER),y)
31APACHE_MPM = worker
32endif
33
34APACHE_CONF_OPTS = \
35	--sysconfdir=/etc/apache2 \
36	--with-apr=$(STAGING_DIR)/usr \
37	--with-apr-util=$(STAGING_DIR)/usr \
38	--with-pcre=$(STAGING_DIR)/usr/bin/pcre2-config \
39	--enable-http \
40	--enable-dbd \
41	--enable-proxy \
42	--enable-mime-magic \
43	--without-suexec-bin \
44	--enable-mods-shared=all \
45	--with-mpm=$(APACHE_MPM) \
46	--disable-luajit
47
48ifeq ($(BR2_PACKAGE_BROTLI),y)
49APACHE_CONF_OPTS += --enable-brotli
50APACHE_DEPENDENCIES += brotli
51else
52APACHE_CONF_OPTS += --disable-brotli
53endif
54
55ifeq ($(BR2_PACKAGE_LIBXML2),y)
56APACHE_DEPENDENCIES += libxml2
57# Apache wants the path to the header file, where it can find
58# <libxml/parser.h>.
59APACHE_CONF_OPTS += \
60	--enable-xml2enc \
61	--enable-proxy-html \
62	--with-libxml2=$(STAGING_DIR)/usr/include/libxml2
63else
64APACHE_CONF_OPTS += \
65	--disable-xml2enc \
66	--disable-proxy-html
67endif
68
69ifeq ($(BR2_PACKAGE_LUA),y)
70APACHE_CONF_OPTS += --enable-lua
71APACHE_DEPENDENCIES += lua
72else
73APACHE_CONF_OPTS += --disable-lua
74endif
75
76ifeq ($(BR2_PACKAGE_NGHTTP2),y)
77APACHE_CONF_OPTS += \
78	--enable-http2 \
79	--with-nghttp2=$(STAGING_DIR)/usr
80APACHE_DEPENDENCIES += nghttp2
81else
82APACHE_CONF_OPTS += --disable-http2
83endif
84
85ifeq ($(BR2_PACKAGE_OPENSSL),y)
86APACHE_DEPENDENCIES += openssl
87APACHE_CONF_OPTS += \
88	--enable-ssl \
89	--with-ssl=$(STAGING_DIR)/usr
90else
91APACHE_CONF_OPTS += --disable-ssl
92endif
93
94ifeq ($(BR2_PACKAGE_ZLIB),y)
95APACHE_DEPENDENCIES += zlib
96APACHE_CONF_OPTS += \
97	--enable-deflate \
98	--with-z=$(STAGING_DIR)/usr
99else
100APACHE_CONF_OPTS += --disable-deflate
101endif
102
103define APACHE_FIX_STAGING_APACHE_CONFIG
104	$(SED) 's%"/usr/bin"%"$(STAGING_DIR)/usr/bin"%' $(STAGING_DIR)/usr/bin/apxs
105	$(SED) 's%/usr/build%$(STAGING_DIR)/usr/build%' $(STAGING_DIR)/usr/bin/apxs
106	$(SED) 's%^prefix =.*%prefix = $(STAGING_DIR)/usr%' $(STAGING_DIR)/usr/build/config_vars.mk
107endef
108APACHE_POST_INSTALL_STAGING_HOOKS += APACHE_FIX_STAGING_APACHE_CONFIG
109
110define APACHE_CLEANUP_TARGET
111	$(RM) -rf $(TARGET_DIR)/usr/manual $(TARGET_DIR)/usr/build
112endef
113APACHE_POST_INSTALL_TARGET_HOOKS += APACHE_CLEANUP_TARGET
114
115define APACHE_INSTALL_INIT_SYSV
116	$(INSTALL) -D -m 0755 package/apache/S50apache \
117		$(TARGET_DIR)/etc/init.d/S50apache
118endef
119
120define APACHE_INSTALL_INIT_SYSTEMD
121	$(INSTALL) -D -m 644 package/apache/apache.service \
122		$(TARGET_DIR)/usr/lib/systemd/system/apache.service
123endef
124
125$(eval $(autotools-package))
126