Skip to contentSkip to conversation

svn commit: trunk/buildroot: package/sed toolchain/dependencies

Buildroot aldot at uclibc.org 1 participant 1 message Mar 9, 2007

lore
Share & tools
lore
#0 lore raw

Author: aldot
Date: 2007-03-09 00:33:34 -0800 (Fri, 09 Mar 2007) New Revision: 18046

Log:
Improve the checking of sed by adding some common GNU sed installation names (gsed/gnused), checking for a basic OS X sed feature in command line option handling, checking the actual result of the sed run against the expected result, and placing common code for the check under toolchain/dependencies/. (Heikki Lindholm)

Added:
trunk/buildroot/toolchain/dependencies/check-host-sed.sh

Modified:
trunk/buildroot/package/sed/sedcheck.sh trunk/buildroot/toolchain/dependencies/dependencies.sh

Changeset:
Modified: trunk/buildroot/package/sed/sedcheck.sh
===================================================================

buildroot/package/sed/sedcheck.sh +2 -16
@@ -2,24 +2,10 @@
 
 # Make sure the host sed supports '-i' (in-place).
 # If it doesn't, we'll build and use our own.
+SED=$(toolchain/dependencies/check-host-sed.sh)
 
-if test -x /usr/bin/sed ; then
-	SED="/usr/bin/sed"
-else
-	if test -x /bin/sed ; then
-		SED="/bin/sed"
-	else
-		SED="sed"
-	fi
-fi
-
-echo "HELLO" > .sedtest
-$SED -i -e "s/HELLO/GOODBYE/" .sedtest >/dev/null 2>&1
-
-if test $? != 0 ; then
+if [ -z "$SED" ] ; then
 	echo build-sed-host-binary
 else
 	echo use-sed-host-binary
 fi
-
-rm -f .sedtest

Added: trunk/buildroot/toolchain/dependencies/check-host-sed.sh
===================================================================

buildroot/toolchain/dependencies/check-host-sed.sh +38 -0
@@ -0,0 +1,38 @@
+SEDLIST="/usr/bin/sed /bin/sed sed gnused gsed"
+
+DIFF=$(which diff)
+if ! test -x "$DIFF" ; then
+	/bin/echo -e "\n\ntesting for sed needs 'diff' on your build machine\n";
+	exit 1;
+fi;
+
+for SED in $SEDLIST
+do
+	if ! test -x $SED ; then
+		SED=$(which $SED)
+		if ! test -x "$SED" > /dev/null ; then
+			SED=""
+			continue
+		fi
+	fi
+
+	echo "HELLO" > .sedtest
+	echo "GOODBYE" > .sedtest-correct
+	$SED -i -e "s/HELLO/GOODBYE/" .sedtest >/dev/null 2>&1
+
+	if test $? != 0 ; then
+		SED=""
+	elif test -e ".sedtest-e" ; then
+		rm -f ".sedtest-e"
+		SED=""
+	elif ! $DIFF ".sedtest" ".sedtest-correct" > /dev/null ; then
+		echo "diff failed"
+		SED=""
+	fi
+
+	rm -f .sedtest .sedtest-correct
+	if [ ! -z "$SED" ] ; then
+		break
+	fi
+done
+echo $SED

Property changes on: trunk/buildroot/toolchain/dependencies/check-host-sed.sh
___________________________________________________________________
Name: svn:executable
+ *

Modified: trunk/buildroot/toolchain/dependencies/dependencies.sh
===================================================================

buildroot/toolchain/dependencies/dependencies.sh +19 -24

57 lines not on this page · raw message