build_proton.sh: Fix command line parsing

This commit is contained in:
Józef Kucia 2018-04-19 10:35:39 +02:00
parent 5aa155edb2
commit 21f02c73f8

View file

@ -2,7 +2,7 @@
usage() usage()
{ {
echo "$1: [component ... ] [--release] [--package]" echo "$1: [--build component] [--release] [--package]"
echo "Build the Proton Steam Tool" echo "Build the Proton Steam Tool"
echo "Component can be one or more of:" echo "Component can be one or more of:"
echo " wine, wine32, wine64" echo " wine, wine32, wine64"
@ -203,35 +203,33 @@ else
STRIP='strip' STRIP='strip'
fi fi
BUILD_COMPONENTS='all'
if [ "$#" -ge 2 ]; then
for (( i=1; i <= $# - 1; i++)); do
if [ "${!i}" == "--build" ]; then
j=$((i+1))
BUILD_COMPONENTS="${!j}"
break
fi
done
fi
PACKAGE=false PACKAGE=false
if [ "$BUILD_COMPONENTS" == "all" ]; then BUILD_COMPONENTS='all'
PACKAGE=true
fi
INSTALL_PROGRAM_FLAGS='' INSTALL_PROGRAM_FLAGS=''
for param in "$@"; do for (( i=1; i <= $#; i++)); do
param="${!i}"
if [ "$param" == "--release" ]; then if [ "$param" == "--release" ]; then
RELEASE_BUILD=1 RELEASE_BUILD=1
INSTALL_PROGRAM_FLAGS='-s' INSTALL_PROGRAM_FLAGS='-s'
elif [ "$param" == "--package" ]; then elif [ "$param" == "--package" ]; then
PACKAGE=true PACKAGE=true
elif [ "$param" == "--build" ]; then
i=$((i+1))
if [ "$i" -gt "$#" ]; then
usage `basename $0`
exit 1
fi
BUILD_COMPONENTS="${!i}"
else else
usage `basename $0` usage `basename $0`
exit 1 exit 1
fi fi
done done
if [ "$BUILD_COMPONENTS" == "all" ]; then
PACKAGE=true
fi
TOP="$PWD" TOP="$PWD"
MAKE=make MAKE=make
if [ x"$RELEASE_BUILD" == x ]; then if [ x"$RELEASE_BUILD" == x ]; then