From 0ffc8419b44179821f2f86fe9fb6e89543405be2 Mon Sep 17 00:00:00 2001 From: "\"Steven J. Hill\"" Date: Fri, 20 Jul 2007 14:37:48 +0000 Subject: [PATCH] Fix hdparm to cross build correctly. Also fix thttpd to build and install sanely and add simplified start up. --- package/hdparm/hdparm.mk | 4 +++- package/hdparm/hdparm.patch | 12 +++++++++++ package/thttpd/S90thttpd | 43 +++++++++++++++++++++++++++++++++++++ package/thttpd/thttpd.conf | 7 ++++++ package/thttpd/thttpd.mk | 40 ++++++++++------------------------ 5 files changed, 76 insertions(+), 30 deletions(-) create mode 100644 package/hdparm/hdparm.patch create mode 100755 package/thttpd/S90thttpd create mode 100644 package/thttpd/thttpd.conf diff --git a/package/hdparm/hdparm.mk b/package/hdparm/hdparm.mk index c43e2ecf04..91d2ee5cbc 100644 --- a/package/hdparm/hdparm.mk +++ b/package/hdparm/hdparm.mk @@ -19,15 +19,17 @@ hdparm-source: $(DL_DIR)/$(HDPARM_SOURCE) hdparm-unpacked: $(HDPARM_DIR)/.unpacked $(HDPARM_DIR)/.unpacked: $(DL_DIR)/$(HDPARM_SOURCE) $(HDPARM_CAT) $(DL_DIR)/$(HDPARM_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) - + toolchain/patch-kernel.sh $(HDPARM_DIR) package/hdparm hdparm.patch touch $(HDPARM_DIR)/.unpacked $(HDPARM_DIR)/.configured: $(HDPARM_DIR)/.unpacked touch $(HDPARM_DIR)/.configured $(HDPARM_DIR)/$(HDPARM_BINARY): $(HDPARM_DIR)/.configured - $(MAKE) CC=$(TARGET_CC) -C $(HDPARM_DIR) + $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(HDPARM_DIR) $(TARGET_DIR)/$(HDPARM_TARGET_BINARY): $(HDPARM_DIR)/$(HDPARM_BINARY) + rm -f $(TARGET_DIR)/$(HDPARM_TARGET_BINARY) cp -a $(HDPARM_DIR)/$(HDPARM_BINARY) $(TARGET_DIR)/$(HDPARM_TARGET_BINARY) hdparm: uclibc $(TARGET_DIR)/$(HDPARM_TARGET_BINARY) diff --git a/package/hdparm/hdparm.patch b/package/hdparm/hdparm.patch new file mode 100644 index 0000000000..d271eb8796 --- /dev/null +++ b/package/hdparm/hdparm.patch @@ -0,0 +1,12 @@ +diff -ur hdparm-7.6/Makefile hdparm-7.6-patched/Makefile +--- hdparm-7.6/Makefile 2007-06-07 12:39:24.000000000 -0500 ++++ hdparm-7.6-patched/Makefile 2007-07-19 12:11:03.000000000 -0500 +@@ -28,7 +28,7 @@ + + hdparm: hdparm.h $(OBJS) + $(CC) $(LDFLAGS) -o hdparm $(OBJS) +- strip hdparm ++ $(STRIP) hdparm + + install: all hdparm.8 + if [ ! -z $(DESTDIR) ]; then $(INSTALL_DIR) $(DESTDIR) ; fi diff --git a/package/thttpd/S90thttpd b/package/thttpd/S90thttpd new file mode 100755 index 0000000000..76949bd33f --- /dev/null +++ b/package/thttpd/S90thttpd @@ -0,0 +1,43 @@ +#!/bin/sh + +DAEMON=/usr/sbin/thttpd +test -f $DAEMON || exit 0 + +start() { + echo -n "Starting thttpd: " + $DAEMON -C /etc/thttpd.conf + if [ $? != 0 ]; then + echo "FAILED" + exit 1 + else + echo "done" + fi +} + +stop() { + echo -n "Stopping ProFTPD: " + kill -9 `cat /var/run/thttpd.pid` + echo "done" +} + +case "$1" in + start) + start + ;; + + stop) + stop + ;; + + restart) + stop + start + ;; + + *) + echo "Usage: /etc/init.d/S90thttpd {start|stop|restart}" + exit 1 + ;; +esac + +exit 0 diff --git a/package/thttpd/thttpd.conf b/package/thttpd/thttpd.conf new file mode 100644 index 0000000000..b4c801ba0b --- /dev/null +++ b/package/thttpd/thttpd.conf @@ -0,0 +1,7 @@ +chroot +dir=/var/www +pidfile=/var/run/thttpd.pid +logfile=/var/log/thttpd +host=dtu-7100 +user=nobody +cgipat=**.cgi diff --git a/package/thttpd/thttpd.mk b/package/thttpd/thttpd.mk index 3c676d18cc..4132fcbfdb 100644 --- a/package/thttpd/thttpd.mk +++ b/package/thttpd/thttpd.mk @@ -9,9 +9,8 @@ THTTPD_SITE:=http://www.acme.com/software/thttpd/ THTTPD_DIR:=$(BUILD_DIR)/thttpd-$(THTTPD_VERSION) THTTPD_CAT:=$(ZCAT) THTTPD_BINARY:=thttpd -THTTPD_TARGET_BINARY:=sbin/thttpd -THTTPD_ROOT:=/var -THTTPD_WEB_DIR:=$(THTTPD_ROOT)/www +THTTPD_TARGET_BINARY:=usr/sbin/thttpd +THTTPD_WEB_DIR:=/var/www $(DL_DIR)/$(THTTPD_SOURCE): $(WGET) -P $(DL_DIR) $(THTTPD_SITE)/$(THTTPD_SOURCE) @@ -30,48 +29,31 @@ $(THTTPD_DIR)/.configured: $(THTTPD_DIR)/.unpacked --target=$(GNU_TARGET_NAME) \ --host=$(GNU_TARGET_NAME) \ --build=$(GNU_HOST_NAME) \ - --prefix=$(THTTPD_ROOT) \ + --prefix=/usr \ ); touch $(THTTPD_DIR)/.configured $(THTTPD_DIR)/$(THTTPD_BINARY): $(THTTPD_DIR)/.configured - $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(THTTPD_DIR) + $(MAKE) $(TARGET_CONFIGURE_OPTS) WEBDIR=$(THTTPD_WEB_DIR) -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/thttpd_wrapper - 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 "thttpd test page" > $(TARGET_DIR)$(THTTPD_WEB_DIR)/data/index.html + $(MAKE) $(TARGET_CONFIGURE_OPTS) prefix=$(TARGET_DIR)/usr WEBDIR=$(THTTPD_WEB_DIR) -C $(THTTPD_DIR) installthis + $(STRIP) --strip-unneeded $(THTTPD_DIR)/$(THTTPD_BINARY) + $(INSTALL) -d $(TARGET_DIR)$(THTTPD_WEB_DIR)/cgi-bin + $(INSTALL) -m 0755 package/thttpd/S90thttpd $(TARGET_DIR)/etc/init.d + $(INSTALL) -m 0644 package/thttpd/thttpd.conf $(TARGET_DIR)/etc thttpd: uclibc $(TARGET_DIR)/$(THTTPD_TARGET_BINARY) thttpd-clean: rm -f $(TARGET_DIR)/$(THTTPD_TARGET_BINARY) - rm -f $(TARGET_DIR)/sbin/httpd_wrapper - rm -f $(TARGET_DIR)/sbin/thttpd_wrapper rm -rf $(TARGET_DIR)/var/www - rm -f $(TARGET_DIR)/etc/init.d/S90thttpd - rm -f $(TARGET_DIR)/bin/htpasswd - rm -f $(TARGET_DIR)/bin/makeweb - rm -f $(TARGET_DIR)/bin/syslogtocern + rm -f $(TARGET_DIR)/etc/init.d/S90thttpd $(TARGET_DIR)/etc/thttpd.conf -$(MAKE) -C $(THTTPD_DIR) clean thttpd-dirclean: rm -rf $(THTTPD_DIR) + ############################################################# # # Toplevel Makefile options -- 2.30.2