From cb74fccba039f14f2dc8dda1d851e3737f875554 Mon Sep 17 00:00:00 2001 From: Marrub Date: Sat, 27 Apr 2019 09:57:23 -0400 Subject: [PATCH] add Rebuild --- rebuild.sh | 137 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100755 rebuild.sh diff --git a/rebuild.sh b/rebuild.sh new file mode 100755 index 0000000..e67f8a5 --- /dev/null +++ b/rebuild.sh @@ -0,0 +1,137 @@ +pkgs=( + cef-standard + cereal + chromium-vaapi-bin + chromium-widevine + clementine-qt5-git + desmume-git + dolphin-emu-git + fceux-git + gdcc + gvim-git + gzdoom-legacy + higan_v106-source + higan-bsnes + libsodium-git + mednaffe + megatools + mgba-git + mupen64plus-git + mupen64plus-gui-git + mupen64plus-noncore-plugins-git + obs-linuxbrowser-bin + obs-studio-git + pcsx2-git + ppsspp-git + ripcord + rpcs3-git + sharenix-git + slade + squirrel-sql + vim-runtime-git + xf86-input-xwiimote-git + xf86-video-amdgpu-git + xwiimote-git + zdoom +) +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" + ["vim-runtime-git"]="--asdeps" +) +pkg_ver() { + sed '/^pkgver\=/!d;s/pkgver\=\(.*\)/\1/' PKGBUILD +} +build_package() { + pkg=$1 + shift + + if [[ ! -d ~/bin/$pkg ]] + then + cd ~/bin + git clone https://aur.archlinux.org/$pkg.git + fi + + cd ~/bin/$pkg + + special_handling= + no_pull= + install_as= + makepkg_args="-srLc --noconfirm --needed" + + while [[ $@ ]] + do + case "$1" in + --is-higan) + special_handling=1 + shift + + cd higan + make -j12 + make install + ;; + --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 [[ ! $special_handling ]] + then + if [[ ! $no_pull ]] + 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 + fi + fi +} + +for pkg in ${pkgs[*]} +do + build_package $pkg ${options[$pkg]} +done + +## EOF