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