b405a6ff5190783162b7f3d82b3dcb8749c10c0b
[openwrt/svn-archive/archive.git] / net / mini_httpd / 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:=mini-httpd
12 PKG_VERSION:=1.19
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=mini_httpd-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=http://www.acme.com/software/mini_httpd/
17 PKG_MD5SUM:=792a529dfe974355aad8ba6c80e54e7a
18
19 PKG_BUILD_DIR:=$(BUILD_DIR)/mini_httpd-$(PKG_VERSION)
20
21 include $(INCLUDE_DIR)/package.mk
22
23 define Package/mini-httpd/Default
24 SUBMENU:=Web
25 SECTION:=net
26 CATEGORY:=Network
27 TITLE:=A small web server
28 URL:=http://www.acme.com/software/mini_httpd/
29 endef
30
31 define Package/mini-httpd/Default/conffiles
32 /etc/mini_httpd.conf
33 /etc/default/mini_httpd
34 endef
35
36 define Package/mini-httpd/Default/description
37 mini_httpd is a small HTTP server. Its performance is not great, but for
38 low or medium traffic sites it's quite adequate. It implements all the
39 basic features of an HTTP server, including:
40 - GET, HEAD, and POST methods
41 - CGI
42 - Basic authentication
43 - Security against ".." filename snooping
44 - The common MIME types
45 - Trailing-slash redirection
46 - index.html, index.htm, index.cgi
47 - Directory listings
48 - Multihoming / virtual hosting
49 - Standard logging
50 - Custom error pages
51 It can also be configured to do IPv6.
52 endef
53
54 define Package/mini-httpd
55 $(call Package/mini-httpd/Default)
56 endef
57
58 define Package/mini-httpd/conffiles
59 $(call Package/mini-httpd/Default/conffiles)
60 endef
61
62 define Package/mini-httpd/description
63 $(call Package/mini-httpd/Default/description)
64 endef
65
66 define Package/mini-httpd-matrixssl
67 $(call Package/mini-httpd/Default)
68 DEPENDS:= +libmatrixssl
69 TITLE+= (built with MatrixSSL)
70 endef
71
72 define Package/mini-httpd-matrixssl/conffiles
73 $(call Package/mini-httpd/Default/conffiles)
74 /etc/mini_httpd.pem
75 endef
76
77 define Package/mini-httpd-matrixssl/description
78 $(call Package/mini-httpd/Default/description)
79 This package is built with SSL/HTTPS using MatrixSSL.
80 endef
81
82 define Package/mini-httpd-openssl
83 $(call Package/mini-httpd/Default)
84 DEPENDS:= +libopenssl
85 TITLE+= (built with OpenSSL)
86 endef
87
88 define Package/mini-httpd-openssl/conffiles
89 $(call Package/mini-httpd/Default/conffiles)
90 /etc/mini_httpd.pem
91 endef
92
93 define Package/mini-httpd-openssl/description
94 $(call Package/mini-httpd/Default/description)
95 This package is built with SSL/HTTPS using OpenSSL.
96 endef
97
98 define Package/mini-httpd-htpasswd
99 $(call Package/mini-httpd/Default)
100 TITLE:=Utility to generate HTTP access files
101 endef
102
103 define Package/mini-httpd-htpasswd/description
104 $(call Package/mini-httpd/Default/description)
105 This package generates .htaccess/.htpasswd files to use HTTP access authentication.
106 endef
107
108
109 define Build/Template
110
111 $(STAMP_BUILT)-$(2): $(STAMP_PREPARED)
112 -$(MAKE) -C $(PKG_BUILD_DIR) clean
113 $(MAKE) -C $(PKG_BUILD_DIR) \
114 $(TARGET_CONFIGURE_OPTS) \
115 OFLAGS="$(TARGET_CFLAGS)" \
116 $(3) \
117 all
118 ( cd $(PKG_BUILD_DIR); mv -f mini_httpd mini_httpd-$(2) )
119 touch $$@
120
121 $(STAMP_BUILT): $(STAMP_BUILT)-$(2)
122
123 define Package/$(1)/install
124 $(INSTALL_DIR) $$(1)/etc
125 ifeq ($(2),without-ssl)
126 $(INSTALL_DATA) ./files/mini_httpd.conf $$(1)/etc/mini_httpd.conf
127 else
128 $(INSTALL_DATA) ./files/mini_httpd-ssl.conf $$(1)/etc/mini_httpd.conf
129 $(INSTALL_CONF) ./files/mini_httpd.pem $$(1)/etc/mini_httpd.pem
130 endif
131 $(INSTALL_DIR) $$(1)/etc/default
132 $(INSTALL_DATA) ./files/mini_httpd.default $$(1)/etc/default/mini_httpd
133 $(INSTALL_DIR) $$(1)/etc/init.d
134 $(INSTALL_BIN) ./files/mini_httpd.init $$(1)/etc/init.d/mini_httpd
135 $(INSTALL_DIR) $$(1)/usr/sbin
136 $(INSTALL_BIN) $(PKG_BUILD_DIR)/mini_httpd-$(2) $$(1)/usr/sbin/mini_httpd
137 endef
138
139 endef
140
141
142 define Build/Prepare
143 $(call Build/Prepare/Default)
144 $(CP) ./files/matrixssl_helper.{c,h} $(PKG_BUILD_DIR)/
145 endef
146
147 define Build/Configure
148 endef
149
150 define Build/Compile
151 endef
152
153 # always build without SSL because we might need htpassd
154 define Build/without-ssl
155 $(call Build/Template,minit-httpd,without-ssl,)
156 endef
157 $(eval $(Build/without-ssl))
158
159 ifneq ($(SDK)$(CONFIG_PACKAGE_mini-httpd-matrixssl),)
160 define Build/with-matrixssl
161 $(call Build/Template,mini-httpd-matrixssl,with-matrixssl, \
162 SSL_DEFS="-DUSE_SSL -DHAVE_MATRIXSSL" \
163 SSL_INC="$(TARGET_CPPFLAGS)" \
164 SSL_LIBS="$(TARGET_LDFLAGS) -lmatrixssl" \
165 SSL_OBJS="matrixssl_helper.o" \
166 )
167 endef
168 endif
169 $(eval $(Build/with-matrixssl))
170
171 ifneq ($(SDK)$(CONFIG_PACKAGE_mini-httpd-openssl),)
172 define Build/with-openssl
173 $(call Build/Template,minit-httpd-openssl,with-openssl, \
174 SSL_DEFS="-DUSE_SSL -DHAVE_OPENSSL" \
175 SSL_INC="$(TARGET_CPPFLAGS)" \
176 SSL_LIBS="$(TARGET_LDFLAGS) -lcrypto -lssl" \
177 )
178 endef
179 endif
180 $(eval $(Build/with-openssl))
181
182 define Package/mini-httpd-htpasswd/install
183 $(INSTALL_DIR) $(1)/usr/sbin
184 $(INSTALL_BIN) $(PKG_BUILD_DIR)/htpasswd $(1)/usr/sbin/
185 endef
186
187 $(eval $(call BuildPackage,mini-httpd))
188 $(eval $(call BuildPackage,mini-httpd-matrixssl))
189 $(eval $(call BuildPackage,mini-httpd-openssl))
190 $(eval $(call BuildPackage,mini-httpd-htpasswd))