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.

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