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