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.

240 lines
8.4 KiB

  1. #
  2. # Copyright (C) 2006-2018 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:=lighttpd
  9. PKG_VERSION:=1.4.53
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  12. PKG_SOURCE_URL:=https://download.lighttpd.net/lighttpd/releases-1.4.x
  13. PKG_HASH:=3bdfce1cf3e9650a556a8c26fb15342c5717c63f530c54693db632b0371dcb78
  14. PKG_LICENSE:=BSD-3c
  15. PKG_LICENSE_FILES:=COPYING
  16. PKG_FIXUP:=autoreconf
  17. PKG_INSTALL:=1
  18. REBUILD_MODULES=authn_gssapi authn_ldap authn_mysql cml magnet mysql_vhost trigger_b4_dl webdav
  19. PKG_CONFIG_DEPENDS:=CONFIG_LIGHTTPD_SSL $(patsubst %,CONFIG_PACKAGE_lighttpd-mod-%,$(REBUILD_MODULES))
  20. include $(INCLUDE_DIR)/package.mk
  21. # iconv is required for lighttpd's mysql plugin
  22. include $(INCLUDE_DIR)/nls.mk
  23. define Package/lighttpd/Default
  24. SUBMENU:=Web Servers/Proxies
  25. SECTION:=net
  26. CATEGORY:=Network
  27. URL:=http://www.lighttpd.net/
  28. MAINTAINER:=W. Michael Petullo <mike@flyn.org>
  29. endef
  30. define Package/lighttpd
  31. $(call Package/lighttpd/Default)
  32. MENU:=1
  33. DEPENDS:=+LIGHTTPD_SSL:libopenssl +libpcre +libpthread
  34. TITLE:=A flexible and lightweight web server
  35. endef
  36. define Package/lighttpd/config
  37. config LIGHTTPD_SSL
  38. bool "SSL support"
  39. depends on PACKAGE_lighttpd
  40. default y
  41. help
  42. Implements SSL support in lighttpd (using libopenssl). This
  43. option is required if you enable the SSL engine in your
  44. lighttpd confguration file.
  45. endef
  46. BASE_MODULES:=dirlisting indexfile staticfile
  47. CONFIGURE_ARGS+= \
  48. --libdir=/usr/lib/lighttpd \
  49. --sysconfdir=/etc/lighttpd \
  50. --enable-shared \
  51. --enable-static \
  52. --disable-rpath \
  53. --without-attr \
  54. --without-bzip2 \
  55. --without-fam \
  56. --with-pcre \
  57. --without-valgrind \
  58. $(call autoconf_bool,CONFIG_IPV6,ipv6)
  59. CONFIGURE_VARS+= \
  60. PCRE_LIB="-lpcre" \
  61. ifneq ($(strip $(CONFIG_LIGHTTPD_SSL)),)
  62. CONFIGURE_ARGS+= \
  63. --with-openssl="$(STAGING_DIR)/usr"
  64. BASE_MODULES+= openssl
  65. else
  66. CONFIGURE_ARGS+= \
  67. --without-openssl
  68. endif
  69. ifneq ($(SDK)$(CONFIG_PACKAGE_lighttpd-mod-authn_gssapi),)
  70. CONFIGURE_ARGS+= --with-krb5
  71. else
  72. CONFIGURE_ARGS+= --without-krb5
  73. endif
  74. ifneq ($(SDK)$(CONFIG_PACKAGE_lighttpd-mod-authn_ldap),)
  75. CONFIGURE_ARGS+= --with-ldap
  76. else
  77. CONFIGURE_ARGS+= --without-ldap
  78. endif
  79. ifneq ($(SDK)$(CONFIG_PACKAGE_lighttpd-mod-authn_mysql)$(CONFIG_PACKAGE_lighttpd-mod-mysql_vhost),)
  80. CONFIGURE_ARGS+= --with-mysql
  81. else
  82. CONFIGURE_ARGS+= --without-mysql
  83. endif
  84. #ifneq ($(SDK)$(CONFIG_PACKAGE_lighttpd-mod-geoip),)
  85. # CONFIGURE_ARGS+= --with-geoip
  86. #else
  87. # CONFIGURE_ARGS+= --without-geoip
  88. #endif
  89. ifneq ($(SDK)$(CONFIG_PACKAGE_lighttpd-mod-cml)$(CONFIG_PACKAGE_lighttpd-mod-magnet),)
  90. CONFIGURE_ARGS+= --with-lua
  91. else
  92. CONFIGURE_ARGS+= --without-lua
  93. endif
  94. #ifneq ($(SDK)$(CONFIG_PACKAGE_lighttpd-mod-cml)$(CONFIG_PACKAGE_lighttpd-mod-trigger_b4_dl),)
  95. # CONFIGURE_ARGS+= --with-memcached
  96. #else
  97. # CONFIGURE_ARGS+= --without-memcached
  98. #endif
  99. ifneq ($(SDK)$(CONFIG_PACKAGE_lighttpd-mod-trigger_b4_dl),)
  100. CONFIGURE_ARGS+= --with-gdbm
  101. else
  102. CONFIGURE_ARGS+= --without-gdbm
  103. endif
  104. ifneq ($(SDK)$(CONFIG_PACKAGE_lighttpd-mod-webdav),)
  105. CONFIGURE_ARGS+= \
  106. --with-webdav-locks \
  107. --with-webdav-props
  108. # XXX: needed by sqlite3 to prevent segfaults in mod_webdav.so
  109. CONFIGURE_VARS+= \
  110. LIBS="-lpthread"
  111. else
  112. CONFIGURE_ARGS+= \
  113. --without-webdav-locks \
  114. --without-webdav-props
  115. endif
  116. define Build/Configure
  117. $(call Build/Configure/Default)
  118. # XXX: override pcre (mis)detection by ./configure when cross-compiling
  119. echo "#define HAVE_LIBPCRE 1" >>$(PKG_BUILD_DIR)/config.h
  120. echo "#define HAVE_PCRE_H 1" >>$(PKG_BUILD_DIR)/config.h
  121. endef
  122. define Package/lighttpd/conffiles
  123. /etc/lighttpd/lighttpd.conf
  124. endef
  125. define Package/lighttpd/install
  126. $(INSTALL_DIR) $(1)/etc/lighttpd
  127. $(INSTALL_DATA) ./files/lighttpd.conf $(1)/etc/lighttpd/
  128. $(INSTALL_DATA) $(PKG_BUILD_DIR)/doc/config/conf.d/mime.conf $(1)/etc/lighttpd/
  129. $(INSTALL_DIR) $(1)/etc/lighttpd/conf.d
  130. $(INSTALL_DIR) $(1)/etc/init.d
  131. $(INSTALL_BIN) ./files/lighttpd.init $(1)/etc/init.d/lighttpd
  132. $(INSTALL_DIR) $(1)/usr/lib/lighttpd
  133. for m in $(BASE_MODULES); do \
  134. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lighttpd/mod_$$$${m}.so $(1)/usr/lib/lighttpd/ ; \
  135. done
  136. $(INSTALL_DIR) $(1)/usr/sbin
  137. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/lighttpd $(1)/usr/sbin/
  138. endef
  139. define BuildPlugin
  140. define Package/lighttpd-mod-$(1)
  141. $(call Package/lighttpd/Default)
  142. DEPENDS:=lighttpd
  143. ifneq ($(3),)
  144. DEPENDS+= $(3)
  145. endif
  146. TITLE:=$(2) module
  147. endef
  148. ifneq ($(SDK)$(CONFIG_PACKAGE_lighttpd-mod-$(1)),)
  149. define Package/lighttpd-mod-$(1)/install
  150. $(INSTALL_DIR) $$(1)/usr/lib/lighttpd
  151. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lighttpd/mod_$(1).so $$(1)/usr/lib/lighttpd
  152. $(INSTALL_DIR) $$(1)/etc/lighttpd/conf.d
  153. if [ -f $(PKG_BUILD_DIR)/doc/config/conf.d/$(1).conf ]; then \
  154. $(CP) $(PKG_BUILD_DIR)/doc/config/conf.d/$(1).conf $$(1)/etc/lighttpd/conf.d/$(4)-$(1).conf ; \
  155. if ! grep -qF 'mod_$(1)' $$(1)/etc/lighttpd/conf.d/$(4)-$(1).conf; then \
  156. sed -i "`sed '/^##/ !q' $$(1)/etc/lighttpd/conf.d/$(4)-$(1).conf | wc -l` i\
  157. server.modules += ( \"mod_$(1)\" )" $$(1)/etc/lighttpd/conf.d/$(4)-$(1).conf ; \
  158. fi \
  159. else \
  160. echo 'server.modules += ( "mod_$(1)" )' > $$(1)/etc/lighttpd/conf.d/$(4)-$(1).conf ; \
  161. fi
  162. endef
  163. endif
  164. $$(eval $$(call BuildPackage,lighttpd-mod-$(1)))
  165. endef
  166. $(eval $(call BuildPackage,lighttpd))
  167. # First, permit redirect from HTTP to HTTPS.
  168. $(eval $(call BuildPlugin,redirect,URL redirection,+PACKAGE_lighttpd-mod-redirect:libpcre,10))
  169. # Next, permit authentication.
  170. $(eval $(call BuildPlugin,auth,Authentication,,20))
  171. $(eval $(call BuildPlugin,authn_file,File-based authentication,lighttpd-mod-auth,20))
  172. $(eval $(call BuildPlugin,authn_gssapi,Kerberos-based authentication,lighttpd-mod-auth +PACKAGE_lighttpd-mod-authn_gssapi:krb5-libs,20))
  173. $(eval $(call BuildPlugin,authn_ldap,LDAP-based authentication,lighttpd-mod-auth +PACKAGE_lighttpd-mod-authn_ldap:libopenldap,20))
  174. $(eval $(call BuildPlugin,authn_mysql,Mysql-based authentication,lighttpd-mod-auth +PACKAGE_lighttpd-mod-authn_mysql:libmysqlclient,20))
  175. # Finally, everything else.
  176. $(eval $(call BuildPlugin,access,Access restrictions,,30))
  177. $(eval $(call BuildPlugin,accesslog,Access logging,,30))
  178. $(eval $(call BuildPlugin,alias,Directory alias,,30))
  179. $(eval $(call BuildPlugin,cgi,CGI,,30))
  180. #$(eval $(call BuildPlugin,cml,Cache Meta Language,+PACKAGE_lighttpd-mod-cml:liblua +PACKAGE_lighttpd-mod-cml:libmemcached,30))
  181. $(eval $(call BuildPlugin,cml,Cache Meta Language,+PACKAGE_lighttpd-mod-cml:liblua,30))
  182. $(eval $(call BuildPlugin,compress,Compress output,+PACKAGE_lighttpd-mod-compress:zlib,30))
  183. $(eval $(call BuildPlugin,deflate,Compress dynamic output,+PACKAGE_lighttpd-mod-deflate:zlib,30))
  184. $(eval $(call BuildPlugin,evasive,Evasive,,30))
  185. $(eval $(call BuildPlugin,evhost,Enhanced Virtual-Hosting,,30))
  186. $(eval $(call BuildPlugin,expire,Expire,,30))
  187. $(eval $(call BuildPlugin,extforward,Extract client,,30))
  188. $(eval $(call BuildPlugin,fastcgi,FastCGI,,30))
  189. $(eval $(call BuildPlugin,flv_streaming,FLV streaming,,30))
  190. #$(eval $(call BuildPlugin,geoip,Geolocation,+PACKAGE_lighttpd-mod-geoip:libgeoip,30))
  191. $(eval $(call BuildPlugin,magnet,Magnet,+PACKAGE_lighttpd-mod-magnet:liblua,30))
  192. $(eval $(call BuildPlugin,mysql_vhost,Mysql virtual hosting,+PACKAGE_lighttpd-mod-mysql_vhost:libmysqlclient,30))
  193. $(eval $(call BuildPlugin,proxy,Proxy,,30))
  194. $(eval $(call BuildPlugin,rewrite,URL rewriting,+PACKAGE_lighttpd-mod-rewrite:libpcre,30))
  195. $(eval $(call BuildPlugin,rrdtool,RRDtool,,30))
  196. $(eval $(call BuildPlugin,scgi,SCGI,,30))
  197. $(eval $(call BuildPlugin,secdownload,Secure and fast download,,30))
  198. $(eval $(call BuildPlugin,setenv,Environment variable setting,,30))
  199. $(eval $(call BuildPlugin,simple_vhost,Simple virtual hosting,,30))
  200. $(eval $(call BuildPlugin,ssi,SSI,+PACKAGE_lighttpd-mod-ssi:libpcre,30))
  201. $(eval $(call BuildPlugin,status,Server status display,,30))
  202. #$(eval $(call BuildPlugin,trigger_b4_dl,Trigger before download,+PACKAGE_lighttpd-mod-trigger_b4_dl:libpcre +PACKAGE_lighttpd-mod-trigger_b4_dl:libgdbm +PACKAGE_lighttpd-mod-trigger_b4_dl:libmemcached,30))
  203. $(eval $(call BuildPlugin,trigger_b4_dl,Trigger before download,+PACKAGE_lighttpd-mod-trigger_b4_dl:libpcre +PACKAGE_lighttpd-mod-trigger_b4_dl:libgdbm,30))
  204. $(eval $(call BuildPlugin,userdir,User directory,,30))
  205. $(eval $(call BuildPlugin,usertrack,User tracking,,30))
  206. $(eval $(call BuildPlugin,webdav,WebDAV,+PACKAGE_lighttpd-mod-webdav:libsqlite3 +PACKAGE_lighttpd-mod-webdav:libuuid +PACKAGE_lighttpd-mod-webdav:libxml2,30))
  207. $(eval $(call BuildPlugin,wstunnel,Websocket tunneling,,30))