more portability fixes and a prereq check for gnu tar
more portability fixes and a prereq check for gnu tar

git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@5037 3c298f89-4303-0410-b956-a3cf2f4a3e73

--- a/include/host.mk
+++ b/include/host.mk
@@ -6,6 +6,8 @@
 #
 
 include $(TOPDIR)/.host.mk
+
+export TAR
 
 $(TOPDIR)/.host.mk: $(INCLUDE_DIR)/host.mk
 	@( \
@@ -23,6 +25,8 @@
 		if tar --version 2>&1 | grep 'GNU' >/dev/null; then \
 			echo "TAR_WILDCARDS:=--wildcards" >> $@; \
 		fi; \
+		TAR=`which gtar tar | head -n 1`; \
+		echo "TAR:=$$TAR" >> $@; \
 	)
 
 

--- a/include/prereq-build.mk
+++ b/include/prereq-build.mk
@@ -8,6 +8,7 @@
 include $(TOPDIR)/rules.mk
 TMP_DIR:=$(TOPDIR)/tmp
 include $(INCLUDE_DIR)/prereq.mk
+include $(INCLUDE_DIR)/host.mk
 
 define Require/non-root
 	[ "$$(shell whoami)" != "root" ]
@@ -95,3 +96,11 @@
 	Please install perl. \
 ))
 
+define Require/gnutar
+	$(TAR) --version 2>&1 | grep GNU > /dev/null
+endef
+
+$(eval $(call Require,gnutar, \
+	Please install GNU tar. \
+))
+

file:a/rules.mk -> file:b/rules.mk
--- a/rules.mk
+++ b/rules.mk
@@ -6,6 +6,7 @@
 #
 
 -include $(TOPDIR)/.config
+include $(TOPDIR)/include/host.mk
 include $(TOPDIR)/include/verbose.mk
 
 export SHELL=/usr/bin/env bash -c '. $(TOPDIR)/include/shell.sh; eval "$$2"' --

--- a/scripts/make-ipkg-dir.sh
+++ b/scripts/make-ipkg-dir.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 BASE=http://svn.openwrt.org/openwrt/trunk/openwrt
 TARGET=$1
 CONTROL=$2

comments