[jhbuild] autogen.sh: drop bashism, use POSIX sh
- From: Ryan Lortie <desrt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [jhbuild] autogen.sh: drop bashism, use POSIX sh
- Date: Thu, 2 Jan 2014 15:51:56 +0000 (UTC)
commit 8a216fa535475cd17785dc43537348a0d19ff46f
Author: Ryan Lortie <desrt desrt ca>
Date: Sat Dec 21 21:06:33 2013 -0500
autogen.sh: drop bashism, use POSIX sh
We had a complicated loop in autogen.sh for parsing commandline options.
It allowed setting arbitrary variables in the script, despite the fact
that only two variable were ever documented as being supported (or
probably ever used). The ability to set random shell variables was
pretty questionable to begin with.
Remove the bash-specific substring operations and replace the loop with
a more common switch-based approach which should work with any POSIX
shell (tested with dash). Change to #!/bin/sh.
This patch has the side effect that the user can no longer use a
commandline argument to modify the IFS of the shell running autogen.sh,
but that seems like a good thing to me.
https://bugzilla.gnome.org/show_bug.cgi?id=720068
autogen.sh | 22 +++++++++-------------
1 files changed, 9 insertions(+), 13 deletions(-)
---
diff --git a/autogen.sh b/autogen.sh
index ed22427..53ee157 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,4 +1,4 @@
-#! /bin/bash
+#!/bin/sh
#
# JHBuild configuration script.
#
@@ -82,19 +82,15 @@ parse_commandline()
enable_autotools=$TRUE
while [ -n "$1" ]; do
- # substring operations available in all sh?
- if [ ${1:0:2} = "--" ]; then
- keyvalue=${1:2}
- key=${keyvalue%%=*}
- value=${keyvalue##*=}
- if [ "$key" = "simple-install" ]; then
+ case "$1" in
+ --simple-install)
enable_autotools=$FALSE
- fi
- echo $key | grep -E '^[A-Za-z_][A-Za-z_0-9]*$' > /dev/null 2>&1
- if [ $? -eq 0 ]; then
- eval $key=$value
- fi
- fi
+ ;;
+
+ --prefix=*)
+ prefix="$(echo "$1" | cut -d= -f2)"
+ ;;
+ esac
shift
done
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]