summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9d2739db7000bb420ef9ec6e9be2109848c06d22 (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
60
61
62
63
64
65
66
67
# Maintainer: FirstAirBender <noblechuk5 [at] web [dot] de>
# Contributor: Jean Lucas <jean@4ray.co>
# Contributor: Pieter Goetschalckx <3.14.e.ter [at] gmail [dot] com>
# Contributor: Eric Engestrom <aur [at] engestrom [dot] ch>
# Contributor: Attila Bukor <r1pp3rj4ck [at] w4it [dot] eu>

pkgname='popcorntime-git'
_pkgname="${pkgname//-git/}"
pkgver=0.4.4.r1879.g64553fa7
pkgrel=1
pkgdesc='Popcorn Time is a multi-platform, free software BitTorrent client that includes an integrated media player.'
arch=(i686 x86_64)
url=https://github.com/popcorn-official/popcorn-desktop
license=(GPL3)
depends=(gtk3 libxss nss nodejs)
makedepends=(git yarn)
provides=(popcorntime)
conflicts=(popcorntime popcorntime-bin)
options=(!strip)
source=("$_pkgname"::git+https://github.com/popcorn-official/popcorn-desktop.git#branch=development
    popcorntime.desktop)
sha512sums=('SKIP'
    '81a447cd3365b439964c1b9eba14bcf31de05e62123ce032590ac2109a447c5db0306bf4c593fe30f075d2b3674a1611a81b7554e43acba152ef34652c819a33')

pkgver() {
    # https://wiki.archlinux.org/index.php/VCS_package_guidelines#The_pkgver()_function
    cd "$_pkgname"
    git describe $(git remote)/master --long | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
    export YARN_GLOBAL_FOLDER=/tmp/node_modules/
    cd "$_pkgname"
    cat >.yarnrc <<EOF
disable-self-update-check true
prefix /tmp/yarn/
yarn-offline-mirror "$YARN_GLOBAL_FOLDER"
yarn-offline-mirror-pruning true
--cache-folder /tmp/yarn-cache/
--non-interactive true
--quiet true
--ignore-engines true
--ignore-optionals true
EOF
    yarn && yarn build
}

# https://wiki.archlinux.org/index.php/creating_packages
package() {
    cd "$_pkgname"

    # create directories
    install -dm755 "$pkgdir"/usr/{share,bin}/

    # copy everything to pkgdir
    cp --archive build/Popcorn-Time/* "$pkgdir/usr/share/${_pkgname}"

    # link binary to /usr/bin/popcorntime
    ln --force --symbolic "../share/${_pkgname}/Popcorn-Time" "$pkgdir/usr/bin/${_pkgname}"

    install -Dm644 "$srcdir/popcorntime.desktop" --target-directory="$pkgdir/usr/share/applications"
    # https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html#directory_layout
    install -Dm644 './src/app/images/icon.png' "$pkgdir/usr/share/icons/hicolor/256x256/apps/popcorntime.png"

    # fix permissions
    chmod 755 "$pkgdir/usr/bin/${_pkgname}"
}