e352fbeee94e593e838ec6f75463e4518912698e
[packages.git] / net / lighttpd / Makefile
1
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=lighttpd
12 PKG_VERSION:=1.4.11
13 PKG_RELEASE:=1
14
15 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
16 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
17 PKG_SOURCE_URL:=http://www.lighttpd.net/download/
18 PKG_MD5SUM:=f55eebb9815c94a7de35906bb557ecd3
19 PKG_CAT:=zcat
20
21 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
22
23 include $(INCLUDE_DIR)/package.mk
24
25 define Package/lighttpd
26   MENU:=1
27   SECTION:=net
28   CATEGORY:=Network
29   DEPENDS:=+libopenssl +libpcre +libpthread +libsqlite3 +libxml2
30   TITLE:=A flexible and lightweight web server
31   URL:=http://www.lighttpd.net/
32 endef
33
34 define Package/lighttpd/conffiles
35 /etc/lighttpd.conf
36 /etc/default/lighttpd
37 /etc/init.d/lighttpd
38 endef
39
40 define Package/lighttpd-mod-accesslog
41   $(call Package/lighttpd)
42   DEPENDS:=lighttpd
43   TITLE:=Access logging module
44 endef
45
46 define Package/lighttpd-mod-alias
47   $(call Package/lighttpd)
48   DEPENDS:=lighttpd
49   TITLE:=Directory alias module
50 endef
51
52 define Package/lighttpd-mod-auth
53   $(call Package/lighttpd)
54   DEPENDS:=lighttpd
55   TITLE:=Authentication module
56 endef
57
58 define Package/lighttpd-mod-cgi
59   $(call Package/lighttpd)
60   DEPENDS:=lighttpd
61   TITLE:=CGI module
62 endef
63
64 define Package/lighttpd-mod-evasive
65   $(call Package/lighttpd)
66   DEPENDS:=lighttpd
67   TITLE:=Evasive module
68 endef
69
70 define Package/lighttpd-mod-expire
71   $(call Package/lighttpd)
72   DEPENDS:=lighttpd
73   TITLE:=Expire module
74 endef
75
76 define Package/lighttpd-mod-fastcgi
77   $(call Package/lighttpd)
78   DEPENDS:=lighttpd
79   TITLE:=FastCGI module
80 endef
81
82 define Package/lighttpd-mod-proxy
83   $(call Package/lighttpd)
84   DEPENDS:=lighttpd
85   TITLE:=Proxy module
86 endef
87
88 define Package/lighttpd-mod-redirect
89   $(call Package/lighttpd)
90   DEPENDS:=lighttpd
91   TITLE:=URL redirection module
92 endef
93
94 define Package/lighttpd-mod-rewrite
95   $(call Package/lighttpd)
96   DEPENDS:=lighttpd
97   TITLE:=URL rewriting module
98 endef
99
100 define Package/lighttpd-mod-setenv
101   $(call Package/lighttpd)
102   DEPENDS:=lighttpd
103   TITLE:=Environment variable setting module
104 endef
105
106 define Package/lighttpd-mod-simple-vhost
107   $(call Package/lighttpd)
108   DEPENDS:=lighttpd
109   TITLE:=Simple virtual hosting module
110 endef
111
112 define Package/lighttpd-mod-ssi
113   $(call Package/lighttpd)
114   DEPENDS:=lighttpd
115   TITLE:=SSI module
116 endef
117
118 define Package/lighttpd-mod-status
119   $(call Package/lighttpd)
120   DEPENDS:=lighttpd
121   TITLE:=Server status display module
122 endef
123
124 define Package/lighttpd-mod-usertrack
125   $(call Package/lighttpd)
126   DEPENDS:=lighttpd
127   TITLE:=User tracking module
128 endef
129
130 define Package/lighttpd-mod-webdav
131   $(call Package/lighttpd)
132   DEPENDS:=lighttpd
133   TITLE:=WebDAV module
134 endef
135
136 define Build/Configure
137         (cd $(PKG_BUILD_DIR); rm -f config.cache; \
138                 $(TARGET_CONFIGURE_OPTS) \
139                 CFLAGS="$(TARGET_CFLAGS)" \
140                 CPPFLAGS="-I$(STAGING_DIR)/usr/include/libxml2 -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
141                 LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
142                 PCRE_LIB="-lpcre" \
143                 PKG_CONFIG_PATH="$(STAGING_DIR)/usr/lib/pkgconfig" \
144                 ./configure \
145                         --target=$(GNU_TARGET_NAME) \
146                         --host=$(GNU_TARGET_NAME) \
147                         --build=$(GNU_HOST_NAME) \
148                         --program-prefix="" \
149                         --program-suffix="" \
150                         --prefix=/usr \
151                         --exec-prefix=/usr \
152                         --bindir=/usr/bin \
153                         --datadir=/usr/share \
154                         --includedir=/usr/include \
155                         --infodir=/usr/share/info \
156                         --libdir=/usr/lib/lighttpd \
157                         --libexecdir=/usr/lib \
158                         --localstatedir=/var \
159                         --mandir=/usr/share/man \
160                         --sbindir=/usr/sbin \
161                         --sysconfdir=/etc/lighttpd \
162                         $(DISABLE_LARGEFILE) \
163                         $(DISABLE_NLS) \
164                         --enable-shared \
165                         --enable-static \
166                         --disable-rpath \
167                         --without-attr \
168                         --without-bzip2 \
169                         --without-fam \
170                         --without-gdbm \
171                         --without-ldap \
172                         --without-lua \
173                         --without-memcache \
174                         --without-mysql \
175                         --with-openssl="$(STAGING_DIR)/usr" \
176                         --with-pcre \
177                         --without-valgrind \
178                         --with-webdav-props \
179         );
180 endef
181
182 define Build/Compile
183         rm -rf $(PKG_INSTALL_DIR)
184         mkdir -p $(PKG_INSTALL_DIR)
185         $(MAKE) -C $(PKG_BUILD_DIR) \
186                 DESTDIR="$(PKG_INSTALL_DIR)" \
187                 all install
188 endef
189
190 define Package/lighttpd/install
191         install -m0755 -d $(1)/etc
192         install -m0644 ./files/lighttpd.conf $(1)/etc/
193         install -m0755 -d $(1)/etc/default
194         install -m0644 ./files/lighttpd.default $(1)/etc/default/lighttpd
195         install -m0755 -d $(1)/etc/init.d
196         install -m0755 ./files/lighttpd.init $(1)/etc/init.d/lighttpd
197         install -m0755 -d $(1)/usr/lib/lighttpd
198         for m in dirlisting indexfile staticfile; do \
199                 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lighttpd/mod_$$$${m}.so $(1)/usr/lib/lighttpd/ ; \
200         done
201         install -m0755 -d $(1)/usr/sbin
202         $(CP) $(PKG_INSTALL_DIR)/usr/sbin/lighttpd $(1)/usr/sbin/
203 endef
204
205 define BuildPlugin
206   define Package/$(1)/install
207         [ -z "$(2)" ] || install -d -m0755 $$(1)/usr/lib/lighttpd
208         for m in $(2); do \
209                 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lighttpd/mod_$$$$$$$${m}.so $$(1)/usr/lib/lighttpd/ ; \
210         done
211   endef
212
213   $$(eval $$(call BuildPackage,$(1)))
214 endef
215
216 $(eval $(call BuildPackage,lighttpd))
217 $(eval $(call BuildPlugin,lighttpd-mod-accesslog,accesslog))
218 $(eval $(call BuildPlugin,lighttpd-mod-alias,alias))
219 $(eval $(call BuildPlugin,lighttpd-mod-auth,auth))
220 $(eval $(call BuildPlugin,lighttpd-mod-cgi,cgi))
221 $(eval $(call BuildPlugin,lighttpd-mod-evasive,evasive))
222 $(eval $(call BuildPlugin,lighttpd-mod-expire, expire))
223 $(eval $(call BuildPlugin,lighttpd-mod-fastcgi,fastcgi))
224 $(eval $(call BuildPlugin,lighttpd-mod-proxy,proxy))
225 $(eval $(call BuildPlugin,lighttpd-mod-redirect,redirect))
226 $(eval $(call BuildPlugin,lighttpd-mod-rewrite,rewrite))
227 $(eval $(call BuildPlugin,lighttpd-mod-setenv,setenv))
228 $(eval $(call BuildPlugin,lighttpd-mod-simple-vhost,simple_vhost))
229 $(eval $(call BuildPlugin,lighttpd-mod-ssi,ssi))
230 $(eval $(call BuildPlugin,lighttpd-mod-status,status))
231 $(eval $(call BuildPlugin,lighttpd-mod-usertrack,usertrack))
232 $(eval $(call BuildPlugin,lighttpd-mod-webdav,webdav))