# $Id: PKGBUILD 97582 2013-09-24 13:31:41Z bpiotrowski $
# Maintainer:  Bartłomiej Piotrowski <nospam@bpiotrowski.pl>
# Contributor: Clément Démoulins <clement@archivel.fr>
# Contributor: David Rosenstrauch <darose@darose.net>
# Contributor: Erik Mank <erik@braindisorder.org>

pkgname=tt-rss
pkgver=1.10
pkgrel=1
pkgdesc='Web-based news feed (RSS/Atom) aggregator'
arch=('any')
url='http://tt-rss.org/redmine/'
license=('GPL')
depends=('php')
optdepends=('mysql' 'postgresql' 'php-curl')
install=tt-rss.install
source=(https://github.com/gothfox/Tiny-Tiny-RSS/archive/$pkgver.tar.gz
        service)
sha256sums=('66064f4a880f5cf46e2044037dbe24b2161129db652c75194b46c66988f4e772'
            '41309d75318b32a6a8152c36cbc8431a9173b58ca98f0b73d09b1d2242000737')

package() {
  cd Tiny-Tiny-RSS-$pkgver
  _instdir="$pkgdir"/usr/share/webapps/$pkgname

  install -d "$_instdir"
  cp -ra * "$_instdir/"
  rm -rf "$_instdir"/debian

  install -d "$pkgdir"/etc/webapps/tt-rss
  install -gm640 -g http config.php-dist "$pkgdir"/etc/webapps/tt-rss/config.php-dist
  ln -s /etc/webapps/tt-rss/config.php "$_instdir"/config.php

  install -d "$pkgdir"/var/lib/tt-rss
  mv "$_instdir"/{lock,feed-icons,cache} "$pkgdir"/var/lib/tt-rss
  ln -s /var/lib/tt-rss/lock "$_instdir"/lock
  ln -s /var/lib/tt-rss/feed-icons "$_instdir"/feed-icons
  ln -s /var/lib/tt-rss/cache "$_instdir"/cache
  chown -R 33:33 "$pkgdir"/var/lib/tt-rss
  chmod -R 777 "$pkgdir"/var/lib/tt-rss/*

  install -Dm644 "$srcdir"/service "$pkgdir"/usr/lib/systemd/system/tt-rss.service
}
