# $Id: PKGBUILD 130080 2015-03-28 10:11:53Z jlichtblau $
# Maintainer: Sébastien Luttringer
# Contributor: SpepS <dreamspepser at yahoo dot it>
# Contributor: Laszlo Papp <djszapi at archlinux us>
# Contributor: Donald Ephraim Curtis <dcurtis@gmail.com>

pkgbase=penlight
pkgname=('lua-penlight')
pkgver=1.3.2
pkgrel=1
pkgdesc='Lua libraries focusing on input data handling'
arch=('any')
url='https://github.com/stevedonovan/penlight'
license=('custom')
depends=('lua' 'lua-filesystem')
source=("$pkgname-$pkgver.tar.gz::https://github.com/stevedonovan/penlight/archive/$pkgver.tar.gz")
md5sums=('0315a39834bb6fab07741ec04ede1bf4')

check() {
  cd Penlight-$pkgver
  export LUA_PATH="$PWD/lua/?/init.lua;$PWD/lua/?.lua;$(lua -e 'print(package.path)')"
  lua run.lua
}

package_lua-penlight() {

  cd Penlight-$pkgver
  install -dm755 "$pkgdir/usr/share/lua/5.2/pl"
  install -m644 lua/pl/* "$pkgdir/usr/share/lua/5.2/pl"
  # copy docs
  install -dm755 "$pkgdir/usr/share/doc/$pkgname/"{,manual,examples}
  install -m644 CONTRIBUTING.md CHANGES.md README.md "$pkgdir/usr/share/doc/$pkgname"
  install -m644 doc/manual/* "$pkgdir/usr/share/doc/$pkgname/manual"
  install -m644 examples/* "$pkgdir/usr/share/doc/$pkgname/examples"
  # copy license
  install -Dm644 LICENSE.md "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

# vim:set ts=2 sw=2 et:
