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.

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