summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c4e774cf95a4e76ce8794981338fd51168fcc261 (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
57
58
59
# Maintainer: Christoph Gysin <christoph.gysin@gmail.com>

pkgname=librespot-git
_pkgname=librespot
pkgver=1435.e5fd7d6
pkgrel=1
epoch=1
pkgdesc="Open Source Spotify client library"
arch=('i686' 'x86_64' 'armv6h' 'armv7h' 'aarch64')
url="https://github.com/librespot-org/librespot"
license=('MIT')
depends=('libvorbis' 'alsa-lib')
makedepends=('git' 'rust')
provides=('librespot')
conflicts=('librespot')
source=('git+https://github.com/librespot-org/librespot')
sha256sums=('SKIP')

pkgver() {
    cd "$_pkgname"
    echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
    cd "$_pkgname"

    case "$CARCH" in
      armv6h) target=arm-unknown-linux-gnueabihf;;
      armv7h) target=armv7-unknown-linux-gnueabihf;;
      *)      target="$CARCH-unknown-linux-gnu";;
    esac

    cargo fetch \
        --locked \
        --target "$target"
}

build() {
    cd "$_pkgname"
    cargo build \
        --frozen \
        --release
}

package() {
    cd "$_pkgname"
    cargo install \
        --no-track \
        --locked \
        --root "$pkgdir/usr" \
        --path .

    install -D -m 644 contrib/librespot.service \
        "$pkgdir"/usr/lib/systemd/system/librespot.service
    install -D -m 644 contrib/librespot.user.service \
        "$pkgdir"/usr/lib/systemd/user/librespot.service
    install -D -m 644 LICENSE \
        "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}