summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 539c6a56d75e699ce2c8066b42ae4920434b7977 (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
# Maintainer: grufo <madmurphy333@gmail.com>

pkgname='popcorntime-ce-git'
_pkgname='popcorntime-ce'
_device='desktop'
pkgver='r306.a576c24'
pkgrel=1
pkgdesc='Stream movies from torrents. Skip the downloads. Launch, click, watch. Repos of the original community edition.'
arch=('x86_64' 'i686')
url='http://www.popcorn-time.is/'
license=('GPL3')
depends=('alsa-lib' 'desktop-file-utils' 'gconf' 'gtk2' 'libnotify' 'libxtst' 'nodejs' 'nss' 'python' 'ttf-font')
makedepends=('git' 'npm')
optdepends=('net-tools: necessary for the new vpn feature' 'ttf-liberation: open source ttf fonts')
provides=('popcorntime' 'popcorntime-ce')
conflicts=('popcorntime-ce' 'popcorntime-ce-bin')
options=('!strip')
install='popcorntime-ce.install'
source=("git+https://github.com/PopcornTimeCommunity/${_device}.git"
	'popcorntime-ce.install'
	'popcorntime-ce.desktop')
md5sums=('SKIP'
         'b8996810c9862bd9b41880b82055073f'
         '53367e600bad6229b200ed4478f8fcbb')

_platform=$([ $CARCH = 'x86_64' ] && echo 'linux64' || echo 'linux32')
_execname='Popcorn-Time-CE'
_bindir="${_device}/build/${_execname}/${_platform}"

pkgver() {

	cd "${_device}"
	printf "'r%s.%s'" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"

}

prepare() {

	cd "${srcdir}/${_device}"

	npm install --user root

	# Remove all references to ${srcdir}
	find "${srcdir}/${_device}" -type f -print0 | xargs -0 sed -i "s|${srcdir}/${_device}|/usr/share/${_pkgname}|g"

}

build() {

	cd "${srcdir}/${_device}"

	"${srcdir}/${_device}/node_modules/.bin/gulp" build -p "${_platform}"

}

package() {

	cd "${srcdir}/${_bindir}"

	install -dm755 "${pkgdir}/usr/share/${_pkgname}"
	install -dm755 "${pkgdir}/usr/bin"

	# Application
	cp -r "${srcdir}/${_bindir}/"* "${pkgdir}/usr/share/${_pkgname}/"
	cp -a "${srcdir}/${_device}/"{node_modules,src} "${pkgdir}/usr/share/${_pkgname}/"
	chmod -R go=u-w "${pkgdir}/usr/share/${_pkgname}/"
	install -Dm644 "${srcdir}/${_device}/"{CHANGELOG.md,LICENSE.txt,package.json,README.md} "${pkgdir}/usr/share/${_pkgname}/"

	# Link to program
	ln -s "/usr/share/${_pkgname}/${_execname}" "${pkgdir}/usr/bin/${_pkgname}"

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

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

}