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.

254 lines
8.8 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.55
  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:=6a0b50e9c9d5cc3d9e48592315c25a2d645858f863e1ccd120507a30ce21e927
  14. PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org>
  15. PKG_LICENSE:=BSD-3-Clause
  16. PKG_LICENSE_FILES:=COPYING
  17. PKG_CPE_ID:=cpe:/a:lighttpd:lighttpd
  18. PKG_FIXUP:=autoreconf
  19. PKG_INSTALL:=1
  20. REBUILD_MODULES=authn_gssapi authn_ldap authn_mysql cml magnet mysql_vhost trigger_b4_dl webdav
  21. PKG_CONFIG_DEPENDS:=CONFIG_LIGHTTPD_SSL $(patsubst %,CONFIG_PACKAGE_lighttpd-mod-%,$(REBUILD_MODULES))
  22. include $(INCLUDE_DIR)/package.mk
  23. # iconv is required for lighttpd's mysql plugin
  24. include $(INCLUDE_DIR)/nls.mk
  25. define Package/lighttpd/Default
  26. SECTION:=net
  27. CATEGORY:=Network
  28. SUBMENU:=Web Servers/Proxies
  29. URL:=https://www.lighttpd.net/
  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. ifneq ($(SDK)$(CONFIG_PACKAGE_lighttpd-mod-authn_pam),)
  118. CONFIGURE_ARGS+= \
  119. --with-pam
  120. else
  121. CONFIGURE_ARGS+= \
  122. --without-pam
  123. endif
  124. define Build/Configure
  125. $(call Build/Configure/Default)
  126. # XXX: override pcre (mis)detection by ./configure when cross-compiling
  127. echo "#define HAVE_LIBPCRE 1" >>$(PKG_BUILD_DIR)/config.h
  128. echo "#define HAVE_PCRE_H 1" >>$(PKG_BUILD_DIR)/config.h
  129. endef
  130. define Package/lighttpd/conffiles
  131. /etc/lighttpd/lighttpd.conf
  132. endef
  133. define Package/lighttpd/install
  134. $(INSTALL_DIR) $(1)/etc/lighttpd
  135. $(INSTALL_DATA) ./files/lighttpd.conf $(1)/etc/lighttpd/
  136. $(INSTALL_DATA) $(PKG_BUILD_DIR)/doc/config/conf.d/mime.conf $(1)/etc/lighttpd/
  137. $(INSTALL_DIR) $(1)/etc/lighttpd/conf.d
  138. $(INSTALL_DIR) $(1)/etc/init.d
  139. $(INSTALL_BIN) ./files/lighttpd.init $(1)/etc/init.d/lighttpd
  140. $(INSTALL_DIR) $(1)/usr/lib/lighttpd
  141. for m in $(BASE_MODULES); do \
  142. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lighttpd/mod_$$$${m}.so $(1)/usr/lib/lighttpd/ ; \
  143. done
  144. $(INSTALL_DIR) $(1)/usr/sbin
  145. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/lighttpd $(1)/usr/sbin/
  146. endef
  147. define BuildPlugin
  148. define Package/lighttpd-mod-$(1)
  149. $(call Package/lighttpd/Default)
  150. DEPENDS:=lighttpd
  151. ifneq ($(3),)
  152. DEPENDS+= $(3)
  153. endif
  154. TITLE:=$(2) module
  155. endef
  156. define Package/lighttpd-mod-$(1)/conffiles
  157. /etc/lighttpd/conf.d/$(4)-$(1).conf
  158. endef
  159. ifneq ($(SDK)$(CONFIG_PACKAGE_lighttpd-mod-$(1)),)
  160. define Package/lighttpd-mod-$(1)/install
  161. $(INSTALL_DIR) $$(1)/usr/lib/lighttpd
  162. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lighttpd/mod_$(1).so $$(1)/usr/lib/lighttpd
  163. $(INSTALL_DIR) $$(1)/etc/lighttpd/conf.d
  164. if [ -f $(PKG_BUILD_DIR)/doc/config/conf.d/$(1).conf ]; then \
  165. $(CP) $(PKG_BUILD_DIR)/doc/config/conf.d/$(1).conf $$(1)/etc/lighttpd/conf.d/$(4)-$(1).conf ; \
  166. if ! grep -qF 'mod_$(1)' $$(1)/etc/lighttpd/conf.d/$(4)-$(1).conf; then \
  167. sed -i "`sed '/^##/ !q' $$(1)/etc/lighttpd/conf.d/$(4)-$(1).conf | wc -l` i\
  168. server.modules += ( \"mod_$(1)\" )" $$(1)/etc/lighttpd/conf.d/$(4)-$(1).conf ; \
  169. fi \
  170. else \
  171. echo 'server.modules += ( "mod_$(1)" )' > $$(1)/etc/lighttpd/conf.d/$(4)-$(1).conf ; \
  172. fi
  173. endef
  174. endif
  175. $$(eval $$(call BuildPackage,lighttpd-mod-$(1)))
  176. endef
  177. $(eval $(call BuildPackage,lighttpd))
  178. # First, permit redirect from HTTP to HTTPS.
  179. $(eval $(call BuildPlugin,redirect,URL redirection,+PACKAGE_lighttpd-mod-redirect:libpcre,10))
  180. # Next, permit authentication.
  181. $(eval $(call BuildPlugin,auth,Authentication,,20))
  182. $(eval $(call BuildPlugin,authn_file,File-based authentication,lighttpd-mod-auth,20))
  183. $(eval $(call BuildPlugin,authn_gssapi,Kerberos-based authentication,lighttpd-mod-auth +PACKAGE_lighttpd-mod-authn_gssapi:krb5-libs,20))
  184. $(eval $(call BuildPlugin,authn_ldap,LDAP-based authentication,lighttpd-mod-auth +PACKAGE_lighttpd-mod-authn_ldap:libopenldap,20))
  185. $(eval $(call BuildPlugin,authn_mysql,Mysql-based authentication,lighttpd-mod-auth +PACKAGE_lighttpd-mod-authn_mysql:libmysqlclient,20))
  186. $(eval $(call BuildPlugin,authn_pam,PAM-based authentication,lighttpd-mod-auth +PACKAGE_lighttpd-mod-authn_pam:libpam,20))
  187. # Finally, everything else.
  188. $(eval $(call BuildPlugin,access,Access restrictions,,30))
  189. $(eval $(call BuildPlugin,accesslog,Access logging,,30))
  190. $(eval $(call BuildPlugin,alias,Directory alias,,30))
  191. $(eval $(call BuildPlugin,cgi,CGI,,30))
  192. #$(eval $(call BuildPlugin,cml,Cache Meta Language,+PACKAGE_lighttpd-mod-cml:liblua +PACKAGE_lighttpd-mod-cml:libmemcached,30))
  193. $(eval $(call BuildPlugin,cml,Cache Meta Language,+PACKAGE_lighttpd-mod-cml:liblua,30))
  194. $(eval $(call BuildPlugin,compress,Compress output,+PACKAGE_lighttpd-mod-compress:zlib,30))
  195. $(eval $(call BuildPlugin,deflate,Compress dynamic output,+PACKAGE_lighttpd-mod-deflate:zlib,30))
  196. $(eval $(call BuildPlugin,evasive,Evasive,,30))
  197. $(eval $(call BuildPlugin,evhost,Enhanced Virtual-Hosting,,30))
  198. $(eval $(call BuildPlugin,expire,Expire,,30))
  199. $(eval $(call BuildPlugin,extforward,Extract client,,30))
  200. $(eval $(call BuildPlugin,fastcgi,FastCGI,,30))
  201. $(eval $(call BuildPlugin,flv_streaming,FLV streaming,,30))
  202. #$(eval $(call BuildPlugin,geoip,Geolocation,+PACKAGE_lighttpd-mod-geoip:libgeoip,30))
  203. $(eval $(call BuildPlugin,magnet,Magnet,+PACKAGE_lighttpd-mod-magnet:liblua,30))
  204. $(eval $(call BuildPlugin,mysql_vhost,Mysql virtual hosting,+PACKAGE_lighttpd-mod-mysql_vhost:libmysqlclient,30))
  205. $(eval $(call BuildPlugin,proxy,Proxy,,30))
  206. $(eval $(call BuildPlugin,rewrite,URL rewriting,+PACKAGE_lighttpd-mod-rewrite:libpcre,30))
  207. $(eval $(call BuildPlugin,rrdtool,RRDtool,,30))
  208. $(eval $(call BuildPlugin,scgi,SCGI,,30))
  209. $(eval $(call BuildPlugin,secdownload,Secure and fast download,,30))
  210. $(eval $(call BuildPlugin,setenv,Environment variable setting,,30))
  211. $(eval $(call BuildPlugin,simple_vhost,Simple virtual hosting,,30))
  212. $(eval $(call BuildPlugin,ssi,SSI,+PACKAGE_lighttpd-mod-ssi:libpcre,30))
  213. $(eval $(call BuildPlugin,status,Server status display,,30))
  214. #$(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))
  215. $(eval $(call BuildPlugin,trigger_b4_dl,Trigger before download,+PACKAGE_lighttpd-mod-trigger_b4_dl:libpcre +PACKAGE_lighttpd-mod-trigger_b4_dl:libgdbm,30))
  216. $(eval $(call BuildPlugin,userdir,User directory,,30))
  217. $(eval $(call BuildPlugin,usertrack,User tracking,,30))
  218. $(eval $(call BuildPlugin,webdav,WebDAV,+PACKAGE_lighttpd-mod-webdav:libsqlite3 +PACKAGE_lighttpd-mod-webdav:libuuid +PACKAGE_lighttpd-mod-webdav:libxml2,30))
  219. $(eval $(call BuildPlugin,wstunnel,Websocket tunneling,,30))