# $Id: PKGBUILD 137226 2015-07-21 17:28:16Z anatolik $
# Contributor: Florian Walch <florian+aur@fwalch.com>
# Contributor: Florian Hahn <flo@fhahn.com>

pkgbase=lua-messagepack
pkgname=(lua51-messagepack lua52-messagepack lua-messagepack)
pkgver=0.3.3
pkgrel=2
arch=(any)
url='https://fperrad.github.io/lua-MessagePack'
license=(MIT)
checkdepends=(lua lua-testmore)
source=(lua-messagepack-$pkgver.tar.gz::https://github.com/fperrad/lua-MessagePack/archive/$pkgver.tar.gz)
sha256sums=('40e86eacac87f4deaa566cdefaaa1ec6ca90ad14a9419805ea90d069736cfda6')

package_lua51-messagepack() {
  pkgdesc='Implementation of MessagePack spec v5 for Lua 5.1'
  depends=(lua51)

  cd lua-MessagePack-${pkgver}
  make LUAVER=5.1 PREFIX=/usr DESTDIR="$pkgdir" install
  install -Dm644 COPYRIGHT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

package_lua52-messagepack() {
  pkgdesc='Implementation of MessagePack spec v5 for Lua 5.2'
  depends=(lua52)

  cd lua-MessagePack-$pkgver
  make LUAVER=5.2 PREFIX=/usr DESTDIR="$pkgdir" install
  install -Dm644 COPYRIGHT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

package_lua-messagepack() {
  pkgdesc='Implementation of MessagePack spec v5 for Lua 5.3'
  depends=(lua)

  cd lua-MessagePack-$pkgver
  make LUAVER=5.3 PREFIX=/usr DESTDIR="$pkgdir" install
  install -Dm644 COPYRIGHT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

check() {
  cd lua-MessagePack-$pkgver
  make check
}

