# vim: set syn=sh ai et sw=2 st=2 ts=2 tw=0:
#Packager: JRD <jrd@enialis.net>

pkgname=backintime-cli
pkgver=1.0.8
pkgrel=2cp
source=(http://backintime.le-web.org/download/$(echo $pkgname|cut -d- -f1)/$(echo $pkgname|cut -d- -f1)-${pkgver}_src.tar.gz)
sourcetemplate=http://people.salixos.org/jrd/salix/$pkgname/$pkgver-\$arch-$pkgrel/
docs=("readme" "install" "copying" "changes" "authors" "news" "todo" "license" "copyright" "version" "translations")
url=http://backintime.le-web.org

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"$pkgname (simple backup tool for Linux)"
"Back In Time is a simple backup tool for Linux based on rsync."
"The backup is done by taking snapshots of a specified set of folders."
"This is the core and cli component of backintime."
"There are a Gnome/Gtk and a Kde4 GUI available."
)

build() {
  cd $SRC/$(echo $pkgname|cut -d- -f1)-$pkgver/common || return 1
  ./configure || return 1
  make PREFIX=/usr DESTDIR=$PKG install || return 1
  rm -r $PKG/usr/share/doc
  # optimize/compile python
  cd $PKG/usr/share/backintime
  cat <<'EOF' | python
import compileall
compileall.compile_dir("common", force=1)
compileall.compile_dir("plugins", force=1)
EOF
  find . -type f -name '*.py' -exec rm '{}' \;
  # wrapper launcher should use .pyc, not .py
  sed -i 's/\.py /.pyc /' $PKG/usr/bin/backintime
}