diff --git a/rebuild.sh b/rebuild.sh index e67f8a5..bcbdb58 100755 --- a/rebuild.sh +++ b/rebuild.sh @@ -1,17 +1,19 @@ -pkgs=( +all_pkgs=( cef-standard cereal + chocolate-doom chromium-vaapi-bin chromium-widevine clementine-qt5-git desmume-git dolphin-emu-git + eternity-engine-git fceux-git gdcc gvim-git gzdoom-legacy - higan_v106-source higan-bsnes + higan_v106-source libsodium-git mednaffe megatools @@ -23,6 +25,7 @@ pkgs=( obs-studio-git pcsx2-git ppsspp-git + prboom-plus ripcord rpcs3-git sharenix-git @@ -37,35 +40,36 @@ pkgs=( declare -A options=( ["cef-standard"]="--asdeps" ["cereal"]="--asdeps" - ["ppsspp-git"]="--install-as ppsspp-git" - ["mupen64plus-noncore-plugins-git"]="--no-pull -f" ["higan_v106-source"]="--is-higan" ["libsodium-git"]="--asdeps" + ["mupen64plus-noncore-plugins-git"]="--no-pull -f" + ["ppsspp-git"]="--install-as ppsspp-git" ["vim-runtime-git"]="--asdeps" ) pkg_ver() { sed '/^pkgver\=/!d;s/pkgver\=\(.*\)/\1/' PKGBUILD } build_package() { - pkg=$1 + cd ~/bin + + local pkg=$1 shift if [[ ! -d ~/bin/$pkg ]] then - cd ~/bin git clone https://aur.archlinux.org/$pkg.git fi - cd ~/bin/$pkg + cd $pkg - special_handling= - no_pull= - install_as= - makepkg_args="-srLc --noconfirm --needed" + local special_handling + local no_pull + local install_as + local makepkg_args="-srLc --noconfirm --needed" - while [[ $@ ]] + while (( $# )) do - case "$1" in + case $1 in --is-higan) special_handling=1 shift @@ -93,45 +97,61 @@ build_package() { esac done - if [[ ! $special_handling ]] + if [[ $special_handling ]] then - if [[ ! $no_pull ]] + return + fi + + if [[ ! $no_pull ]] + then + git pull + fi + + if [[ ! $install_as ]] + then + makepkg_args="$makepkg_args -i" + fi + + local o_pkgver=$(pkg_ver) + local pkgver + + makepkg $makepkg_args + + local res=$? + + if (( $res )) + then + pkgver=$(pkg_ver) + if [[ ! $install_as ]] || [[ ! $pkgver == $o_pkgver ]] then - git pull - fi - - if [[ ! $install_as ]] - then - makepkg_args="$makepkg_args -i" - fi - - o_pkgver=$(pkg_ver) - - makepkg $makepkg_args - - res=$? - - if (( $res )) - then - pkgver=$(pkg_ver) - if [[ ! $pkgver == $o_pkgver ]] - then - echo "error in rebuild, aborting" - exit $res - fi - fi - - if [[ $install_as ]] - then - pkgver=$(pkg_ver) - sudo pacman --noconfirm --needed -U $install_as-$pkgver*.pkg.tar.xz + echo "error in rebuild, aborting" + exit $res fi fi + + if [[ $install_as ]] + then + pkgver=$(pkg_ver) + sudo pacman --noconfirm --needed -U $install_as-$pkgver*.pkg.tar.xz + fi +} +main() { + local pkg + local pkgs + + if (( $# )) + then + pkgs=$@ + else + pkgs=${all_pkgs[*]} + fi + + for pkg in $pkgs + do + build_package $pkg ${options[$pkg]} + done } -for pkg in ${pkgs[*]} -do - build_package $pkg ${options[$pkg]} -done +main $@ ## EOF