aports/testing/mdcat/APKBUILD
2024-12-14 18:00:46 +00:00

70 lines
1.7 KiB
Text

# Contributor: Leo <thinkabit.ukim@gmail.com>
maintainer="Hoang Nguyen <folliekazetani@protonmail.com>"
pkgname=mdcat
pkgver=2.7.1
pkgrel=0
pkgdesc="Cat for markdown"
url="https://github.com/swsnr/mdcat"
arch="all"
license="Apache-2.0"
makedepends="
asciidoctor
cargo
cargo-auditable
openssl-dev
shared-mime-info
"
subpackages="
$pkgname-doc
$pkgname-bash-completion
$pkgname-zsh-completion
$pkgname-fish-completion
"
source="https://github.com/swsnr/mdcat/archive/refs/tags/mdcat-$pkgver.tar.gz"
builddir="$srcdir/mdcat-mdcat-$pkgver"
prepare() {
default_prepare
cargo fetch --target="$CTARGET" --locked
}
build() {
cargo auditable build --release --frozen
# Create a temporary symlink to generate different completion files below
ln -sf mdcat target/release/mdless
for binary in mdcat mdless; do
for shell in bash fish zsh; do
./target/release/$binary --completions $shell > $binary.$shell
done
done
asciidoctor -b manpage -a reproducible -o mdcat.1 mdcat.1.adoc
}
check() {
cargo test --frozen
}
package() {
install -Dm755 target/release/mdcat -t "$pkgdir"/usr/bin/
ln -s mdcat "$pkgdir"/usr/bin/mdless
# Install the generated shell completion files
for binary in mdcat mdless; do
install -Dm644 $binary.bash \
"$pkgdir"/usr/share/bash-completion/completions/$binary
install -Dm644 $binary.fish \
"$pkgdir"/usr/share/fish/vendor_completions.d/$binary.fish
install -Dm644 $binary.zsh \
"$pkgdir"/usr/share/zsh/site-functions/_$binary
done
# Install the generated man-page
install -Dm644 "$builddir"/mdcat.1 -t "$pkgdir"/usr/share/man/man1/
}
sha512sums="
48e3b5c69619ae8b7ee732aa204b8ec03ce79226dbce6fa9afc9e32d062357027f83d19fc87f3307f21f41e49f1ff5f95006adbf702be6d4812254994d112ca6 mdcat-2.7.1.tar.gz
"