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

pkgname="popcorntime-ce-git"
_pkgname="popcorntime-ce"
_device="desktop"
pkgver="r209.36fb825"
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://popcorntime.ag/"
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/PopcornTime-CE/${_device}.git"
	"popcorntime-ce.install"
	"popcorntime-ce.desktop")
sha1sums=("SKIP"
	"2c22a3f1d1335abe8d7ac7dd6a33933720ba30e4"
	"219a9c7033361e1286967452868721302b1d6da7")

_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"

	# Program
	install -Dm755 "${srcdir}/${_bindir}/${_execname}" "${pkgdir}/usr/share/${_pkgname}/"
	install -Dm644 "${srcdir}/${_device}/"{CHANGELOG.md,LICENSE.txt,package.json,README.md} "${pkgdir}/usr/share/${_pkgname}/"
	install -Dm644 "${srcdir}/${_bindir}/"{icudtl.dat,libffmpegsumo.so,nw.pak} "${pkgdir}/usr/share/${_pkgname}/"

	# Directories
	cp -a "${srcdir}/${_device}/"{node_modules,src} "${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"

}