| b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | # |
| 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 | |
| 8 | include $(TOPDIR)/rules.mk |
| 9 | |
| 10 | PKG_NAME:=apache |
| 11 | PKG_VERSION:=2.4.52 |
| 12 | PKG_RELEASE:=1 |
| 13 | PKG_SOURCE_NAME:=httpd |
| 14 | |
| 15 | PKG_SOURCE:=$(PKG_SOURCE_NAME)-$(PKG_VERSION).tar.bz2 |
| 16 | PKG_SOURCE_URL:=@APACHE/httpd/ |
| 17 | PKG_HASH:=0127f7dc497e9983e9c51474bed75e45607f2f870a7675a86dc90af6d572f5c9 |
| 18 | |
| 19 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_NAME)-$(PKG_VERSION) |
| 20 | |
| 21 | PKG_MAINTAINER:=Thomas Heil <heil@terminal-consulting.de> |
| 22 | PKG_LICENSE:=Apache-2.0 |
| 23 | PKG_LICENSE_FILES:=LICENSE |
| 24 | |
| 25 | PKG_CPE_ID:=cpe:/a:apache:http_server |
| 26 | |
| 27 | PKG_BUILD_DEPENDS:=openssl |
| 28 | |
| 29 | PKG_BUILD_PARALLEL:=1 |
| 30 | |
| 31 | PKG_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 | |
| 44 | PKG_FIXUP:=autoreconf |
| 45 | |
| 46 | PKG_INSTALL:=1 |
| 47 | |
| 48 | include $(INCLUDE_DIR)/package.mk |
| 49 | # without nls.mk mod_xml2enc might not find the iconv headers |
| 50 | include $(INCLUDE_DIR)/nls.mk |
| 51 | |
| 52 | define 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/ |
| 58 | endef |
| 59 | |
| 60 | define Package/apache/Default/description |
| 61 | The Apache HTTP Server Project is a collaborative software development |
| 62 | effort aimed at creating a robust, commercial-grade, featureful, and |
| 63 | freely-available source code implementation of an HTTP (Web) server. |
| 64 | endef |
| 65 | |
| 66 | define Package/apache |
| 67 | $(call Package/apache/Default) |
| 68 | USERID:=apache=377:apache=377 |
| 69 | DEPENDS:=+libapr +libaprutil +libpcre |
| 70 | endef |
| 71 | |
| 72 | define Package/apache/description |
| 73 | $(call Package/apache/Default/description) |
| 74 | |
| 75 | This package contains the Apache web server and utility programs. |
| 76 | |
| 77 | endef |
| 78 | |
| 79 | define 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 |
| 96 | endef |
| 97 | |
| 98 | define Package/apache-ab |
| 99 | $(call Package/apache/Default) |
| 100 | TITLE:=Apache benchmark utility |
| 101 | DEPENDS:=apache +libopenssl |
| 102 | endef |
| 103 | |
| 104 | define Package/apache-ab/description |
| 105 | $(call Package/apache/Default/description) |
| 106 | |
| 107 | Apache server benchmarking utility. |
| 108 | |
| 109 | endef |
| 110 | |
| 111 | define Package/apache-error |
| 112 | $(call Package/apache/Default) |
| 113 | TITLE:=Error documents |
| 114 | DEPENDS:=apache |
| 115 | endef |
| 116 | |
| 117 | define Package/apache-error/description |
| 118 | $(call Package/apache/Default/description) |
| 119 | |
| 120 | Apache multi language custom error documents. |
| 121 | |
| 122 | endef |
| 123 | |
| 124 | define Package/apache-icons |
| 125 | $(call Package/apache/Default) |
| 126 | TITLE:=Icons from Apache |
| 127 | DEPENDS:=apache |
| 128 | endef |
| 129 | |
| 130 | define Package/apache-icons/description |
| 131 | $(call Package/apache/Default/description) |
| 132 | |
| 133 | This package contains the icons from Apache. |
| 134 | |
| 135 | endef |
| 136 | |
| 137 | define 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 |
| 146 | endef |
| 147 | |
| 148 | define Package/apache-suexec/description |
| 149 | $(call Package/apache/Default/description) |
| 150 | |
| 151 | This package contains the suEXEC utility from Apache. |
| 152 | |
| 153 | endef |
| 154 | |
| 155 | define Package/apache-utils |
| 156 | $(call Package/apache/Default) |
| 157 | TITLE:=Apache utilities |
| 158 | DEPENDS:=apache |
| 159 | endef |
| 160 | |
| 161 | define Package/apache-utils/description |
| 162 | $(call Package/apache/Default/description) |
| 163 | |
| 164 | Apache utility programs for webservers. |
| 165 | |
| 166 | endef |
| 167 | |
| 168 | define 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 |
| 173 | endef |
| 174 | |
| 175 | CONFIGURE_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 | |
| 208 | ifneq ($(CONFIG_PACKAGE_apache-mod-deflate),) |
| 209 | CONFIGURE_ARGS+= \ |
| 210 | --enable-deflate \ |
| 211 | --with-z="$(STAGING_DIR)/usr" |
| 212 | else |
| 213 | CONFIGURE_ARGS+= \ |
| 214 | --disable-deflate \ |
| 215 | --without-z |
| 216 | endif |
| 217 | |
| 218 | ifneq ($(CONFIG_PACKAGE_apache-mod-ldap),) |
| 219 | CONFIGURE_ARGS+= \ |
| 220 | --enable-authnz-ldap \ |
| 221 | --enable-ldap |
| 222 | else |
| 223 | CONFIGURE_ARGS+= \ |
| 224 | --disable-authnz-ldap \ |
| 225 | --disable-ldap |
| 226 | endif |
| 227 | |
| 228 | ifneq ($(CONFIG_PACKAGE_apache-mod-proxy),) |
| 229 | CONFIGURE_ARGS+= \ |
| 230 | --enable-proxy \ |
| 231 | --enable-proxy-connect \ |
| 232 | --enable-proxy-ftp \ |
| 233 | --enable-proxy-http |
| 234 | else |
| 235 | CONFIGURE_ARGS+= \ |
| 236 | --disable-proxy |
| 237 | endif |
| 238 | |
| 239 | ifneq ($(CONFIG_PACKAGE_apache-mod-proxy-html),) |
| 240 | CONFIGURE_ARGS+= \ |
| 241 | --enable-proxy-html \ |
| 242 | --enable-xml2enc \ |
| 243 | --with-libxml2="$(STAGING_DIR)/usr" |
| 244 | else |
| 245 | CONFIGURE_ARGS+= \ |
| 246 | --disable-proxy-html \ |
| 247 | --disable-xml2enc |
| 248 | endif |
| 249 | |
| 250 | ifneq ($(CONFIG_PACKAGE_apache-mod-suexec)$(CONFIG_PACKAGE_apache-suexec),) |
| 251 | CONFIGURE_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 |
| 256 | else |
| 257 | CONFIGURE_ARGS+= \ |
| 258 | --disable-suexec |
| 259 | endif |
| 260 | |
| 261 | ifneq ($(CONFIG_PACKAGE_apache-mod-webdav),) |
| 262 | CONFIGURE_ARGS+= \ |
| 263 | --enable-dav \ |
| 264 | --enable-dav-fs \ |
| 265 | --enable-dav-lock |
| 266 | else |
| 267 | CONFIGURE_ARGS+= \ |
| 268 | --disable-dav |
| 269 | endif |
| 270 | |
| 271 | CONFIGURE_VARS += \ |
| 272 | ac_cv_gettid=yes \ |
| 273 | ap_cv_void_ptr_lt_long=no |
| 274 | |
| 275 | define 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 |
| 290 | endef |
| 291 | |
| 292 | define 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 |
| 318 | endef |
| 319 | |
| 320 | define Package/apache-ab/install |
| 321 | $(INSTALL_DIR) $(1)/usr/bin |
| 322 | $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ab $(1)/usr/bin |
| 323 | endef |
| 324 | |
| 325 | define 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 |
| 329 | endef |
| 330 | |
| 331 | define 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 |
| 335 | endef |
| 336 | |
| 337 | define 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 |
| 341 | endef |
| 342 | |
| 343 | define 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 |
| 348 | endef |
| 349 | |
| 350 | define Package/apache/Module |
| 351 | define Package/apache-mod-$(1) |
| 352 | $(call Package/apache/Default) |
| 353 | TITLE:=$(2) module |
| 354 | DEPENDS:=apache $(patsubst +%,+PACKAGE_apache-mod-$(1):%,$(4)) |
| 355 | endef |
| 356 | define Package/apache-mod-$(1)/description |
| 357 | $(subst \n,$(newline),$(3)) |
| 358 | endef |
| 359 | define Package/apache-mod-$(1)/install |
| 360 | $(foreach m,$(5),$(call Package/apache/install/mod,$$(1),$(m));) |
| 361 | endef |
| 362 | $$(eval $$(call BuildPackage,apache-mod-$(1))) |
| 363 | endef |
| 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)) |