build.sh: pass arguments to functions

sdf
jackun 4 years ago
parent 1f41652061
commit 05551a4049
No known key found for this signature in database
GPG Key ID: 119DB3F1D05A9ED3

@ -142,20 +142,20 @@ configure() {
dependencies dependencies
git submodule update --init --depth 50 git submodule update --init --depth 50
if [[ ! -f "build/meson64/build.ninja" ]]; then if [[ ! -f "build/meson64/build.ninja" ]]; then
meson build/meson64 --libdir lib/mangohud/lib64 --prefix /usr -Dappend_libdir_mangohud=false ${CONFIGURE_OPTS} meson build/meson64 --libdir lib/mangohud/lib64 --prefix /usr -Dappend_libdir_mangohud=false $@ ${CONFIGURE_OPTS}
fi fi
if [[ ! -f "build/meson32/build.ninja" ]]; then if [[ ! -f "build/meson32/build.ninja" ]]; then
export CC="gcc -m32" export CC="gcc -m32"
export CXX="g++ -m32" export CXX="g++ -m32"
export PKG_CONFIG_PATH="/usr/lib32/pkgconfig:/usr/lib/i386-linux-gnu/pkgconfig:/usr/lib/pkgconfig:${PKG_CONFIG_PATH_32}" export PKG_CONFIG_PATH="/usr/lib32/pkgconfig:/usr/lib/i386-linux-gnu/pkgconfig:/usr/lib/pkgconfig:${PKG_CONFIG_PATH_32}"
export LLVM_CONFIG="/usr/bin/llvm-config32" export LLVM_CONFIG="/usr/bin/llvm-config32"
meson build/meson32 --libdir lib/mangohud/lib32 --prefix /usr -Dappend_libdir_mangohud=false ${CONFIGURE_OPTS} meson build/meson32 --libdir lib/mangohud/lib32 --prefix /usr -Dappend_libdir_mangohud=false $@ ${CONFIGURE_OPTS}
fi fi
} }
build() { build() {
if [[ ! -f "build/meson64/build.ninja" ]]; then if [[ ! -f "build/meson64/build.ninja" ]]; then
configure configure $@
fi fi
DESTDIR="$PWD/build/release" ninja -C build/meson32 install DESTDIR="$PWD/build/release" ninja -C build/meson32 install
DESTDIR="$PWD/build/release" ninja -C build/meson64 install DESTDIR="$PWD/build/release" ninja -C build/meson64 install
@ -243,12 +243,32 @@ usage() {
echo -e "\trelease\t\tBuilds a MangoHud release tar package" echo -e "\trelease\t\tBuilds a MangoHud release tar package"
} }
for a in $@; do if [[ -z $@ ]]; then
case $a in usage no-args
"") build;; fi
"pull") git pull;;
"configure") configure;; while [ $# -gt 0 ]; do
"build") build;; OPTS=()
arg="$1"
shift
while [ $# -gt 0 ] ; do
case $1 in
-*)
OPTS+=("$1")
shift
;;
*)
break
;;
esac;
done
echo -e "\e[1mCommand:\e[92m" $arg "\e[94m"${OPTS[@]}"\e[39m\e[0m"
case $arg in
"pull") git pull ${OPTS[@]};;
"configure") configure ${OPTS[@]};;
"build") build ${OPTS[@]};;
"package") package;; "package") package;;
"install") install;; "install") install;;
"reinstall") reinstall;; "reinstall") reinstall;;
@ -259,8 +279,3 @@ for a in $@; do
usage usage
esac esac
done done
if [[ -z $@ ]]; then
usage no-args
fi

Loading…
Cancel
Save