pkgname=git-commit-helper
pkgver=0.9.3
pkgrel=1
pkgdesc="一个帮助规范 git commit message 的工具"
arch=('x86_64')
url="https://github.com/zccrs/git-commit-helper"
license=('MIT')
depends=('git')
makedepends=('rust' 'cargo')
source=()
sha256sums=()
pkgver() {
cd "$startdir"
local tag_ver=$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//' || echo "")
if [ -n "$tag_ver" ]; then
printf "%s" "$tag_ver"
else
printf "$pkgver"
fi
}
prepare() {
cd "$startdir"
export CARGO_HOME="$srcdir/cargo-home"
cargo fetch --locked || true
}
build() {
cd "$startdir"
export CARGO_HOME="$srcdir/cargo-home"
RUSTUP_TOOLCHAIN=stable cargo build --release
}
check() {
cd "$startdir"
export CARGO_HOME="$srcdir/cargo-home"
RUSTUP_TOOLCHAIN=stable cargo test --release || true
}
package() {
cd "$startdir"
mkdir -p "$pkgdir/usr/bin"
mkdir -p "$pkgdir/usr/share/bash-completion/completions"
mkdir -p "$pkgdir/usr/share/zsh/site-functions"
install -Dm755 "target/release/git-commit-helper" "$pkgdir/usr/bin/git-commit-helper"
if [ -f "completions/git-commit-helper.bash" ]; then
install -Dm644 "completions/git-commit-helper.bash" \
"$pkgdir/usr/share/bash-completion/completions/git-commit-helper"
else
echo "Warning: Bash completion file not found"
fi
if [ -f "completions/git-commit-helper.zsh" ]; then
install -Dm644 "completions/git-commit-helper.zsh" \
"$pkgdir/usr/share/zsh/site-functions/_git-commit-helper"
else
echo "Warning: Zsh completion file not found"
fi
if [ -f LICENSE ]; then
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
fi
}