summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package/Config.in1
-rw-r--r--package/thttpd/Config.in7
-rw-r--r--package/thttpd/thttpd.mk73
3 files changed, 81 insertions, 0 deletions
diff --git a/package/Config.in b/package/Config.in
index 3875819aa..d05ac727d 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -115,6 +115,7 @@ source "package/sysvinit/Config.in"
source "package/tcl/Config.in"
source "package/tcpdump/Config.in"
source "package/tftpd/Config.in"
+source "package/thttpd/Config.in"
source "package/tinylogin/Config.in"
source "package/tinyx/Config.in"
source "package/tn5250/Config.in"
diff --git a/package/thttpd/Config.in b/package/thttpd/Config.in
new file mode 100644
index 000000000..eb1d86635
--- /dev/null
+++ b/package/thttpd/Config.in
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_THTTPD
+ bool "thttpd"
+ default n
+ help
+ thttpd is a simple, small, portable, fast, and secure HTTP server
+
+ http://www.acme.com/software/thttpd/
diff --git a/package/thttpd/thttpd.mk b/package/thttpd/thttpd.mk
new file mode 100644
index 000000000..75623d0a5
--- /dev/null
+++ b/package/thttpd/thttpd.mk
@@ -0,0 +1,73 @@
+#############################################################
+#
+# thttpd
+#
+#############################################################
+THTTPD_VER:=2.25b
+THTTPD_SOURCE:=thttpd-$(THTTPD_VER).tar.gz
+THTTPD_SITE:=http://www.acme.com/software/thttpd/
+THTTPD_DIR:=$(BUILD_DIR)/thttpd-$(THTTPD_VER)
+THTTPD_CAT:=zcat
+THTTPD_BINARY:=thttpd
+THTTPD_TARGET_BINARY:=sbin/thttpd
+THTTPD_ROOT:=/var
+THTTPD_WEB_DIR:=$(THTTPD_ROOT)/www
+
+$(DL_DIR)/$(THTTPD_SOURCE):
+ $(WGET) -P $(DL_DIR) $(THTTPD_SITE)/$(THTTPD_SOURCE)
+
+$(THTTPD_DIR)/.unpacked: $(DL_DIR)/$(THTTPD_SOURCE)
+ $(THTTPD_CAT) $(DL_DIR)/$(THTTPD_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
+ touch $(THTTPD_DIR)/.unpacked
+
+$(THTTPD_DIR)/.configured: $(THTTPD_DIR)/.unpacked
+ (cd $(THTTPD_DIR); rm -rf config.cache; \
+ $(TARGET_CONFIGURE_OPTS) CC_FOR_BUILD=$(HOSTCC) \
+ CFLAGS="$(TARGET_CFLAGS)" \
+ ./configure \
+ --target=$(GNU_TARGET_NAME) \
+ --host=$(GNU_TARGET_NAME) \
+ --build=$(GNU_HOST_NAME) \
+ --prefix=$(THTTPD_ROOT) \
+ );
+ touch $(THTTPD_DIR)/.configured
+
+$(THTTPD_DIR)/$(THTTPD_BINARY): $(THTTPD_DIR)/.configured
+ $(TARGET_CONFIGURE_OPTS) $(MAKE) CC=$(TARGET_CC) -C $(THTTPD_DIR)
+
+$(TARGET_DIR)/$(THTTPD_TARGET_BINARY): $(THTTPD_DIR)/$(THTTPD_BINARY)
+ install -D $(THTTPD_DIR)/$(THTTPD_BINARY) $(TARGET_DIR)/$(THTTPD_TARGET_BINARY)
+ install -D $(THTTPD_DIR)/extras/htpasswd $(TARGET_DIR)/bin/htpasswd
+ install -D $(THTTPD_DIR)/extras/makeweb $(TARGET_DIR)/bin/makeweb
+ install -D $(THTTPD_DIR)/extras/syslogtocern $(TARGET_DIR)/bin/syslogtocern
+ install -D $(THTTPD_DIR)/scripts/thttpd_wrapper $(TARGET_DIR)/sbin
+ install -D $(THTTPD_DIR)/scripts/thttpd.sh $(TARGET_DIR)/etc/init.d/S90thttpd
+ cp $(TARGET_DIR)/etc/init.d/S90thttpd $(TARGET_DIR)/etc/init.d/S90thttpd.in
+ cp $(TARGET_DIR)/sbin/thttpd_wrapper $(TARGET_DIR)/sbin/thttpd_wrapper.in
+ sed -e "s:/usr/local/sbin:/sbin:g" -e "s:/usr/local/www:$(THTTPD_WEB_DIR):g" < $(TARGET_DIR)/sbin/thttpd_wrapper.in > $(TARGET_DIR)/sbin/httpd_wrapper
+ sed -e "s:/usr/local/sbin:/sbin:g" < $(TARGET_DIR)/etc/init.d/S90thttpd.in > $(TARGET_DIR)/etc/init.d/S90thttpd
+ rm -f $(TARGET_DIR)/etc/init.d/S90thttpd.in $(TARGET_DIR)/sbin/thttpd_wrapper.in
+ install -d $(TARGET_DIR)$(THTTPD_WEB_DIR)/data
+ install -d $(TARGET_DIR)$(THTTPD_WEB_DIR)/logs
+ echo "dir=$(THTTPD_WEB_DIR)/data" > $(TARGET_DIR)$(THTTPD_WEB_DIR)/thttpd_config
+ echo 'cgipat=**.cgi' >> $(TARGET_DIR)$(THTTPD_WEB_DIR)/thttpd_config
+ echo "logfile=$(THTTPD_WEB_DIR)/logs/thttpd_log" >> $(TARGET_DIR)$(THTTPD_WEB_DIR)/thttpd_config
+ echo "pidfile=/var/run/thttpd.pid" >> $(TARGET_DIR)$(THTTPD_WEB_DIR)/thttpd_config
+ echo "<HTML><BODY>thttpd test page</BODY></HTML>" > $(TARGET_DIR)$(THTTPD_WEB_DIR)/data/index.html
+
+thttpd: uclibc $(TARGET_DIR)/$(THTTPD_TARGET_BINARY)
+
+thttpd-clean:
+ rm -f $(TARGET_DIR)/$(THTTPD_TARGET_BINARY)
+ -$(MAKE) -C $(THTTPD_DIR) clean
+
+thttpd-dirclean:
+ rm -rf $(THTTPD_DIR)
+#############################################################
+#
+# Toplevel Makefile options
+#
+#############################################################
+ifeq ($(strip $(BR2_PACKAGE_THTTPD)),y)
+TARGETS+=thttpd
+endif