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