fix mini_httpd, standardize
[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 TITLE:=A small web server, built with SSL support using MatrixSSL
61 DESCRIPTION+=This package adds SSL/HTTPS. (MatrixSSL)
62 endef
63
64 define Package/mini-httpd-matrixssl/conffiles
65 /etc/mini_httpd.conf
66 /etc/mini_httpd.pem
67 /etc/default/mini_httpd
68 endef
69
70 define Package/mini-httpd-openssl
71 $(call Package/mini-httpd)
72 TITLE:=A small web server, built with SSL support using OpenSSL
73 DESCRIPTION+=This package adds SSL/HTTPS. (OpenSSL)
74 endef
75
76 define Package/mini-httpd-openssl/conffiles
77 /etc/mini_httpd.conf
78 /etc/mini_httpd.pem
79 /etc/default/mini_httpd
80 endef
81
82 ifneq ($(SDK),)
83 CONFIG_PACKAGE_mini-httpd:=m
84 CONFIG_PACKAGE_mini-httpd-matrixssl:=m
85 CONFIG_PACKAGE_mini-httpd-openssl:=m
86 endif
87
88 define Build/Configure
89 $(CP) ./files/matrixssl_helper.{c,h} $(PKG_BUILD_DIR)/
90 endef
91
92 define Build/Compile
93 # with MatrixSSL
94 ifneq ($(CONFIG_PACKAGE_mini-httpd-matrixssl),)
95 $(MAKE) -C $(PKG_BUILD_DIR) \
96 CC=$(TARGET_CC) \
97 OFLAGS="$(TARGET_CFLAGS)" \
98 SSL_DEFS="-DUSE_SSL -DHAVE_MATRIXSSL" \
99 SSL_INC="-I$(STAGING_DIR)/usr/include" \
100 SSL_LIBS="-L$(STAGING_DIR)/usr/lib -lmatrixssl" \
101 SSL_OBJS="matrixssl_helper.o" \
102 all
103 (cd $(PKG_BUILD_DIR); mv mini_httpd mini_httpd-matrixssl; )
104 $(MAKE) -C $(PKG_BUILD_DIR) clean
105 endif
106 # with OpenSSL
107 ifneq ($(CONFIG_PACKAGE_mini-httpd-openssl),)
108 $(MAKE) -C $(PKG_BUILD_DIR) \
109 CC=$(TARGET_CC) \
110 OFLAGS="$(TARGET_CFLAGS)" \
111 SSL_DEFS="-DUSE_SSL -DHAVE_OPENSSL" \
112 SSL_INC="-I$(STAGING_DIR)/usr/include" \
113 SSL_LIBS="-L$(STAGING_DIR)/usr/lib -lssl -lcrypto" \
114 all
115 (cd $(PKG_BUILD_DIR); mv mini_httpd mini_httpd-openssl; )
116 $(MAKE) -C $(PKG_BUILD_DIR) clean
117 endif
118 # without SSL
119 ifneq ($(CONFIG_PACKAGE_mini-httpd),)
120 $(MAKE) -C $(PKG_BUILD_DIR) \
121 CC=$(TARGET_CC) \
122 OFLAGS="$(TARGET_CFLAGS)" \
123 all
124 endif
125 endef
126
127 define Package/mini-httpd/install
128 install -d -m0755 $(1)/etc
129 install -m0644 ./files/mini_httpd.conf $(1)/etc/mini_httpd.conf
130 install -d -m0755 $(1)/etc/default
131 install -m0644 ./files/mini_httpd.default $(1)/etc/default/mini_httpd
132 install -d -m0755 $(1)/etc/init.d
133 install -m0755 ./files/mini_httpd.init $(1)/etc/init.d/mini_httpd
134 install -d -m0755 $(1)/usr/sbin
135 install -m0755 $(PKG_BUILD_DIR)/mini_httpd $(1)/usr/sbin/mini_httpd
136 endef
137
138 define Package/mini-httpd-htpasswd/install
139 install -d -m0755 $(1)/usr/sbin
140 install -m0755 $(PKG_BUILD_DIR)/htpasswd $(1)/usr/sbin/
141 endef
142
143 define Package/mini-httpd-matrixssl/install
144 install -d -m0755 $(1)/etc
145 install -m0644 ./files/mini_httpd-ssl.conf $(1)/etc/mini_httpd.conf
146 install -m0600 ./files/mini_httpd.pem $(1)/etc/mini_httpd.pem
147 install -d -m0755 $(1)/etc/default
148 install -m0644 ./files/mini_httpd.default $(1)/etc/default/mini_httpd
149 install -d -m0755 $(1)/etc/init.d
150 install -m0755 ./files/mini_httpd.init $(1)/etc/init.d/mini_httpd
151 install -d -m0755 $(1)/usr/sbin
152 install -m0755 $(PKG_BUILD_DIR)/mini_httpd-matrixssl $(1)/usr/sbin/mini_httpd
153 endef
154
155 define Package/mini-httpd-openssl/install
156 install -d -m0755 $(1)/etc
157 install -m0644 ./files/mini_httpd-ssl.conf $(1)/etc/mini_httpd.conf
158 install -m0600 ./files/mini_httpd.pem $(1)/etc/mini_httpd.pem
159 install -d -m0755 $(1)/etc/default
160 install -m0644 ./files/mini_httpd.default $(1)/etc/default/mini_httpd
161 install -d -m0755 $(1)/etc/init.d
162 install -m0755 ./files/mini_httpd.init $(1)/etc/init.d/mini_httpd
163 install -d -m0755 $(1)/usr/sbin
164 install -m0755 $(PKG_BUILD_DIR)/mini_httpd-openssl $(1)/usr/sbin/mini_httpd
165 endef
166
167 $(eval $(call BuildPackage,mini-httpd))
168 $(eval $(call BuildPackage,mini-httpd-htpasswd))
169 $(eval $(call BuildPackage,mini-httpd-matrixssl))
170 $(eval $(call BuildPackage,mini-httpd-openssl))