xref: /OK3568_Linux_fs/buildroot/package/apache/apache.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1################################################################################
2#
3# apache
4#
5################################################################################
6
7APACHE_VERSION = 2.4.51
8APACHE_SOURCE = httpd-$(APACHE_VERSION).tar.bz2
9APACHE_SITE = https://downloads.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 = apr apr-util pcre
21
22ifeq ($(BR2_PER_PACKAGE_DIRECTORIES),y)
23define APACHE_FIXUP_APR_LIBTOOL
24	$(SED) "s@$(PER_PACKAGE_DIR)/[^/]\+/@$(PER_PACKAGE_DIR)/apache/@g" \
25		$(STAGING_DIR)/usr/build-1/libtool
26endef
27APACHE_POST_PREPARE_HOOKS += APACHE_FIXUP_APR_LIBTOOL
28endif
29
30APACHE_CONF_ENV= \
31	ap_cv_void_ptr_lt_long=no \
32	PCRE_CONFIG=$(STAGING_DIR)/usr/bin/pcre-config
33
34ifeq ($(BR2_PACKAGE_APACHE_MPM_EVENT),y)
35APACHE_MPM = event
36else ifeq ($(BR2_PACKAGE_APACHE_MPM_PREFORK),y)
37APACHE_MPM = prefork
38else ifeq ($(BR2_PACKAGE_APACHE_MPM_WORKER),y)
39APACHE_MPM = worker
40endif
41
42APACHE_CONF_OPTS = \
43	--sysconfdir=/etc/apache2 \
44	--with-apr=$(STAGING_DIR)/usr \
45	--with-apr-util=$(STAGING_DIR)/usr \
46	--with-pcre=$(STAGING_DIR)/usr/bin/pcre-config \
47	--enable-http \
48	--enable-dbd \
49	--enable-proxy \
50	--enable-mime-magic \
51	--without-suexec-bin \
52	--enable-mods-shared=all \
53	--with-mpm=$(APACHE_MPM) \
54	--disable-luajit
55
56ifeq ($(BR2_PACKAGE_LIBXML2),y)
57APACHE_DEPENDENCIES += libxml2
58# Apache wants the path to the header file, where it can find
59# <libxml/parser.h>.
60APACHE_CONF_OPTS += \
61	--enable-xml2enc \
62	--enable-proxy-html \
63	--with-libxml2=$(STAGING_DIR)/usr/include/libxml2
64else
65APACHE_CONF_OPTS += \
66	--disable-xml2enc \
67	--disable-proxy-html
68endif
69
70ifeq ($(BR2_PACKAGE_LUA),y)
71APACHE_CONF_OPTS += --enable-lua
72APACHE_DEPENDENCIES += lua
73else
74APACHE_CONF_OPTS += --disable-lua
75endif
76
77ifeq ($(BR2_PACKAGE_NGHTTP2),y)
78APACHE_CONF_OPTS += \
79	--enable-http2 \
80	--with-nghttp2=$(STAGING_DIR)/usr
81APACHE_DEPENDENCIES += nghttp2
82else
83APACHE_CONF_OPTS += --disable-http2
84endif
85
86ifeq ($(BR2_PACKAGE_OPENSSL),y)
87APACHE_DEPENDENCIES += openssl
88APACHE_CONF_OPTS += \
89	--enable-ssl \
90	--with-ssl=$(STAGING_DIR)/usr
91else
92APACHE_CONF_OPTS += --disable-ssl
93endif
94
95ifeq ($(BR2_PACKAGE_ZLIB),y)
96APACHE_DEPENDENCIES += zlib
97APACHE_CONF_OPTS += \
98	--enable-deflate \
99	--with-z=$(STAGING_DIR)/usr
100else
101APACHE_CONF_OPTS += --disable-deflate
102endif
103
104define APACHE_FIX_STAGING_APACHE_CONFIG
105	$(SED) 's%"/usr/bin"%"$(STAGING_DIR)/usr/bin"%' $(STAGING_DIR)/usr/bin/apxs
106	$(SED) 's%/usr/build%$(STAGING_DIR)/usr/build%' $(STAGING_DIR)/usr/bin/apxs
107	$(SED) 's%^prefix =.*%prefix = $(STAGING_DIR)/usr%' $(STAGING_DIR)/usr/build/config_vars.mk
108endef
109APACHE_POST_INSTALL_STAGING_HOOKS += APACHE_FIX_STAGING_APACHE_CONFIG
110
111define APACHE_CLEANUP_TARGET
112	$(RM) -rf $(TARGET_DIR)/usr/manual $(TARGET_DIR)/usr/build
113endef
114APACHE_POST_INSTALL_TARGET_HOOKS += APACHE_CLEANUP_TARGET
115
116define APACHE_INSTALL_INIT_SYSV
117	$(INSTALL) -D -m 0755 package/apache/S50apache \
118		$(TARGET_DIR)/etc/init.d/S50apache
119endef
120
121define APACHE_INSTALL_INIT_SYSTEMD
122	$(INSTALL) -D -m 644 package/apache/apache.service \
123		$(TARGET_DIR)/usr/lib/systemd/system/apache.service
124endef
125
126$(eval $(autotools-package))
127