scripts/rebuild.sh

200 lines
3.5 KiB
Bash
Raw Normal View History

2019-05-16 23:21:24 -07:00
m64pncp=mupen64plus-noncore-plugins-git
all_pkgs=(
2019-04-30 21:21:21 -07:00
# deps
2019-04-27 06:57:23 -07:00
cef-standard
cereal
2019-04-30 21:21:21 -07:00
libsodium-git
mozc
vim-runtime-git
# packages
chocolate-doom
2019-04-27 06:57:23 -07:00
chromium-vaapi-bin
chromium-widevine
desmume-git
dolphin-emu-git
eternity-engine-git
2019-04-27 06:57:23 -07:00
fceux-git
gdcc
2019-04-30 21:21:21 -07:00
godot
2019-05-03 19:09:35 -07:00
gopherus
2019-04-27 06:57:23 -07:00
gvim-git
gzdoom-legacy
higan
2019-05-14 22:15:06 -07:00
maxcso
2019-04-27 06:57:23 -07:00
mednaffe
megatools
mgba-git
2019-05-03 19:09:35 -07:00
motsognir
2019-04-27 06:57:23 -07:00
mupen64plus-git
mupen64plus-gui-git
2019-05-16 23:21:24 -07:00
$m64pncp
2019-05-14 22:15:06 -07:00
nicotine-plus-git
2019-04-27 06:57:23 -07:00
obs-linuxbrowser-bin
obs-studio-git
pcsx2-git
plasma5-applets-mpdnowplaying
2019-04-27 06:57:23 -07:00
ppsspp-git
prboom-plus
2019-04-27 06:57:23 -07:00
ripcord
rpcs3-git
sharenix-git
slade
squirrel-sql
2019-04-30 21:21:21 -07:00
uim-mozc
2019-04-27 06:57:23 -07:00
xf86-input-xwiimote-git
xf86-video-amdgpu-git
xwiimote-git
zdoom
)
declare -A options=(
2019-05-16 23:21:24 -07:00
[cef-standard]="--asdeps"
[cereal]="--asdeps"
[libsodium-git]="--asdeps"
[mozc]="--asdeps"
[vim-runtime-git]="--asdeps"
[higan]="--handle Higan --url https://gitlab.com/higan/higan.git/"
[$m64pncp]="-f --url https://git.greyserv.net/marrub/$m64pncp.git"
[ppsspp-git]="--install-as ppsspp-git"
2019-04-27 06:57:23 -07:00
)
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 $?
}
2019-04-27 06:57:23 -07:00
build_package() {
cd ~/bin
local pkg=$1
2019-04-27 06:57:23 -07:00
shift
local special_handling="None"
local install_as
2019-04-30 21:21:14 -07:00
local makepkg_args="-srLcCf --noconfirm"
local pull_url="https://aur.archlinux.org/$pkg.git"
2019-04-27 06:57:23 -07:00
while (( $# ))
2019-04-27 06:57:23 -07:00
do
case $1 in
--handle)
special_handling=$2
shift 2
;;
--url)
pull_url=$2
shift 2
2019-04-27 06:57:23 -07:00
;;
--install-as)
install_as=$2
shift 2
;;
--asdeps|--skipinteg|-f)
2019-05-16 23:21:24 -07:00
makepkg_args+=" $1"
2019-04-27 06:57:23 -07:00
shift
;;
*)
echo "error in rebuild configuration ($1), aborting"
exit 1
;;
esac
done
if [[ ! -d ~/bin/$pkg ]]
2019-04-27 06:57:23 -07:00
then
git clone $pull_url
fi
2019-04-27 06:57:23 -07:00
cd $pkg
2019-05-16 21:36:39 -07:00
git pull
2019-04-27 06:57:23 -07:00
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
2019-05-16 23:21:24 -07:00
makepkg_args+=" -i"
fi
2019-04-27 06:57:23 -07:00
makepkg $makepkg_args
exit_on_err $?
2019-04-27 06:57:23 -07:00
local pkgver
if [[ $install_as ]]
then
pkgver=$(pkg_ver)
sudo pacman --noconfirm --needed -U $install_as-$pkgver*.pkg.tar
exit_on_err $?
fi
}
2019-05-16 23:21:24 -07:00
resume_from() {
local resume
for pkg in ${all_pkgs[*]}
do
[[ $pkg = $1 ]] && resume=1
[[ $resume ]] && echo $pkg
done
}
main() {
local pkg
local pkgs
2019-05-16 23:21:24 -07:00
while (( $# ))
do
case $1 in
--resume-from)
pkgs+=" $(resume_from $2)"
shift 2
;;
*)
pkgs+=" $1"
shift
;;
esac
done
if [[ ! $pkgs ]]
then
pkgs=${all_pkgs[*]}
fi
for pkg in $pkgs
do
build_package $pkg ${options[$pkg]}
done
2019-04-27 06:57:23 -07:00
}
main $@
2019-04-27 06:57:23 -07:00
## EOF