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.1 KiB

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