You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

390 lines
12 KiB

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