blob: 9a6c8815854ea33c77950ef86183f7358ed36f61 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001#
2# Copyright (C) 2007-2015 OpenWrt.org
3#
4# This is free software, licensed under the GNU General Public License v2.
5# See /LICENSE for more information.
6#
7
8include $(TOPDIR)/rules.mk
9
10PKG_NAME:=apache
11PKG_VERSION:=2.4.52
12PKG_RELEASE:=1
13PKG_SOURCE_NAME:=httpd
14
15PKG_SOURCE:=$(PKG_SOURCE_NAME)-$(PKG_VERSION).tar.bz2
16PKG_SOURCE_URL:=@APACHE/httpd/
17PKG_HASH:=0127f7dc497e9983e9c51474bed75e45607f2f870a7675a86dc90af6d572f5c9
18
19PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_NAME)-$(PKG_VERSION)
20
21PKG_MAINTAINER:=Thomas Heil <heil@terminal-consulting.de>
22PKG_LICENSE:=Apache-2.0
23PKG_LICENSE_FILES:=LICENSE
24
25PKG_CPE_ID:=cpe:/a:apache:http_server
26
27PKG_BUILD_DEPENDS:=openssl
28
29PKG_BUILD_PARALLEL:=1
30
31PKG_CONFIG_DEPENDS:= \
32 CONFIG_PACKAGE_apache-mod-deflate \
33 CONFIG_PACKAGE_apache-mod-http2 \
34 CONFIG_PACKAGE_apache-mod-ldap \
35 CONFIG_PACKAGE_apache-mod-lua \
36 CONFIG_PACKAGE_apache-mod-md \
37 CONFIG_PACKAGE_apache-mod-proxy \
38 CONFIG_PACKAGE_apache-mod-proxy-html \
39 CONFIG_PACKAGE_apache-mod-session-crypto \
40 CONFIG_PACKAGE_apache-mod-suexec \
41 CONFIG_PACKAGE_apache-mod-webdav \
42 CONFIG_PACKAGE_apache-suexec
43
44PKG_FIXUP:=autoreconf
45
46PKG_INSTALL:=1
47
48include $(INCLUDE_DIR)/package.mk
49# without nls.mk mod_xml2enc might not find the iconv headers
50include $(INCLUDE_DIR)/nls.mk
51
52define Package/apache/Default
53 SECTION:=net
54 CATEGORY:=Network
55 SUBMENU:=Web Servers/Proxies
56 TITLE:=The Apache Web Server
57 URL:=https://httpd.apache.org/
58endef
59
60define Package/apache/Default/description
61The Apache HTTP Server Project is a collaborative software development
62effort aimed at creating a robust, commercial-grade, featureful, and
63freely-available source code implementation of an HTTP (Web) server.
64endef
65
66define Package/apache
67$(call Package/apache/Default)
68 USERID:=apache=377:apache=377
69 DEPENDS:=+libapr +libaprutil +libpcre
70endef
71
72define Package/apache/description
73$(call Package/apache/Default/description)
74
75This package contains the Apache web server and utility programs.
76
77endef
78
79define Package/apache/conffiles
80/etc/apache2/apache2.conf
81/etc/apache2/extra/httpd-autoindex.conf
82/etc/apache2/extra/httpd-dav.conf
83/etc/apache2/extra/httpd-default.conf
84/etc/apache2/extra/httpd-info.conf
85/etc/apache2/extra/httpd-languages.conf
86/etc/apache2/extra/httpd-manual.conf
87/etc/apache2/extra/httpd-mpm.conf
88/etc/apache2/extra/httpd-multilang-errordoc.conf
89/etc/apache2/extra/httpd-ssl.conf
90/etc/apache2/extra/httpd-userdir.conf
91/etc/apache2/extra/httpd-vhosts.conf
92/etc/apache2/extra/proxy-html.conf
93/etc/apache2/magic
94/etc/apache2/mime.types
95/etc/init.d/apache2
96endef
97
98define Package/apache-ab
99$(call Package/apache/Default)
100 TITLE:=Apache benchmark utility
101 DEPENDS:=apache +libopenssl
102endef
103
104define Package/apache-ab/description
105$(call Package/apache/Default/description)
106
107Apache server benchmarking utility.
108
109endef
110
111define Package/apache-error
112$(call Package/apache/Default)
113 TITLE:=Error documents
114 DEPENDS:=apache
115endef
116
117define Package/apache-error/description
118$(call Package/apache/Default/description)
119
120Apache multi language custom error documents.
121
122endef
123
124define Package/apache-icons
125$(call Package/apache/Default)
126 TITLE:=Icons from Apache
127 DEPENDS:=apache
128endef
129
130define Package/apache-icons/description
131$(call Package/apache/Default/description)
132
133This package contains the icons from Apache.
134
135endef
136
137define Package/apache-suexec
138$(call Package/apache/Default)
139 TITLE:=Apache suEXEC
140 DEPENDS:=apache
141 # Directory "/usr/lib/apache2/suexec_dir" is installed with mode 0750
142 # and is only accessible by root and the group apache. This way apache
143 # can access the SUID binary "suexec" contained within while others
144 # cannot.
145 FILE_MODES:=/usr/lib/apache2/suexec_dir:root:apache:0750
146endef
147
148define Package/apache-suexec/description
149$(call Package/apache/Default/description)
150
151This package contains the suEXEC utility from Apache.
152
153endef
154
155define Package/apache-utils
156$(call Package/apache/Default)
157 TITLE:=Apache utilities
158 DEPENDS:=apache
159endef
160
161define Package/apache-utils/description
162$(call Package/apache/Default/description)
163
164Apache utility programs for webservers.
165
166endef
167
168define Package/apache/install/mod
169 $(INSTALL_DIR) $(1)/usr/lib/apache2
170 $(INSTALL_BIN) \
171 $(PKG_INSTALL_DIR)/usr/lib/apache2/mod_$(2).so \
172 $(1)/usr/lib/apache2
173endef
174
175CONFIGURE_ARGS+= \
176 --$(if $(CONFIG_PACKAGE_apache-mod-http2),en,dis)able-http2 \
177 --$(if $(CONFIG_PACKAGE_apache-mod-lua),en,dis)able-lua \
178 --$(if $(CONFIG_PACKAGE_apache-mod-md),en,dis)able-md \
179 --$(if $(CONFIG_PACKAGE_apache-mod-proxy),en,dis)able-proxy \
180 --$(if $(CONFIG_PACKAGE_apache-mod-session-crypto),en,dis)able-session-crypto \
181 --$(if $(CONFIG_PACKAGE_apache-mod-ssl),en,dis)able-ssl \
182 --datadir=/usr/share/apache2 \
183 --disable-imagemap \
184 --disable-luajit \
185 --enable-authn-alias \
186 --enable-authn-anon \
187 --enable-cache \
188 --enable-cgi \
189 --enable-cgid \
190 --enable-dbd \
191 --enable-disk-cache \
192 --enable-exception-hook \
193 --enable-file-cache \
194 --enable-layout=OpenWrt \
195 --enable-mem-cache \
196 --enable-mods-shared=all \
197 --enable-mpms-shared=all \
198 --enable-so \
199 --libexecdir=/usr/lib/apache2 \
200 --sysconfdir=/etc/apache2 \
201 --with-apr-util="$(STAGING_DIR)/usr/bin/apu-1-config" \
202 --with-apr="$(STAGING_DIR)/usr/bin/apr-1-config" \
203 --with-mpm=prefork \
204 --with-pcre="$(STAGING_DIR)/usr/bin/pcre-config" \
205 --with-program-name=apache2 \
206 --with-ssl
207
208ifneq ($(CONFIG_PACKAGE_apache-mod-deflate),)
209CONFIGURE_ARGS+= \
210 --enable-deflate \
211 --with-z="$(STAGING_DIR)/usr"
212else
213CONFIGURE_ARGS+= \
214 --disable-deflate \
215 --without-z
216endif
217
218ifneq ($(CONFIG_PACKAGE_apache-mod-ldap),)
219CONFIGURE_ARGS+= \
220 --enable-authnz-ldap \
221 --enable-ldap
222else
223CONFIGURE_ARGS+= \
224 --disable-authnz-ldap \
225 --disable-ldap
226endif
227
228ifneq ($(CONFIG_PACKAGE_apache-mod-proxy),)
229CONFIGURE_ARGS+= \
230 --enable-proxy \
231 --enable-proxy-connect \
232 --enable-proxy-ftp \
233 --enable-proxy-http
234else
235CONFIGURE_ARGS+= \
236 --disable-proxy
237endif
238
239ifneq ($(CONFIG_PACKAGE_apache-mod-proxy-html),)
240CONFIGURE_ARGS+= \
241 --enable-proxy-html \
242 --enable-xml2enc \
243 --with-libxml2="$(STAGING_DIR)/usr"
244else
245CONFIGURE_ARGS+= \
246 --disable-proxy-html \
247 --disable-xml2enc
248endif
249
250ifneq ($(CONFIG_PACKAGE_apache-mod-suexec)$(CONFIG_PACKAGE_apache-suexec),)
251CONFIGURE_ARGS+= \
252 --enable-suexec \
253 --with-suexec-bin=/usr/lib/apache2/suexec_dir/suexec \
254 --with-suexec-caller=apache \
255 --with-suexec-logfile=/var/log/apache2/suexec.log
256else
257CONFIGURE_ARGS+= \
258 --disable-suexec
259endif
260
261ifneq ($(CONFIG_PACKAGE_apache-mod-webdav),)
262CONFIGURE_ARGS+= \
263 --enable-dav \
264 --enable-dav-fs \
265 --enable-dav-lock
266else
267CONFIGURE_ARGS+= \
268 --disable-dav
269endif
270
271CONFIGURE_VARS += \
272 ac_cv_gettid=yes \
273 ap_cv_void_ptr_lt_long=no
274
275define Build/InstallDev
276 $(INSTALL_DIR) $(1)/usr/bin
277 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/apxs $(1)/usr/bin
278 $(INSTALL_DIR) $(1)/usr/include/apache2
279 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/apache2/* \
280 $(1)/usr/include/apache2
281 $(INSTALL_DIR) $(1)/usr/lib/apache2
282 $(INSTALL_DIR) $(1)/usr/share/apache2/build
283 $(CP) $(PKG_INSTALL_DIR)/usr/share/apache2/build/* \
284 $(1)/usr/share/apache2/build
285 $(SED) 's%"/usr/bin"%"$(STAGING_DIR)/usr/bin"%' $(1)/usr/bin/apxs
286 $(SED) 's%/usr/share/apache2/build%$(STAGING_DIR)/usr/share/apache2/build%' \
287 $(1)/usr/bin/apxs
288 $(SED) 's%^prefix =.*%prefix = $(STAGING_DIR)/usr%' \
289 $(1)/usr/share/apache2/build/config_vars.mk
290endef
291
292define Package/apache/install
293 $(INSTALL_DIR) $(1)/etc/apache2/extra
294 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/apache2/extra/* \
295 $(1)/etc/apache2/extra
296 $(SED) '/^LoadModule session_crypto_module/s/^/#/' \
297 $(PKG_INSTALL_DIR)/etc/apache2/apache2.conf
298 $(INSTALL_DATA) \
299 $(PKG_INSTALL_DIR)/etc/apache2/{apache2.conf,magic,mime.types} \
300 $(1)/etc/apache2
301 $(INSTALL_DIR) $(1)/etc/init.d
302 $(INSTALL_BIN) ./files/apache2.init $(1)/etc/init.d/apache2
303 $(INSTALL_DIR) $(1)/usr/lib/apache2
304 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/apache2/*.so \
305 $(1)/usr/lib/apache2
306 rm -f $(1)/usr/lib/apache2/mod_{*ldap,dav*,deflate,http2,lbmethod_*,lua,md,proxy*,proxy_html,session_crypto,ssl,suexec,xml2enc}.so
307 $(INSTALL_DIR) $(1)/usr/share/apache2/{cgi-bin,htdocs}
308 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/apache2/cgi-bin/* \
309 $(1)/usr/share/apache2/cgi-bin
310 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/apache2/htdocs/* \
311 $(1)/usr/share/apache2/htdocs
312 $(INSTALL_DIR) $(1)/usr/{,s}bin
313 $(INSTALL_BIN) \
314 $(PKG_INSTALL_DIR)/usr/bin/{dbmmanage,htdbm,htdigest,htpasswd,httxt2dbm,logresolve} \
315 $(1)/usr/bin
316 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{apachectl,apache2} \
317 $(1)/usr/sbin
318endef
319
320define Package/apache-ab/install
321 $(INSTALL_DIR) $(1)/usr/bin
322 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ab $(1)/usr/bin
323endef
324
325define Package/apache-error/install
326 $(INSTALL_DIR) $(1)/usr/share/apache2/error
327 $(CP) $(PKG_INSTALL_DIR)/usr/share/apache2/error/* \
328 $(1)/usr/share/apache2/error
329endef
330
331define Package/apache-icons/install
332 $(INSTALL_DIR) $(1)/usr/share/apache2
333 $(CP) $(PKG_INSTALL_DIR)/usr/share/apache2/icons \
334 $(1)/usr/share/apache2
335endef
336
337define Package/apache-suexec/install
338 $(INSTALL_DIR) $(1)/usr/lib/apache2/suexec_dir
339 $(INSTALL_SUID) $(PKG_INSTALL_DIR)/usr/sbin/suexec \
340 $(1)/usr/lib/apache2/suexec_dir
341endef
342
343define Package/apache-utils/install
344 $(INSTALL_DIR) $(1)/usr/sbin
345 $(INSTALL_BIN) \
346 $(PKG_INSTALL_DIR)/usr/sbin/{checkgid,envvars*,htcacheclean,rotatelogs} \
347 $(1)/usr/sbin
348endef
349
350define Package/apache/Module
351define Package/apache-mod-$(1)
352$(call Package/apache/Default)
353 TITLE:=$(2) module
354 DEPENDS:=apache $(patsubst +%,+PACKAGE_apache-mod-$(1):%,$(4))
355endef
356define Package/apache-mod-$(1)/description
357$(subst \n,$(newline),$(3))
358endef
359define Package/apache-mod-$(1)/install
360$(foreach m,$(5),$(call Package/apache/install/mod,$$(1),$(m));)
361endef
362$$(eval $$(call BuildPackage,apache-mod-$(1)))
363endef
364
365$(eval $(call BuildPackage,apache))
366$(eval $(call BuildPackage,apache-ab))
367$(eval $(call BuildPackage,apache-error))
368$(eval $(call BuildPackage,apache-icons))
369$(eval $(call BuildPackage,apache-suexec))
370$(eval $(call BuildPackage,apache-utils))
371$(eval $(call Package/apache/Module,deflate,Deflate,Deflate support for the Apache HTTP server.,+zlib,deflate))
372$(eval $(call Package/apache/Module,http2,HTTP2,HTTP/2 transport layer for the Apache HTTP Server.,+libnghttp2 +libopenssl,http2))
373$(eval $(call Package/apache/Module,ldap,LDAP,LDAP authentication/authorization module for the Apache HTTP Server.,+libaprutil-ldap,authnz_ldap ldap))
374$(eval $(call Package/apache/Module,lua,Lua,Lua support for the Apache HTTP server.,+liblua,lua))
375$(eval $(call Package/apache/Module,md,Managed Domain handling,Managed Domain handling.,+libcurl +jansson +libopenssl,md))
376$(eval $(call Package/apache/Module,proxy,Proxy,Proxy modules for the Apache HTTP Server.,,proxy proxy_ajp proxy_balancer proxy_connect proxy_express proxy_fcgi proxy_fdpass proxy_ftp proxy_hcheck proxy_http proxy_scgi proxy_uwsgi proxy_wstunnel lbmethod_byrequests lbmethod_heartbeat lbmethod_bytraffic lbmethod_bybusyness))
377$(eval $(call Package/apache/Module,proxy-html,Proxy HTML,HTML and XML content filters for the Apache HTTP Server.,+apache-mod-proxy +libxml2,proxy_html xml2enc))
378$(eval $(call Package/apache/Module,session-crypto,Session crypto,Session encryption support for the Apache HTTP Server.,+libaprutil-crypto-openssl,session_crypto))
379$(eval $(call Package/apache/Module,ssl,SSL/TLS,SSL/TLS module for the Apache HTTP Server.,+libopenssl,ssl))
380$(eval $(call Package/apache/Module,suexec,suEXEC,suEXEC module for the Apache HTTP Server.,+apache-suexec,suexec))
381$(eval $(call Package/apache/Module,webdav,WebDAV,WebDAV support for the Apache HTTP Server.,,dav dav_fs dav_lock))