Skip to content

Instantly share code, notes, and snippets.

@spacepluk
Last active August 29, 2015 14:07
Show Gist options
  • Save spacepluk/fb43702fee153dac4be6 to your computer and use it in GitHub Desktop.
Save spacepluk/fb43702fee153dac4be6 to your computer and use it in GitHub Desktop.
# Maintainer: Eric Engestrom <aur [at] engestrom [dot] ch>
# Contributor: Attila Bukor <r1pp3rj4ck [at] w4it [dot] eu>
pkgname=popcorntime-git
pkgver=r3463.416dbc2
pkgrel=1
pkgdesc="Stream movies from torrents. Skip the downloads. Launch, click, watch."
arch=('i686' 'x86_64')
url="http://popcorntime.io"
license=('GPL3')
depends=('alsa-lib' 'gconf' 'gtk2' 'nss' 'ttf-ms-fonts' 'libxtst')
makedepends=('git' 'nodejs' 'nodejs-grunt-cli' 'ruby-compass-alpha' 'nodejs-bower')
#optdepends=('node-webkit: Allows you to skip downloading node-webkit')
conflicts=('popcorntime' 'popcorntime-bin')
provides=("Popcorn-Time")
options=('!strip')
[ "$CARCH" = "i686" ] && _platform=linux32
[ "$CARCH" = "x86_64" ] && _platform=linux64
_gitname=popcorn-app
_DEST="/usr/share/popcorn-time"
source=("git+https://git.popcorntime.io/stash/scm/pt/popcorn-app.git"
"popcorntime.desktop")
md5sums=('SKIP'
'82ea8fbf59b3a9b0079be7ad06269dc0')
pkgver() {
cd "${srcdir}/${_gitname}"
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
prepare() {
cd "${srcdir}/${_gitname}"
# Thanks to guiton for the bower fix
sed -i 's/"bower": "1.3.4"/"bower": "1.3.8"/g' package.json
# Workaround grunt-bower-clean bug
git clone [email protected]:KidkArolis/grunt-bower-clean.git node_modules/grunt-bower-clean
(
cd node_modules/grunt-bower-clean
sed -i 's/"bower": "~1.0.0"/"bower": "1.3.8"/g' package.json
npm install
)
# Get dependencies
npm install
: << 'COMMENT'
# Copy local node-webkit (will be used if grunt wants the same version)
if [ -d /usr/lib/node-webkit/ ]
then
_nwver=$(pacman -Q node-webkit | cut -d" " -f 2 | cut -d- -f1)
install -d "${srcdir}/${_gitname}/build/cache/${_platform}/${_nwver}"
install /usr/lib/node-webkit/* "${srcdir}/${_gitname}/build/cache/${_platform}/${_nwver}"
fi
COMMENT
}
build() {
cd "${srcdir}/${_gitname}"
# Build
grunt build
# Thanks to Revelation60 for pointing it out
# https://github.com/rogerwang/node-webkit/wiki/The-solution-of-lacking-libudev.so.0
msg2 "Patching node-webkit 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}/${_gitname}/build/releases/Popcorn-Time/${_platform}/Popcorn-Time"
# Program
msg2 "Installing program to ${_DEST}"
install -dm755 "${pkgdir}${_DEST}"
install -m755 "Popcorn-Time" "${pkgdir}${_DEST}"
install -m644 "nw.pak" "${pkgdir}${_DEST}"
install -m644 "libffmpegsumo.so" "${pkgdir}${_DEST}"
# Link to program
msg2 "Symlink /usr/bin/${provides[0]} -> ${_DEST}/Popcorn-Time"
install -dm755 "${pkgdir}/usr/bin"
ln -s "${_DEST}/Popcorn-Time" "${pkgdir}/usr/bin/${provides[0]}"
# 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"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment