RetroArch/qb/qb.params.sh

79 lines
1.8 KiB
Bash
Raw Normal View History

2010-12-30 01:52:02 +00:00
print_help()
{ cat << EOF
====================
Quickbuild script
====================
Package: $PACKAGE_NAME
General environment variables:
CC: C compiler
CFLAGS: C compiler flags
CXX: C++ compiler
CXXFLAGS: C++ compiler flags
LDFLAGS: Linker flags
General options:
--prefix=\$path: Install path prefix
--global-config-dir=\$path: System wide config file prefix
--host=HOST: cross-compile to build programs to run on HOST
--help: Show this help
Custom options:
EOF
while IFS='=#' read VAR VAL COMMENT; do
VAR=$(echo "${VAR##HAVE_}" | tr '[A-Z]' '[a-z]')
case "$VAL" in
2012-06-12 20:16:16 +00:00
'yes'*)
echo "--disable-$VAR: $COMMENT";;
'no'*)
echo "--enable-$VAR: $COMMENT";;
'auto'*)
echo "--enable-$VAR: $COMMENT"
echo "--disable-$VAR";;
*)
echo "--with-$VAR: $COMMENT";;
esac
done < 'qb/config.params.sh'
2010-12-30 01:52:02 +00:00
}
opt_exists() # $opt is returned if exists in OPTS
2012-06-12 20:16:16 +00:00
{ opt=$(echo "$1" | tr '[a-z]' '[A-Z]')
for OPT in $OPTS; do [ "$opt" = "$OPT" ] && return; done
print_help; exit 1
2010-12-30 01:52:02 +00:00
}
parse_input() # Parse stuff :V
2012-06-12 20:16:16 +00:00
{ OPTS=; while IFS='=' read VAR dummy; do OPTS="$OPTS ${VAR##HAVE_}"; done < 'qb/config.params.sh'
#OPTS contains all available options in config.params.sh - used to speedup
#things in opt_exists()
while [ "$1" ]; do
case "$1" in
--prefix=*) PREFIX=${1##--prefix=};;
--global-config-dir=*) GLOBAL_CONFIG_DIR=${1##--global-config-dir=};;
--host=*) CROSS_COMPILE=${1##--host=}-;;
--enable-*)
2012-06-12 20:16:16 +00:00
opt_exists "${1##--enable-}"
eval "HAVE_$opt=yes"
;;
--disable-*)
2012-06-12 20:16:16 +00:00
opt_exists "${1##--disable-}"
eval "HAVE_$opt=no"
;;
--with-*)
2014-06-05 09:45:44 +00:00
arg="${1##--with-}"
val="${arg##*=}"
2012-06-12 20:16:16 +00:00
opt_exists "${arg%%=*}"
2014-06-05 09:45:44 +00:00
eval "$opt=\"$val\""
;;
-h|--help) print_help; exit 0;;
*) print_help; exit 1;;
esac
shift
done
2010-12-30 01:52:02 +00:00
}
. qb/config.params.sh
2010-12-30 01:52:02 +00:00
2012-06-12 20:16:16 +00:00
parse_input "$@"