rebuild: add better higan install scripting
parent
da2afa86c9
commit
0e40cde4fe
81
rebuild.sh
81
rebuild.sh
|
@ -19,8 +19,7 @@ all_pkgs=(
|
|||
gopherus
|
||||
gvim-git
|
||||
gzdoom-legacy
|
||||
higan-bsnes
|
||||
higan_v106-source
|
||||
higan
|
||||
maxcso
|
||||
mednaffe
|
||||
megatools
|
||||
|
@ -53,42 +52,50 @@ declare -A options=(
|
|||
["mozc"]="--asdeps"
|
||||
["vim-runtime-git"]="--asdeps"
|
||||
|
||||
["higan_v106-source"]="--is-higan"
|
||||
["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
|
||||
|
||||
if [[ ! -d ~/bin/$pkg ]]
|
||||
then
|
||||
git clone https://aur.archlinux.org/$pkg.git
|
||||
fi
|
||||
|
||||
cd $pkg
|
||||
|
||||
local special_handling
|
||||
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
|
||||
--is-higan)
|
||||
special_handling=1
|
||||
shift
|
||||
|
||||
cd higan
|
||||
make clean
|
||||
make -j12
|
||||
make install
|
||||
--handle)
|
||||
special_handling=$2
|
||||
shift 2
|
||||
;;
|
||||
--url)
|
||||
pull_url=$2
|
||||
shift 2
|
||||
;;
|
||||
--no-pull)
|
||||
no_pull=1
|
||||
|
@ -109,37 +116,51 @@ build_package() {
|
|||
esac
|
||||
done
|
||||
|
||||
if [[ $special_handling ]]
|
||||
if [[ ! -d ~/bin/$pkg ]]
|
||||
then
|
||||
return
|
||||
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
|
||||
|
||||
local pkgver
|
||||
|
||||
makepkg $makepkg_args
|
||||
exit_on_err $?
|
||||
|
||||
local res=$?
|
||||
|
||||
if (( $res ))
|
||||
then
|
||||
echo "error in rebuild, aborting"
|
||||
exit $res
|
||||
fi
|
||||
local pkgver
|
||||
|
||||
if [[ $install_as ]]
|
||||
then
|
||||
pkgver=$(pkg_ver)
|
||||
sudo pacman --noconfirm --needed -U $install_as-$pkgver*.pkg.tar
|
||||
exit_on_err $?
|
||||
fi
|
||||
}
|
||||
main() {
|
||||
|
|
Loading…
Reference in New Issue