Skip to content

Commit

Permalink
starship: simplify completion generation.
Browse files Browse the repository at this point in the history
Use qemu build_helper and vcompletion.
  • Loading branch information
ericonr committed Jul 20, 2020
1 parent 4f90fac commit 4663597
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions srcpkgs/starship/template
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pkgname=starship
version=0.44.0
revision=1
build_style=cargo
build_helper="rust"
build_helper=qemu
hostmakedepends="pkg-config"
makedepends="libgit2-devel"
checkdepends="git"
Expand All @@ -14,29 +14,22 @@ homepage="https://starship.rs"
distfiles="https://github.com/starship/starship/archive/v${version}.tar.gz"
checksum=b002fa0e2b34ad59330a543461a51648751db4ae8d439d58065a3b9656772fe3

if [ "$CROSS_BUILD" ]; then
hostmakedepends+=" qemu-user-static"
fi
post_build() {
STARSHIP="target/${RUST_TARGET}/release/starship"
vtargetrun ${STARSHIP} completions zsh >starship.zsh
vtargetrun ${STARSHIP} completions bash >starship.bash
vtargetrun ${STARSHIP} completions fish >starship.fish
}

pre_check() {
[ -L target/debug ] && unlink target/debug
ln -s release target/debug
}

post_install() {
STARSHIP="target/${RUST_TARGET}/release/starship"
if [ "$CROSS_BUILD" ]; then
export QEMU_LD_PREFIX=${XBPS_CROSS_BASE}
STARSHIP="/usr/bin/qemu-${XBPS_TARGET_QEMU_MACHINE}-static ${STARSHIP}"
fi

${STARSHIP} completions zsh >starship.zsh
${STARSHIP} completions bash >starship.bash
${STARSHIP} completions fish >starship.fish

vinstall starship.zsh 0644 usr/share/zsh/site-functions/ _starship
vinstall starship.bash 0644 usr/share/bash-completion/completions/ starship
vinstall starship.fish 0644 usr/share/fish/vendor_completions.d/
vcompletion starship.bash bash
vcompletion starship.fish fish
vcompletion starship.zsh zsh

vlicense LICENSE
}

0 comments on commit 4663597

Please sign in to comment.