[cairo-commit] perf/cairo-perf-diff src/check-def.sh src/check-plt.sh

Behdad Esfahbod behdad at kemper.freedesktop.org
Sat Dec 1 01:19:58 PST 2007


 perf/cairo-perf-diff |   31 ++++++++++++++++---------------
 src/check-def.sh     |   12 ++++++------
 src/check-plt.sh     |    6 +++---
 3 files changed, 25 insertions(+), 24 deletions(-)

New commits:
commit e6166f7b442ae55128b417559e48250c287e49b6
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sat Dec 1 04:19:39 2007 -0500

    Convert bash scripts to regular sh ones for greater portability

diff --git a/perf/cairo-perf-diff b/perf/cairo-perf-diff
index 386e351..3795456 100755
--- a/perf/cairo-perf-diff
+++ b/perf/cairo-perf-diff
@@ -1,8 +1,8 @@
-#!/bin/bash
+#!/bin/sh
 set -e
 
 usage() {
-    argv0=$(basename $0)
+    argv0=`basename $0`
 
     cat >&2 << END
 Usage:
@@ -61,7 +61,7 @@ done
 
 # Then if anything is left that still looks like an option, (begins
 # with a dash), give usage to catch --help or any other -garbage
-if [ $# -eq 0 ] || [ "${1#-}" != "$1" ]; then
+if [ $# -eq 0 ] || [ "`echo "$1" | sed 's/^-//'`" != "$1" ]; then
     usage
 fi
 
@@ -90,9 +90,9 @@ fi
 git_setup() {
     SUBDIRECTORY_OK='Yes'
     . git-sh-setup
-    CAIRO_DIR=$(dirname $GIT_DIR)
+    CAIRO_DIR=`dirname $GIT_DIR`
     if [ "$CAIRO_DIR" = "." ]; then
-	CAIRO_DIR=$(pwd)
+	CAIRO_DIR=`pwd`
     fi
     CAIRO_PERF_DIR=$CAIRO_DIR/.perf
 }
@@ -121,8 +121,8 @@ cpu_count() {
 # results from a run with an equivalent src tree.
 rev2perf() {
     rev=$1
-    src_tree_sha=$(rev2sha $rev:src)
-    perf_tree_sha=$(rev2sha HEAD:perf)
+    src_tree_sha=`rev2sha $rev:src`
+    perf_tree_sha=`rev2sha HEAD:perf`
     echo "$CAIRO_PERF_DIR/${perf_tree_sha}-${src_tree_sha}.perf"
 }
 
@@ -135,9 +135,9 @@ run_cairo_perf_if_not_cached() {
     rev=$1
     build_dir="build-$2"
 
-    owd=$(pwd)
-    sha=$(rev2sha $rev)
-    perf=$(rev2perf $rev)
+    owd=`pwd`
+    sha=`rev2sha $rev`
+    perf=`rev2perf $rev`
     if [ -e $perf ] && [ "$force_cairo_perf" != "true" ]; then
 	return 0
     fi
@@ -147,8 +147,8 @@ run_cairo_perf_if_not_cached() {
     fi
 
     cd $CAIRO_DIR
-    boilerplate_files=$(git ls-tree --name-only HEAD boilerplate/*)
-    perf_files=$(git ls-tree --name-only HEAD perf/*)
+    boilerplate_files=`git ls-tree --name-only HEAD boilerplate/*`
+    perf_files=`git ls-tree --name-only HEAD perf/*`
     cd $CAIRO_PERF_DIR
 
     if [ ! -d $build_dir ]; then
@@ -161,7 +161,8 @@ run_cairo_perf_if_not_cached() {
     git reset --hard $sha
 
     if [ -z "$MAKEFLAGS" ]; then
-        export MAKEFLAGS="-j$(expr $(cpu_count) + 1)"
+	CPU_COUNT=`cpu_count`
+        export MAKEFLAGS="-j`expr $CPU_COUNT + 1`"
     fi
 
     if [ ! -e Makefile ]; then
@@ -193,12 +194,12 @@ fi
 
 if [ ! -e $old ]; then
     run_cairo_perf_if_not_cached $old old
-    old=$(rev2perf $old)
+    old=`rev2perf $old`
 fi
 
 if [ ! -e $new ]; then
     run_cairo_perf_if_not_cached $new new
-    new=$(rev2perf $new)
+    new=`rev2perf $new`
 fi
 
 if [ "$html_output" != "true" ]; then
diff --git a/src/check-def.sh b/src/check-def.sh
index e821618..6f4d3f3 100755
--- a/src/check-def.sh
+++ b/src/check-def.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 LANG=C
 
@@ -18,19 +18,19 @@ fi
 defs="cairo.def"
 make $defs
 for def in $defs; do
-	lib=${def%.def}
-	lib=${lib##*/}
+	lib=`echo "$def" | sed 's/[.]def$//'`
+	lib=`echo "$lib" | sed 's at .*/@@'`
 	so=.libs/lib${lib}.so
 
-	test -f $so || continue
+	test -f "$so" || continue
 	echo Checking $def
 
 	{
 		echo EXPORTS
 		eval $get_cairo_syms | grep -v '^_cairo_test_\|^_fini\|^_init' | sort -u
 		# cheat: copy the last line from the def file!
-		tail -n1 $def
-	} | diff $def - || status=1
+		tail -n1 "$def"
+	} | diff "$def" - || status=1
 done
 
 exit $status
diff --git a/src/check-plt.sh b/src/check-plt.sh
index 3cc52b8..887370c 100755
--- a/src/check-plt.sh
+++ b/src/check-plt.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 LANG=C
 
@@ -10,8 +10,8 @@ if ! which readelf 2>/dev/null >/dev/null; then
 fi
 
 for so in .libs/lib*.so; do
-	echo Checking $so for local PLT entries
-	readelf -W -r $so | grep 'JU\?MP_SLO' | grep 'cairo' && status=1
+	echo Checking "$so" for local PLT entries
+	readelf -W -r "$so" | grep 'JU\?MP_SLO' | grep 'cairo' && status=1
 done
 
 exit $status


More information about the cairo-commit mailing list