contrib/bat/Pkgfile

37 lines
1.3 KiB
Plaintext

# Description: A cat(1) clone with wings
# URL: https://github.com/sharkdp/bat
# Maintainer: Tim Biermann, tbier at posteo dot de
# Depends on: rust
# Optional: libgit2
name=bat
version=0.24.0
release=1
source=(https://github.com/sharkdp/bat/archive/v$version/$name-$version.tar.gz)
build() {
prt-get isinst libgit2 && PKGMK_BAT+=' git'
prt-get isinst sccache && export RUSTC_WRAPPER=/usr/bin/sccache
[[ ! -e $PKGMK_SOURCE_DIR/rust ]] && mkdir $PKGMK_SOURCE_DIR/rust
# always build man files and completion files
sed -i -e '1,/cfg(feature = "application"/d' $name-$version/build.rs
export CFLAGS+=' -ffat-lto-objects -w'
cargo build --release --manifest-path $name-$version/Cargo.toml \
--no-default-features \
--features "bugreport build-assets minimal-application $PKGMK_BAT"
prt-get isinst bash-completion && install -Dm644 \
$name-$version/target/release/build/bat-*/out/assets/completions/bat.bash \
$PKG/usr/share/bash-completion/completions/bat
prt-get isinst zsh && install -Dm644 \
$name-$version/target/release/build/bat-*/out/assets/completions/bat.zsh \
$PKG/usr/share/zsh/site-functions/_bat
install -Dm644 $name-$version/target/release/build/bat-*/out/assets/manual/bat.1 \
$PKG/usr/share/man/man1/bat.1
install -Dt $PKG/usr/bin $name-$version/target/release/$name
}