Username: Password: Remember me
# Maintainer: Francesco Marinucci <franzmari [at] chakralinux [dot] org>
 
pkgname=tribler
pkgver=7.1.3
_pkgver=7.1.3
pkgrel=1
pkgdesc="A 4th generation file sharing system bittorrent client"
screenshot="http://www.tribler.org/img/image1.png"
arch=('x86_64')
license=('LGPL3')
url="http://www.tribler.org"
depends=('libsodium' 'libtorrent-rasterbar' 'python2-pyqt5' 'qt5-svg' 'phonon-qt5-backend-vlc'
         'python2-apsw' 'python2-cherrypy' 'python2-cryptography' 'python2-decorator'
         'python2-feedparser' 'python2-chardet' 'python2-m2crypto' 'python2-netifaces'
         'python2-plyvel' 'python2-twisted' 'python2-configobj' 'python2-matplotlib'
         'python2-networkx' 'python2-psutil' 'python2-scipy' 'python2-libnacl' 'python2-meliae' 'python2-backports.functools_lru_cache')
optdepends=('vlc: for internal video player')
makedepends=('python2-setuptools' 'git')
provides=('python2-pyipv8')
conflicts=('python2-pyipv8')
source=("https://github.com/Tribler/tribler/archive/v$pkgver.tar.gz")
sha512sums=('0f171dac208e651e52800716e8cc82638e6dfeb5d206b0cde781d7336fcc5e7c8a1da0ed9c27cc35df453a461e5da0a19555194cda85d32a0556adce0dba1a6a')
 
prepare() {
  cd $pkgname-$pkgver
 
  # Fix tribler path
  sed -i 's|/opt/tribler|/usr/share/tribler|g' systemd/anontunnel_helper@.service
  sed -i 's|/opt/tribler|/usr/share/tribler|g' systemd/tribler.service
 
  # Fix version info
  sed -e "s|version_id =.*|version_id = \"${pkgver%_*}\"|g" \
      -e "s|build_date =.*|build_date = \"$(date)\"|g" \
        -i Tribler/Core/version.py
}
 
build () {
  cd $pkgname-$pkgver
 
  python2 setup.py build
}
 
package() {
  cd $pkgname-$pkgver
 
  # Install python modules
  python2 setup.py install --root="$pkgdir" --optimize=1
 
  # Install binary files/assets
  install -dm 755 "$pkgdir"/usr/{bin,share/tribler}
  cp -dr --no-preserve=ownership Tribler "$pkgdir"/usr/share/tribler
  cp -dr --no-preserve=ownership TriblerGUI "$pkgdir"/usr/share/tribler
  ln -s Tribler/Core/CacheDB/schema_sdb_v*.sql "$pkgdir"/usr/share/tribler/Tribler
 
  install -dm 755 "$pkgdir"/usr/share/{applications,pixmaps}
  install -Dm 644 Tribler/Main/Build/Ubuntu/tribler.desktop "$pkgdir"/usr/share/applications
  install -Dm 644 Tribler/Main/Build/Ubuntu/tribler.xpm "$pkgdir"/usr/share/pixmaps
  install -Dm 644 Tribler/Main/Build/Ubuntu/tribler_big.xpm "$pkgdir"/usr/share/pixmaps
  install -Dm 755 debian/bin/tribler "$pkgdir"/usr/bin
  install -Dm 644 logger.conf "$pkgdir"/usr/share/tribler/
  install -Dm 644 run_tribler.py "$pkgdir"/usr/share/tribler/
  install -Dm 644 check_os.py "$pkgdir"/usr/share/tribler/
 
  cp -dr --no-preserve=ownership twisted "$pkgdir"/usr/share/tribler
 
  # Remove test folders
  find "$pkgdir" -type d -name "test" -name "tests" -exec rm -rf {} \;
 
  # Install systemd files
  install -Dm 644 systemd/anontunnel_helper@.service "$pkgdir"/usr/lib/systemd/system/anontunnel_helper@.service
  install -Dm 644 systemd/tribler.service "$pkgdir"/usr/lib/systemd/system/tribler.service
}