summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 6986246f59eaf87068ed9df5df1d948f7599a411 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Maintainer: Aviana Cruz <gwencroft <at> proton <dot> me>
# shellcheck shell=bash
# shellcheck disable=SC2034,SC2164
_pkgname=mpv-danmaku
pkgname=$_pkgname-git
pkgver=0.1.0.r7.5721aa1
pkgrel=1
pkgdesc='MPV plugin that loads bilibili comments automaticaly'
url='https://github.com/skbeh/mpv-danmaku'
arch=('x86_64')
license=('GPL3')
depends=(
    'mpv'
    'danmu2ass-git' # 'danmu2ass' is dead
)
makedepends=('cargo' 'clang' 'llvm' 'git')
provides=("$_pkgname")
conflicts=("$_pkgname")
source=("git+$url.git")
sha256sums=('SKIP')
options=('!lto')

pkgver() {
    cd "$_pkgname"

    printf '%s' "$(git describe --long --tags | sed 's/^v//; s/\([^-]*-\)g/r\1/; s/-/./g')"
}

prepare() {
    cd "$_pkgname"

    cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}

build() {
    cd "$_pkgname"

    export RUSTUP_TOOLCHAIN=stable
    export CARGO_TARGET_DIR=target
    cargo build --frozen --release
}

check() {
    cd "$_pkgname"

    export RUSTUP_TOOLCHAIN=stable
    cargo test --frozen
}

package() {
    cd "$_pkgname"

    install -Dm755 'target/release/libmpv_danmaku.so' "$pkgdir/usr/lib/$_pkgname/danmaku.so"
    install -dm755 "$pkgdir/etc/mpv/scripts/"
    ln -s "/usr/lib/$_pkgname/danmaku.so" "$pkgdir/etc/mpv/scripts/"
}