From cde4b380f822c02c4515a08b64b890d71702fdfe Mon Sep 17 00:00:00 2001 From: Syping Date: Tue, 12 Jun 2018 06:30:08 +0200 Subject: [PATCH] update configure to accept arguments --- configure | 81 ++++++++++++++++++++++++++++++++++++++++++++++--- res/global.rcc | Bin 16864 -> 16984 bytes 2 files changed, 76 insertions(+), 5 deletions(-) diff --git a/configure b/configure index 962a1d1..ff9878e 100755 --- a/configure +++ b/configure @@ -17,9 +17,80 @@ # along with this program. If not, see . #***************************************************************************** -# Initialise bash script +# Argbash generated code +die() +{ + local _ret=$2 + test -n "$_ret" || _ret=1 + test "$_PRINT_HELP" = yes && print_help >&2 + echo "$1" >&2 + exit ${_ret} +} +begins_with_short_option() +{ + local first_option all_short_options + all_short_options='h' + first_option="${1:0:1}" + test "$all_short_options" = "${all_short_options/$first_option/}" && return 1 || return 0 +} +_arg_prefix= +_arg_qmake= +print_help () +{ + printf '%s\n' "gta5view Configure Script" + printf 'Usage: %s [--prefix ] [--qmake ] [-h|--help]\n' "$0" + printf '\t%s\n' "-h,--help: Prints help" +} +parse_commandline () +{ + while test $# -gt 0 + do + _key="$1" + case "$_key" in + --prefix) + test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1 + _arg_prefix="$2" + shift + ;; + --prefix=*) + _arg_prefix="${_key##--prefix=}" + ;; + --qmake) + test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1 + _arg_qmake="$2" + shift + ;; + --qmake=*) + _arg_qmake="${_key##--qmake=}" + ;; + -h|--help) + print_help + exit 0 + ;; + -h*) + print_help + exit 0 + ;; + *) + _PRINT_HELP=yes die "FATAL ERROR: Got an unexpected argument '$1'" 1 + ;; + esac + shift + done +} +parse_commandline "$@" + +# Initialise bash script - Step 1 +if [ ! "${_arg_prefix}" == "" ]; then + PREFIX=${_arg_prefix} +fi +if [ ! "${_arg_qmake}" == "" ]; then + QMAKE_PATH=${_arg_qmake} +fi + +# Initialise bash script - Step 2 set +e -EXTRA_ARGS= +_extra_args= # Find Source Directory SOURCE=${BASH_SOURCE[0]} @@ -74,12 +145,12 @@ fi # Set Prefix if [ ! "${PREFIX}" == "" ]; then - EXTRA_ARGS="${EXTRA_ARGS} GTA5SYNC_PREFIX=${PREFIX}" + _extra_args="${_extra_args} GTA5SYNC_PREFIX=${PREFIX}" fi # Generating Makefile -echo "${QMAKE_PATH}${EXTRA_ARGS} ${SOURCE_DIR}/gta5view.pro" -${QMAKE_PATH}${EXTRA_ARGS} ${SOURCE_DIR}/gta5view.pro +echo "${QMAKE_PATH}${_extra_args} ${SOURCE_DIR}/gta5view.pro" +${QMAKE_PATH}${_extra_args} ${SOURCE_DIR}/gta5view.pro # Make dependencies if [ ! "${RUN_MAKE_DEPEND}" == "NO" ]; then diff --git a/res/global.rcc b/res/global.rcc index 7fc6f1d405629f6e3003dae93dea7719bebedeea..60cc68801121025d06d78b3326065fa3a7e53df6 100644 GIT binary patch delta 445 zcmaFR%y^@Pk)yCEwU~i{foUU$66@w`Dj!)k3tPIdZMNpW%(_{Vm5Fup9w{lV%{TNO zux#cRUCX*zn@fmw^A6)^*3HK?`B^82+Z#^~a8R85(LrwVNqfb~UG@r-xg6XkPjFC} z{0hik1;iU1948k#$khX_VPFDcMkogHApj)G3&bEA1}?$WDcA$GBtP4_`#ex;6HHWE z7D;pxOjJw;NmK|X3Nn&0xgKi7516p3IYKd`1x!@`2vqa}ke&e(wK778G8Dl?1-y_% vjbNgz!cbA5gBc}YqFUbKNQ#4C!d$EfQN{?EsL3@X(F$;o07K16111Up*9l>a delta 324 zcmcc7!uX(>k)yCEwU~i{fpH^;66=hxoaq?<=xq6^A3``)qpcumAg^FH+iOU}cifn@Mq?Q7CMlc?$Fpwt%;{n+W zj21AS-a#NY2*%?Q0m@0hc$ynQQbjN>zZy{K4;W8nKae*G#uNDg)Hnmiv-k_-MZkE* Q3xT`}plTq+z+mwi05(K6WdHyG