summaryrefslogtreecommitdiff
path: root/pcr/popcorntime/PKGBUILD
blob: d1653b2aab0fdb8277f5651a6990756fb9b7bcc5 (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Maintainer (Arch): Attila Bukor <r1pp3rj4ck [at] w4it [dot] eu>
# Contributor (Arch): Hugo Osvaldo Barrera <hugo@barrera.io>
# Contributor (Arch): xantares <xantares09@hotmail.com>
# Contributor (Arch): Eric Engestrom <aur [at] engestrom [dot] ch>
# Contributor (Arch): Iwan Timmer <irtimmer@gmail.com>
# Contributor (Arch): Ricardo Band <me [at] xengi [dot] de>

pkgname=popcorntime
pkgver=0.3.7.2
pkgrel=1.1
pkgdesc="Stream movies from torrents. Skip the downloads. Launch, click, watch."
arch=('i686' 'x86_64')
url="http://popcorntime.io/"
license=('GPL3')
makedepends=('git' 'nodejs-grunt-cli' 'nodejs-bower' 'npm')
depends=('alsa-lib' 'gconf' 'gtk2' 'nss' 'ttf-liberation' 'libxtst')
optdepends=('net-tools: vpn.ht client')
options=('!strip')
_gitname=desktop.git
_nw_ver=0.9.2
md5sums=('5b3ddb62787e9ed381105b56626974bb'
         'c2934ff1ce2e40c086449b0465df42c3'
         'fc25eb312257b8c7e04e8e59c973566e'
         '9608f35f4cc083a0c36b0f4ef275ab10')

_platform=linux64
_nw_platform=linux-x64
if [ "$CARCH" = 'i686' ]; then
  _platform=linux32
  _nw_platform=linux-ia32
  md5sums[2]='dca779c67be155aa53458a146cda41ee'
fi
_nw_file=node-webkit-v${_nw_ver}-${_nw_platform}.tar.gz

source=("desktop-v${pkgver}.tar.bz2::https://git.popcorntime.io/popcorntime/desktop/repository/archive.tar.bz2?ref=v${pkgver}"
        "desktop-i18n-master.tar.bz2::https://git.popcorntime.io/popcorntime/desktop-i18n/repository/archive.tar.bz2?ref=master"
        "http://cdn.popcorntime.io/nw/v${_nw_ver}/${_nw_file}"
        "popcorntime.desktop")

prepare() {
  cd "${srcdir}/${_gitname}"

  # https://git.popcorntime.io/popcorntime/desktop/commit/6f1864cb00b0af4da062391de04206f9495c88b0
  sed -i "s|git+https://git.popcorntime.io/mirrors/peerflix.git|https://git.popcorntime.io/mirrors/peerflix/repository/archive.tar.gz|g" package.json

  cp "${srcdir}"/desktop-i18n.git/* src/app/language

  mkdir -p "${srcdir}/${_gitname}/build/cache/${_platform}/${_nw_ver}/"
  mv "${srcdir}/node-webkit-v${_nw_ver}-${_nw_platform}/"* \
    "${srcdir}/${_gitname}/build/cache/${_platform}/${_nw_ver}/"

  # for gyp
  export PYTHON=/usr/bin/python2

  # Get dependencies
  npm install
}

build() {
  cd "${srcdir}/${_gitname}"

  # The grunt 'build' task served as a reference for this:
  grunt css
  grunt bower_clean
  grunt nodewebkit

  # Thanks to Revelation60 for pointing it out
  # https://github.com/rogerwang/node-webkit/wiki/The-solution-of-lacking-libudev.so.0
  msg2 "Patching program to fix libudev.so.0 problem"
  cd "${srcdir}/${_gitname}/build/releases/Popcorn-Time/${_platform}/Popcorn-Time"
  sed -i 's/\x75\x64\x65\x76\x2E\x73\x6F\x2E\x30/\x75\x64\x65\x76\x2E\x73\x6F\x2E\x31/g' Popcorn-Time
}

package() {
  cd "${srcdir}"

  _bpath="${srcdir}/${_gitname}/build/releases/Popcorn-Time/${_platform}/Popcorn-Time"

  install -dm755 "${pkgdir}/usr/lib/${pkgname}"
  install -dm755 "${pkgdir}/usr/bin"

  # Program
  install -Dm755 "${_bpath}/Popcorn-Time" "${pkgdir}/usr/lib/${pkgname}/"
  install -Dm644 "${_bpath}/nw.pak" "${pkgdir}/usr/lib/${pkgname}/"
  install -Dm644 "${_bpath}/libffmpegsumo.so" "${pkgdir}/usr/lib/${pkgname}/"

  # Link to program
  mkdir -p "${pkgdir}/usr/bin"
  ln -s "/usr/lib/${pkgname}/Popcorn-Time" "${pkgdir}/usr/bin/${pkgname}"

  # Desktop file
  install -Dm644 "${srcdir}/popcorntime.desktop" "${pkgdir}/usr/share/applications/popcorntime.desktop"

  # Icon
  install -Dm644 "${srcdir}/${_gitname}/src/app/images/icon.png" "${pkgdir}/usr/share/pixmaps/popcorntime.png"
}