all_pkgs=( # deps cef-standard cereal libsodium-git mozc vim-runtime-git # packages chocolate-doom chromium-vaapi-bin chromium-widevine desmume-git dolphin-emu-git eternity-engine-git fceux-git gdcc godot gopherus gvim-git gzdoom-legacy higan maxcso mednaffe megatools mgba-git motsognir mupen64plus-git mupen64plus-gui-git mupen64plus-noncore-plugins-git nicotine-plus-git obs-linuxbrowser-bin obs-studio-git pcsx2-git ppsspp-git prboom-plus ripcord rpcs3-git sharenix-git slade squirrel-sql uim-mozc xf86-input-xwiimote-git xf86-video-amdgpu-git xwiimote-git zdoom ) declare -A options=( ["cef-standard"]="--asdeps" ["cereal"]="--asdeps" ["libsodium-git"]="--asdeps" ["mozc"]="--asdeps" ["vim-runtime-git"]="--asdeps" ["higan"]="--handle Higan --url https://gitlab.com/higan/higan.git/" ["mupen64plus-noncore-plugins-git"]="--no-pull -f" ["ppsspp-git"]="--install-as ppsspp-git" ) pkg_ver() { sed '/^pkgver\=/!d;s/pkgver\=\(.*\)/\1/' PKGBUILD } exit_on_err() { local res=$1 if (( $res )) then echo "error in rebuild, aborting" exit $res fi } higan_make() { make -j12 -C $@ uninstall make -j12 -C $@ clean; exit_on_err $? make -j12 -C $@ all; exit_on_err $? make -j12 -C $@ install; exit_on_err $? } build_package() { cd ~/bin local pkg=$1 shift local special_handling="None" local no_pull local install_as local makepkg_args="-srLcCf --noconfirm" local pull_url="https://aur.archlinux.org/$pkg.git" while (( $# )) do case $1 in --handle) special_handling=$2 shift 2 ;; --url) pull_url=$2 shift 2 ;; --no-pull) no_pull=1 shift ;; --install-as) install_as=$2 shift 2 ;; --asdeps|--skipinteg|-f) makepkg_args="$makepkg_args $1" shift ;; *) echo "error in rebuild configuration ($1), aborting" exit 1 ;; esac done if [[ ! -d ~/bin/$pkg ]] then git clone $pull_url fi cd $pkg if [[ ! $no_pull ]] then git pull fi case $special_handling in None) ;; Higan) git fetch --tags git checkout $(git describe --tags `git rev-list --tags --max-count=1`) higan_make higan target=higan higan_make higan target=bsnes higan_make icarus make -j12 -C shaders install return ;; *) echo "incorrect handler ($special_handling), aborting" exit 1 ;; esac if [[ ! $install_as ]] then makepkg_args="$makepkg_args -i" fi makepkg $makepkg_args exit_on_err $? local pkgver if [[ $install_as ]] then pkgver=$(pkg_ver) sudo pacman --noconfirm --needed -U $install_as-$pkgver*.pkg.tar exit_on_err $? 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 } main $@ ## EOF