[tor-commits] [flashproxy/master] more FreeBSD compatibility fixes for some build scripts

infinity0 at torproject.org infinity0 at torproject.org
Sat Feb 15 22:57:07 UTC 2014


commit 1432fd2ca896522613be1e4bc8f40712b2a61f96
Author: Ximin Luo <infinity0 at torproject.org>
Date:   Sat Feb 15 18:00:10 2014 +0000

    more FreeBSD compatibility fixes for some build scripts
---
 mkman.sh   |   12 +++++++++---
 version.sh |    5 ++++-
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/mkman.sh b/mkman.sh
index 40bc372..cd4ecff 100755
--- a/mkman.sh
+++ b/mkman.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 # Wrapper around help2man that takes input from stdin.
 
 set -o errexit
@@ -31,9 +31,15 @@ help2man_fixup() {
 	s/\\fI\-/\\fB\-/g;
 	# change ALL-CAPS parameters to italic, "replace with appropriate argument"
 	s/\b\([A-Z][A-Z]*\)\b/\\fI\1\\fR/g;
-}}'
+};}'
 }
 
+if stat -c "%s" . >/dev/null 2>&1; then
+	size() { stat -c "%s" "$@"; }
+else
+	size() { stat -f "%z" "$@"; }
+fi
+
 prog="$1"
 ver="$2"
 name="${3:-$(get_description "$1")}"
@@ -46,7 +52,7 @@ mkdir -p ".tmp.$$"
 echo "$shebang"
 cat
 } > ".tmp.$$/$prog"
-test $(stat -c "%s" ".tmp.$$/$prog") -gt $((${#shebang} + 1)) || { echo >&2 "no input received; abort"; exit 1; }
+test $(size ".tmp.$$/$prog") -gt $((${#shebang} + 1)) || { echo >&2 "no input received; abort"; exit 1; }
 chmod +x ".tmp.$$/$prog"
 
 help2man ".tmp.$$/$prog" --help-option="-q" \
diff --git a/version.sh b/version.sh
index d69dc64..fa89f47 100755
--- a/version.sh
+++ b/version.sh
@@ -1,3 +1,6 @@
 #!/bin/sh
 # Read version from the ChangeLog to avoid repeating in multiple build scripts
-sed -ne 's/^Changes .* version \(..*\)$/\1/g;tx;b;:x p;q' ChangeLog
+sed -ne 's/^Changes .* version \(..*\)$/\1/g;tx
+b
+:x
+p;q' ChangeLog



More information about the tor-commits mailing list