From 99da3be819c5e34934789eed92b15d89f7cf0f65 Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Thu, 18 Oct 2012 22:41:39 -0400 Subject: [PATCH] OSX lacks getopt long support :( --- bootstrap.sh | 52 ++++++++++++++++------------------------------------ 1 file changed, 16 insertions(+), 36 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 13d10b39..c46f1eaf 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -698,65 +698,45 @@ run () parse_command_line_options () { - local options= + local SHORTOPTS=':apcmt:dv' - local SHORTOPTS='p,c,a,v' - local LONGOPTS='target:,debug,clean,print-env,configure,autoreconf' - - if ! options=$(getopt --shell bash --longoptions $LONGOPTS --options $SHORTOPTS -n 'bootstrap' -- "$@"); then - die 'Bad option given' - fi - - eval set -- "$options" - - while [[ $# -gt 0 ]]; do - case $1 in - -a | --autoreconf ) + while getopts "$SHORTOPTS" opt; do + case $opt in + a) #--autoreconf AUTORECONF_OPTION=true MAKE_TARGET='autoreconf' - shift ;; - -p | --print-env ) + p) #--print-env PRINT_SETUP_OPTION=true - shift ;; - -c | --configure ) + c) # --configure CONFIGURE_OPTION=true MAKE_TARGET='configure' - shift ;; - --clean ) + m) # maintainer-clean CLEAN_OPTION=true MAKE_TARGET='clean_op' - shift ;; - --target ) + t) # target TARGET_OPTION=true - shift - TARGET_OPTION_ARG="$1" - MAKE_TARGET="$1" - shift + TARGET_OPTION_ARG="$OPTARG" + MAKE_TARGET="$OPTARG" ;; - --debug ) + d) # debug DEBUG_OPTION=true enable_debug - shift ;; - -v | --verbose ) + v) # verbose VERBOSE_OPTION=true VERBOSE=true - shift ;; - -- ) - shift - break - ;; - -* ) - echo "$0: error - unrecognized option $1" 1>&2 + :) + echo "Option -$OPTARG requires an argument." >&2 exit 1 ;; *) - break + echo "$0: error - unrecognized option $1" 1>&2 + exit 1 ;; esac done -- 2.30.2