[vlc-commits] commit: bootstrap: Use getopts. (Pierre d'Herbemont )
git at videolan.org
git at videolan.org
Sun Oct 31 17:03:53 CET 2010
vlc | branch: master | Pierre d'Herbemont <pdherbemont at free.fr> | Sun Oct 31 16:20:19 2010 +0100| [a827765af7c152553d44f2c08cec488cffc6c732] | committer: Pierre d'Herbemont
bootstrap: Use getopts.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a827765af7c152553d44f2c08cec488cffc6c732
---
extras/contrib/bootstrap | 49 +++++++++++++++++++++++++++++++--------------
1 files changed, 34 insertions(+), 15 deletions(-)
diff --git a/extras/contrib/bootstrap b/extras/contrib/bootstrap
index f6b85c7..effc2a6 100755
--- a/extras/contrib/bootstrap
+++ b/extras/contrib/bootstrap
@@ -24,17 +24,23 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
# ***************************************************************************
-if test "$#" -gt "2" -o "$1" = "-h" -o "$1" = "--help" ; then
- echo "Usage: $0 [target [distro]]" >&2
- echo " Prepare config.mak and distro.mak file." >&2
- exit 1
-fi
-
LANG=C
export LANG
set -e
set +x
+usage()
+{
+cat << EOF
+usage: $0 [-t target] [-d distro]
+
+OPTIONS:
+ -t Force target
+ -d Force distro
+ -h Help
+EOF
+}
+
add_makefile_cfg()
{
echo $1 >> "${config_mak}"
@@ -63,20 +69,33 @@ ensure_macosx_sdk_presence()
DISTRO=
BUILDDIR=.
+while getopts “ht:d:” OPTION
+do
+ case $OPTION in
+ h)
+ usage
+ exit 1
+ ;;
+ t)
+ TARGET=$OPTARG
+ ;;
+ d)
+ DISTRO=$OPTARG
+ ;;
+ ?)
+ usage
+ exit
+ ;;
+ esac
+done
+
BUILD=`gcc -dumpmachine`
-if test "$#" -ge "1"; then
- TARGET="$1"
-else
+if test "x$TARGET" = "x"; then
+ info "No target specified, using '$BUILD'"
TARGET="$BUILD"
fi
-if test "$#" = "2"; then
- info "Forcing distro.mak to use $2.mak"
- DISTRO="$2"
- TARGET="$1"
-fi
-
config_mak="${BUILDDIR}/config.mak"
rm -f "${config_mak}"
{
More information about the vlc-commits
mailing list